You are not logged in.
Hello Arch Linux Forum!
First off: I use arch now more than a year on a raspberry and I love it!
I've decided to put my root to a usb flash drive and boot my pi from that, because on my SD, arch got corrupted every week...
The setup did run pretty smooth now for about 2 months, but yesterday i had a corruption on my USB stick.
Luckily I got a full backup laying around, so the machine was up again in no time!
But since then theres one problem bugging me: the NTP daemon won't sync anymore on boot and every reboot sets me back to 1970.
I already reinstalled ntp and use the default /etc/ntp.conf (removed the old one, renamed /etc/ntp.conf.pacman to .conf)
My Pi uses a static IP of 10.0.0.5 and the router is on 10.0.0.138 (which itself also does provide a NTP server)
my /etc/netctl/network:
Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('10.0.0.5/24')
Gateway='10.0.0.138'
DNS=('10.0.0.138')
If i issue 'sudo ntpdate pool.ntp.org', it outputs:
1 Jan 01:09:46 ntpdate[406]: the NTP socket is in use, exiting
then I do a 'sudo killall ntpd' and 'sudo ntpdate pool.ntp.org' again:
29 Oct 23:10:38 ntpdate[415]: step time server 93.185.101.77 offset 1383084028.093860 sec
but it doesnt work on boot
this even bugged me right now while rgistering on the forum (human challenge: output of date -u +%V$(uname)|sha256sum|sed 's/\W//g' is just plain wrong when you live in the 70's )
Last edited by gotschi (2013-10-30 11:32:04)
Offline
This may be someting you need to ask on the Arch Linux ARM boards. But I'll take a stab at it anyway.
The Rasbperry Pi doesn't have a Real Time Clock. So that is why it is resetting itself to 1970 everytime you boot the device. The problem lies in ntpd's refusal to change the time if it is off by over a certain amount. Presumably this is because it doesn't want to accidentally overwrite the system clock with UTC if the machine is actually intending to use localtime.
Try this. Make a directory /etc/systemd/system/ntpd.service.d and in that directory make a file that ends in .conf. In it, put this:
[Service]
ExecStart=
ExecStart=/usr/bin/ntpd -qg -u ntp:ntp
The normal service is without the 'q' but adding the 'q' tells ntpd that is is allowed to change the time no matter how crazy far off the time is.
Offline
ah I'm sorry, didn't see that there is a specific board for ARM
thanks for the clarification!
$ cat /etc/systemd/system/ntpd.service.d/ntp.conf
[Service]
ExecStart=
ExecStart=/usr/bin/ntpd -qg -u ntp:ntp
unfortunately this doesn't change anyhing
should i delete this thread and create a new one?
It seems can't move it to the ARM board...
Last edited by gotschi (2013-10-29 22:45:32)
Offline
Arch Linux and Arch Linux ARM are separate projects. We have changed our policy so that general questions that would apply to both are acceptable here. But I think this is one of those cases where it is a Raspberry Pi specific quirk. So asking a bunch of x86 users how to fix it might not be to most efficient route to an answer.
I'm sure that you are not the only one who has experienced this problem though. So maybe you should do a bit of searching in the ARM boards (or other Raspberri Pi boards in general) and see if you can find an answer.
Offline
Moving to Other Architectures...
Offline
thanks for moving!
ok I think I found whats wrong here:
[gotschi@berry ~]$ ps aux | grep ntp
ntp 196 0.0 0.4 5084 1900 ? Ss 01:00 0:00 /usr/bin/ntpd -q -g -u ntp:ntp
root 207 0.0 0.2 5084 948 ? S 01:00 0:00 /usr/bin/ntpd -q -g -u ntp:ntp
gotschi 350 3.0 0.2 4216 964 pts/0 S+ 01:02 0:00 grep ntp
is it normal that 2 processes are running? how can i prevent one from starting? thanks!
Offline
Looks OK to me: depends what is running when you query it. My Pi:
┌─[Scout ~]
└─╼ ps aux | grep ntp
ntp 241 0.0 0.1 3504 812 ? S Oct29 0:00 /usr/bin/ntpd -s
root 251 0.0 0.1 3672 572 ? Ss Oct29 0:00 /usr/bin/ntpd -s
ntp 481 0.0 0.3 5000 1752 ? Ss Oct29 0:09 /usr/bin/ntpd -g -u ntp:ntp
Offline
What I forgot to mention: I installed Watchdog and set the whole / to ReadOnly on boot. (I thought it was a sudden powerdown, idk...)
I removed watchdog using pacman, didn't seem to do any harm (does it?), and removed the RO flag in cmdline.txt on the SD again.
So here's some log if someone can give me some more advice how to get me out of this
[gotschi@berry ~]$ ls -la /etc/ | grep localtime
lrwxrwxrwx 1 root root 33 Jan 1 01:04 localtime -> /usr/share/zoneinfo/Europe/Vienna
[gotschi@berry ~]$ cat /etc/timezone
Europe/Vienna
[root@berry ~]# timedatectl status
Warning: ignoring the TZ variable, reading the system's timezone setting only.
Local time: Thu 1970-01-01 01:12:03 CET
Universal time: Thu 1970-01-01 00:12:03 UTC
Timezone: Europe/Vienna (CET, +0100)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: no
Last DST change: DST ended at
Sun 1948-10-03 02:59:59 CEST
Sun 1948-10-03 02:00:00 CET
Next DST change: DST begins (the clock jumps one hour forward) at
Sat 1980-04-05 23:59:59 CET
Sun 1980-04-06 01:00:00 CEST
after setting the correct time:
[root@berry ~]# killall ntpd
[root@berry ~]# date
Thu Jan 1 01:03:30 CET 1970
[root@berry ~]# timedatectl set-time "2013-10-30 01:25:30"
[root@berry ~]# ntpd -qg
[root@berry ~]# timedatectl status
Warning: ignoring the TZ variable, reading the system's timezone setting only.
Local time: Wed 2013-10-30 01:25:56 CET
Universal time: Wed 2013-10-30 00:25:56 UTC
Timezone: Europe/Vienna (CET, +0100)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: no
Last DST change: DST ended at
Sun 2013-10-27 02:59:59 CEST
Sun 2013-10-27 02:00:00 CET
Next DST change: DST begins (the clock jumps one hour forward) at
Sun 2014-03-30 01:59:59 CET
Sun 2014-03-30 03:00:00 CEST
Offline
The output of timedatectl status looks good. What do you need getting out of?
Offline
as soon as i reboot, the date is back to
[gotschi@berry ~]$ date
Thu Jan 1 01:01:04 CET 1970
Offline
Have you enabled and started the service?
Offline
yes, disabled and reenabled just after i set the correct time again
here's a fresh /var/log/error.log:
[root@berry ~]# cat /var/log/errors.log
Jan 1 01:00:15 localhost kernel: [ 4.700259] sd 0:0:0:0: [sda] No Caching mode page present
Jan 1 01:00:15 localhost kernel: [ 4.707537] sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan 1 01:00:15 localhost kernel: [ 4.718098] sd 0:0:0:0: [sda] No Caching mode page present
Jan 1 01:00:15 localhost kernel: [ 4.723727] sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan 1 01:00:15 localhost kernel: [ 4.736346] sd 0:0:0:0: [sda] No Caching mode page present
Jan 1 01:00:15 localhost kernel: [ 4.741974] sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan 1 01:00:15 localhost kernel: [ 11.455354] dib0700: rc submit urb failed
Jan 1 01:00:15 localhost kernel: [ 11.455354]
Jan 1 01:00:14 localhost systemd-udevd[101]: '/usr/bin/ir-keytable -a /etc/rc_maps.cfg -s rc0' [140] terminated by signal 11 (Segmentation fault)
Jan 1 01:00:18 localhost ntpd[193]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING
Jan 1 01:00:19 localhost systemd[1]: Failed to start One-Shot Network Time Service.
Jan 1 01:00:20 localhost kernel: [ 20.026368] CIFS VFS: default security mechanism requested. The default security mechanism will be upgraded from ntlm to ntlmv2 in kernel release 3.3
Jan 1 01:00:20 localhost smbd[209]: [1970/01/01 01:00:20.511687, 0] ../source3/lib/util_sock.c:446(open_socket_in)
Jan 1 01:00:20 localhost smbd[209]: open_socket_in(): setsockopt: SO_REUSEPORT = true on port 445 failed with error = Protocol not available
Jan 1 01:00:21 localhost ntpd_intres[211]: host name not found: 0.pool.ntp.org
Jan 1 01:00:21 localhost ntpd_intres[211]: host name not found: 1.pool.ntp.org
Jan 1 01:00:21 localhost ntpd_intres[211]: host name not found: 2.pool.ntp.org
Jan 1 01:00:22 localhost samba[203]: [1970/01/01 01:00:22.580792, 0] ../source4/smbd/server.c:478(binary_smbd_main)
Jan 1 01:00:24 localhost samba[203]: At this time the 'samba' binary should only be used for either:
Jan 1 01:00:24 localhost samba[203]: 'server role = active directory domain controller' or to access the ntvfs file server with 'server services = +smb' or the rpc proxy with 'dcerpc endpoint servers = remote'
Jan 1 01:00:24 localhost samba[203]: You should start smbd/nmbd/winbindd instead for domain member and standalone file server tasks
Jan 1 01:01:23 localhost ntpd_intres[211]: host name not found: 0.pool.ntp.org
Jan 1 01:01:23 localhost ntpd_intres[211]: host name not found: 1.pool.ntp.org
Jan 1 01:01:23 localhost ntpd_intres[211]: host name not found: 2.pool.ntp.org
now this looks interesting though:
[root@berry ~]# ntpd -qgd
ntpd 4.2.6p5@1.2349-o Fri Aug 2 04:48:49 UTC 2013 (1)
1 Jan 01:01:49 ntpd[327]: proto: precision = 1.000 usec
event at 0 0.0.0.0 c01d 0d kern kernel time sync enabled
Finished Parsing!!
1 Jan 01:01:49 ntpd[327]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
1 Jan 01:01:49 ntpd[327]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING
[root@berry ~]# systemctl stop ntpd
[root@berry ~]# ntpd -qgd
ntpd 4.2.6p5@1.2349-o Fri Aug 2 04:48:49 UTC 2013 (1)
1 Jan 01:01:57 ntpd[330]: proto: precision = 1.000 usec
event at 0 0.0.0.0 c01d 0d kern kernel time sync enabled
Finished Parsing!!
1 Jan 01:01:57 ntpd[330]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
1 Jan 01:01:57 ntpd[330]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING
[root@berry ~]# ntpd -qgd
ntpd 4.2.6p5@1.2349-o Fri Aug 2 04:48:49 UTC 2013 (1)
1 Jan 01:01:58 ntpd[331]: proto: precision = 1.000 usec
event at 0 0.0.0.0 c01d 0d kern kernel time sync enabled
Finished Parsing!!
clock_filter: n 3 off 1383094744.198676 del 0.031637 dsp 1.937517 jit 0.000240
receive: at 7 10.0.0.5<-194.11.27.31 mode 4 len 48
clock_filter: n 4 off 1383094744.198129 del 0.031640 dsp 0.937522 jit 0.000079
select: combine offset 1383094744.198128700 jitter 0.000000000
event at 7 194.11.27.31 903a 8a sys_peer
clock_update: at 7 sample 7 associd 53086
step_systime: step 1383094744.198129 residual 0.000000
In ntp_set_tod
ntp_set_tod: clock_settime: 0: Success
ntp_set_tod: Final result: clock_settime: 0: Success
30 Oct 02:01:31 ntpd[343]: ntpd: time set +1383094744.198129 s
ntpd: time set +1383094744.198129s
[root@berry ~]# date
Wed Oct 30 02:01:41 CET 2013
seems doable with a boot up script to me, but thats just a workaround...
still dont know whats going on..
Last edited by gotschi (2013-10-30 01:04:25)
Offline
Why is this failing?
systemd[1]: Failed to start One-Shot Network Time Service.
And while those servers should work, you could always pick ones in your region.
Offline
[gotschi@berry ~]$ systemctl | grep -i failed
ntpdate.service
[gotschi@berry ~]$ systemctl status ntpdate.service
ntpdate.service - One-Shot Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; enabled)
Active: failed (Result: exit-code) since Thu 1970-01-01 01:00:19 CET; 3min 27s ago
Process: 193 ExecStart=/usr/bin/ntpd -q -g -u ntp:ntp (code=exited, status=1/FAILURE)
Main PID: 193 (code=exited, status=1/FAILURE)
CGroup: /system.slice/ntpdate.service
[gotschi@berry ~]$ journalctl -b _PID=193
Failed to parse relative boot ID number '_PID=193'
I dont know, but I blame my network, i just
netctl remove network
and added it again, but no success...
edit: yes I could use the local ones (I did, I just reversed the ntp.conf back to default as earlier described, just to make sure...)
[root@berry ~]# ping 1.pool.ntp.org
PING 1.pool.ntp.org (194.11.27.31) 56(84) bytes of data.
64 bytes from trust.nobody.at (194.11.27.31): icmp_seq=1 ttl=54 time=31.7 ms
64 bytes from trust.nobody.at (194.11.27.31): icmp_seq=2 ttl=54 time=31.7 ms
64 bytes from trust.nobody.at (194.11.27.31): icmp_seq=3 ttl=54 time=31.6 ms
64 bytes from trust.nobody.at (194.11.27.31): icmp_seq=4 ttl=54 time=32.2 ms
[root@berry ~]# systemctl start ntpd
Job for ntpd.service failed. See 'systemctl status ntpd.service' and 'journalctl -xn' for details.
[root@berry ~]# systemctl status ntpd.service
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Drop-In: /etc/systemd/system/ntpd.service.d
└─ntp.conf
Active: activating (start) since Wed 2013-10-30 02:38:30 CET; 4s ago
Main PID: 341 (code=exited, status=0/SUCCESS); : 489 (ntpd)
CGroup: /system.slice/ntpd.service
├─489 /usr/bin/ntpd -qg -u ntp:ntp
└─490 /usr/bin/ntpd -qg -u ntp:ntp
Oct 30 02:38:30 berry ntpd[489]: Listen normally on 5 lo ::1 UDP 123
Oct 30 02:38:30 berry ntpd[489]: peers refreshed
Oct 30 02:38:30 berry ntpd[489]: Listening on routing socket on fd #22 for interface updates
Oct 30 02:38:31 berry ntpd[489]: Deferring DNS for 0.pool.ntp.org 1
Oct 30 02:38:31 berry ntpd[489]: Deferring DNS for 1.pool.ntp.org 1
Oct 30 02:38:31 berry ntpd[489]: Deferring DNS for 2.pool.ntp.org 1
Oct 30 02:38:31 berry ntpd[490]: signal_no_reset: signal 17 had flags 4000000
Oct 30 02:38:33 berry ntpd_intres[490]: host name not found: 0.pool.ntp.org
Oct 30 02:38:33 berry ntpd_intres[490]: host name not found: 1.pool.ntp.org
Oct 30 02:38:33 berry ntpd_intres[490]: host name not found: 2.pool.ntp.org
Last edited by gotschi (2013-10-30 01:40:08)
Offline
Why aren't you using the default ntpd.service (which is forking, not one-shot, among other things)?
Offline
[gotschi@berry ~]$ ps aux | grep ntp ntp 196 0.0 0.4 5084 1900 ? Ss 01:00 0:00 /usr/bin/ntpd -q -g -u ntp:ntp root 207 0.0 0.2 5084 948 ? S 01:00 0:00 /usr/bin/ntpd -q -g -u ntp:ntp gotschi 350 3.0 0.2 4216 964 pts/0 S+ 01:02 0:00 grep ntp
Why is the second process listed as root's when it is supposed to drop privileges according to the command used to execute it?
[I don't think this is the problem but it seems odd and I wonder what I don't understand.]
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Can you explain to me which service is running insted of the ntpd.service? I disbled ntpdate now
[root@berry ~]# systemctl status ntpd.service
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: active (running) since Thu 1970-01-01 01:00:23 CET; 1min 57s ago
Process: 204 ExecStart=/usr/bin/ntpd -g -u ntp:ntp (code=exited, status=0/SUCCESS)
Main PID: 207 (ntpd)
CGroup: /system.slice/ntpd.service
└─207 /usr/bin/ntpd -g -u ntp:ntp
Jan 01 01:00:22 berry ntpd[207]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Jan 01 01:00:22 berry ntpd[207]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Jan 01 01:00:22 berry ntpd[207]: Listen and drop on 1 v6wildcard :: UDP 123
Jan 01 01:00:22 berry ntpd[207]: Listen normally on 2 lo 127.0.0.1 UDP 123
Jan 01 01:00:22 berry ntpd[207]: Listen normally on 3 eth0 10.0.0.5 UDP 123
Jan 01 01:00:22 berry ntpd[207]: Listen normally on 4 eth0 fe80::ba27:ebff:fe50:ecf4 UDP 123
Jan 01 01:00:22 berry ntpd[207]: Listen normally on 5 lo ::1 UDP 123
Jan 01 01:00:22 berry ntpd[207]: peers refreshed
Jan 01 01:00:22 berry ntpd[207]: Listening on routing socket on fd #22 for interface updates
Jan 01 01:00:23 berry systemd[1]: Started Network Time Service.
reboot and see if I can get some sleep... hopefully :)
edit: nope, still in 1970...
[root@berry ~]# systemctl start ntpd.service
starts with no errors whatsoever... :/
Last edited by gotschi (2013-10-30 02:58:17)
Offline
THANK YOU wonderwoofy, jasonwryan & cfr! now it works!
Here's what did it for me:
systemctl disable ntpdate
added my router's address in /etc/ntp.conf
stop ntpd, killall ntpd
ntpd -qg (twice)
added WonderWoofy's .conf from post #2
systemctl enable ntpd
systemctl start ntpd
and voila - after about 2 seconds past boot, my raspberry gets the correct time!
I still don't know why i can't use the internet time servers but there's no internet anyway when the router is turned off
thank you
Offline
Awesome: glad you got it sorted. Welcome to 2013.
Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.
Offline
Note that the -q option in WonderWoofy's config will also cause ntpd to exit after adjusting your time. So it is emulating ntpdate. It also enables the time shift regardless of size, which WonderWoofy mentioned.
Whether or not that combination is what you want, I don't know, but you should be aware that the -q has that dual effect.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Maybe it would be good to put that as an ExecStartPre= then. Though I'm not sure that it is necessary at all if jwr is able to handle things just fine without it on his Pi.
Offline
I've not really spent any time looking at this before today as it has always
just worked™…
The standard service file doesn't include the -q option; so long as the daemon
is able to synch to an external time source (ntp server or router) I guess the
service file as is should suffice.
Offline
I've tried the ExecStartPre= in your .conf but systemctl status ntpd.service claimed there's no ExecStart=, so no start...:/
I don't really need the time precise up to the second, but accurate to about a minute is nice.
(I use my raspberry pretty heavy as server and DVB receiver, so the scheduled tv shows should record at the defined time ;)
Services running on it:
CUPS server for 2 HP printers with nasty USB drivers (Airprint supported),
TvHeadEnd with a DVB-T and a DVB-S Stick (> 1000 Channels),
Apache with a little website,
Controllable Arduino to trigger my remote for the garage door (via apache)
All in all my pi is wired pretty heavy (7 usb devices) and runs perfectly since a year now idling at about 90, im happy :)
(edit: no overclocking whatsoever, I experienced SD/USB Corruption while overclocking :( )
Last edited by gotschi (2013-10-30 11:30:36)
Offline
I got this working by entering "tinker panic 0" at the bottom of my ntp.conf file and restarting the service.
Offline