You are not logged in.
I'm currently trying to set up my desktop to sync time with servers once on reboot. After going through the Arch wiki (namely the "Synchronize once per boot" section ), I created the file with the following code:
/etc/systemd/system/ntp-once.service
[Unit]
Description=Network Time Service (once)
After=network.target nss-lookup.target
[Service]
Type=oneshot
ExecStart=/usr/bin/ntpd -g -u ntp:ntp ; /sbin/hwclock -w
[Install]
WantedBy=multi-user.target
When I go to run the command:
$ sudo systemctl enable ntp-once
Operation failed: Invalid argument
I've double-checked the code and even found that the wiki shows ntpd being in the script above as /usr/bin, when it should be /usr/sbin. Can someone verify if this is something that I'm doing wrong, or if the wiki is incorrect? If I run the ntpd command seperately stated above at the prompt, I get:
$ sudo /usr/sbin/ntpd -g -u ntp:ntp
/usr/sbin/ntpd: invalid option -- 'g'
usage: ntpd [-dSs] [-f file]
$
So I believe it's this command that's hosing it up. Any help is greatly appreciated.
Last edited by 12o (2013-04-24 16:53:13)
Silence is golden.... duct tape is silver.
Time flies like the wind,
Fruit flies like bananas.
Offline
man ntpd
-g
Normally, ntpd exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, ntpd will exit with a message to the system log. This option can be used with the -q and -x options. See the tinker command for other options.
* Emphasis mine
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
That's really strange. When I run the "man ntpd" command, I get no mention of the option: -g.
NTPD(8) System Manager's Manual NTPD(8)
NAME
ntpd - "Network Time Protocol daemon"
SYNOPSIS
ntpd [-dSs] [-f file]
DESCRIPTION
When ntpd starts up, it reads settings from a configuration file, typi‐
cally ntpd.conf(5).
The options are as follows:
-d Do not daemonize. If this option is specified, ntpd will run in
the foreground and log to stderr.
-f file
Use file as the configuration file, instead of the default
/etc/ntpd.conf.
-S Do not set the time immediately at startup. This is the default.
-s Set the time immediately at startup if the local clock is off by
more than 180 seconds. Allows for a large time correction, elimi‐
nating the need to run rdate(8) before starting .
FILES
/etc/ntpd.conf
default ntpd configuration file
SEE ALSO
date(1), adjtime(2), ntpd.conf(5), rdate(8), timed(8)
, Network Time Protocol (Version 3), March 1992.
, Simple Network Time Protocol (SNTP) Version 4, October 1996.
HISTORY
The ntpd program first appeared in OpenBSD 3.6 .
July 9, 2004 NTPD(8)
How can there be two different man pages on two systems that are updated?
UPDATE:
I looked up the man page for ntpd through google and found several more options. If my system is up-to-date, how can the man page be different? As far as I can tell, the problem is indeed at my end.
Last edited by 12o (2013-04-24 16:16:43)
Silence is golden.... duct tape is silver.
Time flies like the wind,
Fruit flies like bananas.
Offline
That's really strange. When I run the "man ntpd" command, I get no mention of the option: -g.
Then why are you using the -g option? An invalid argument error points to it.
What I quoted was from here (I am not currently at my arch machine) http://linux.die.net/man/8/ntpd
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Then why are you using the -g option? An invalid argument error points to it.
What I quoted was from here (I am not currently at my arch machine) http://linux.die.net/man/8/ntpd
I'm following what the Arch wiki says to do to set up the NTPD daemon on a "sync once on bootup". I'm still sort of tinkering with my system and not too knowledgeable on how to set things up just yet. This is just something I've run into that I can't explain, and thought someone on the forums might know.
Silence is golden.... duct tape is silver.
Time flies like the wind,
Fruit flies like bananas.
Offline
The "invalid argument" comes from systemctl itself, not ntp (doesn't mean that there isn't an issue with ntp as well). Are you actually running systemd?
check
$cat /proc/1/comm
Offline
hmmm only thing I can think of is that maybe the wiki needs updating. I can't say for sure until I try it out later tonight at home.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
hmmm only thing I can think of is that maybe the wiki needs updating. I can't say for sure until I try it out later tonight at home.
Ah. Ok. Thank you very much! I'll keep an eye out for any changes tonight/this week.
Silence is golden.... duct tape is silver.
Time flies like the wind,
Fruit flies like bananas.
Offline
Did you notice 65kid's post above mine? Try out what he/she says ...
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
The "invalid argument" comes from systemctl itself, not ntp (doesn't mean that there isn't an issue with ntp as well). Are you actually running systemd?
check$cat /proc/1/comm
Oops. My apologies. I missed your post. Inxsible caught it.
This is what I get when I run the command.
$ cat /proc/1/comm
init
I have the most current systemd installed.
$ pacman -Q | grep systemd
lib32-systemd 202-1
systemd 202-2
$
Last edited by 12o (2013-04-24 16:38:22)
Silence is golden.... duct tape is silver.
Time flies like the wind,
Fruit flies like bananas.
Offline
This is what I get when I run the command.
$ cat /proc/1/comm init
There is your problem, you are still booting with initscripts which has been unsupported for.. well... 6 months. You have some reading to do.
https://wiki.archlinux.org/index.php/Systemd
Offline
12o wrote:This is what I get when I run the command.
$ cat /proc/1/comm init
There is your problem, you are still booting with initscripts which has been unsupported for.. well... 6 months. You have some reading to do.
https://wiki.archlinux.org/index.php/Systemd
ARGH!!! .... At least you found the problem. Thank you very much. Greatly appreciated. I guess now it's off to reading.
UPDATE: Thread marked as SOLVED.
Last edited by 12o (2013-04-24 16:53:37)
Silence is golden.... duct tape is silver.
Time flies like the wind,
Fruit flies like bananas.
Offline