Opened 8 years ago

Last modified 4 years ago

#1228 reopened defect

Hardware clock not accessible

Reported by: samgee Owned by: mrmoku
Priority: major Milestone:
Component: SHR Image Version: SHR-unstable
Keywords: Cc:

Description

Command hwclock gives an error when trying to read or write the hardware clock:

root@om-gta02 ~ # hwclock -r
hwclock: can't open '/dev/misc/rtc': No such file or directory
root@om-gta02 ~ # ls -l /dev/misc/rtc
ls: /dev/misc/rtc: No such file or directory

Because of this my Freerunner looses the correct time when I reboot it (or even suspend it apparently).

Change History (11)

comment:1 Changed 8 years ago by jama

your hwclock is from busybox? mine is from util-linux-ng and works ok:

SHR root@gojama ~ $ hwclock.util-linux-ng
Wed Nov 10 12:23:00 2010 -0.081995 seconds
SHR root@gojama ~ $ hwclock -r
Wed Nov 10 12:23:16 2010 0.000000 seconds
SHR root@gojama ~ $ ls -lah /dev/rtc0
crw------- 1 root root 254, 0 Jan 1 1970 /dev/rtc0

comment:2 Changed 8 years ago by samgee

root@om-gta02 ~ # whereis hwclock
hwclock: /sbin/hwclock /sbin/hwclock.util-linux-ng
root@om-gta02 ~ # ls -l /sbin/hwclock
lrwxrwxrwx 1 root root 14 Nov 4 22:26 /sbin/hwclock -> ../bin/busybox
root@om-gta02 ~ # /sbin/hwclock -r
hwclock: can't open '/dev/misc/rtc': No such file or directory
root@om-gta02 ~ # /sbin/hwclock.util-linux-ng -r
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
root@om-gta02 ~ # ls -lah /dev/rtc0
crw------- 1 root root 254, 0 Jan 1 1970 /dev/rtc0
root@om-gta02 ~ #

I have full-om-gta02.tar.gz installed + navit + did an opkg upgrade today.

comment:3 Changed 8 years ago by jama

Please add:
"uname -a"
"strace /sbin/hwclock -r 2>&1 | grep dev"
"ls -la /boot" (if you're running from uSD)
"opkg info util-linux-ng | grep Version"
"opkg info busybox | grep
Version"

full-om-gta02.tar.gz doesn't say much, /etc/shr-version is better, but the info above should be enough.

Here it reads /dev/rtc then /dev/rtc0 and don't know why it doesn't stop here for you as you have it too.

Btw loosing time if you power off for even short time is hw problem (backup batteries failing), search ML for more info.

comment:4 Changed 8 years ago by samgee

root@om-gta02 ~ # uname -a
Linux om-gta02 2.6.34.7 #1 Sun Oct 31 20:28:57 CET 2010 armv4tl GNU/Linux
root@om-gta02 ~ # strace /sbin/hwclock -r 2>&1 | grep dev
open("/dev/rtc", O_RDONLY|O_LARGEFILE)  = -1 ENOENT (No such file or directory)
open("/dev/rtc0", O_RDONLY|O_LARGEFILE) = -1 EBUSY (Device or resource busy)
open("/dev/misc/rtc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
write(2, "hwclock: can\'t open \'/dev/misc/r"..., 63hwclock: can't open '/dev/misc/rtc': No such file or directory
root@om-gta02 ~ # ls -la /boot
drwxr-xr-x    2 root     root          4096 Nov  4 01:57 .
drwxr-xr-x   17 root     root          4096 Nov  4 03:25 ..
-rw-r--r--    1 root     root            24 Nov  4 01:57 append-GTA02
lrwxrwxrwx    1 root     root            15 Nov  4 22:26 uImage -> uImage-2.6.34.7
-rw-r--r--    1 root     root       1921880 Oct 31 20:38 uImage-2.6.34.7
lrwxrwxrwx    1 root     root             6 Nov  4 22:26 uImage-GTA02.bin -> uImage
root@om-gta02 ~ # opkg info util-linux-ng | grep ^Version
Version: 2.17-r33.2.6
root@om-gta02 ~ # opkg info busybox | grep ^Version
Version: 1.17.3-r38.1.6
root@om-gta02 ~ # 

After I installed this shr-u I initially had the problem that the date was back in the year 2000 after I power cycled or suspended, so I kept auto-suspend off. I just tried power cycle and suspend again and date/time is still OK. Not sure what happened there.

comment:5 Changed 8 years ago by jama

Same as here, only my /dev/rtc0 is not busy, can you check what is using it? With fuser/lsof..

comment:6 Changed 8 years ago by samgee

root@om-gta02 ~ # fuser /dev/rtc0
188 
root@om-gta02 ~ # lsof /dev/rtc0
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
fsodevice 188 root   51r   CHR  254,0      0t0  153 /dev/rtc0

comment:7 Changed 7 years ago by elisa42

  • Resolution set to fixed in unstable
  • Status changed from new to closed

hwclock -r seems to be working fine now.
Please reopen if it is still an issue for you.

comment:8 Changed 7 years ago by Heinervdm

  • Resolution fixed in unstable deleted
  • Status changed from closed to reopened

comment:9 Changed 7 years ago by Heinervdm

  • Resolution set to worksforme
  • Status changed from reopened to closed

comment:10 Changed 4 years ago by gurucubano

  • Resolution worksforme deleted
  • Status changed from closed to reopened

This is with stage 131:

root@om-gta02:~# opkg install util-linux
...
update-alternatives: Linking sbin/hwclock to /bin/busybox.nosuid
update-alternatives: Linking
usr/bin/utmpdump to /usr/bin/utmpdump.util-linux
update-alternatives: Linking usr/bin/eject to /usr/bin/eject.util-linux
update-alternatives: Linking
bin/getopt to /usr/bin/getopt
update-alternatives: Linking bin/su to /bin/su.shadow
root@om-gta02:~# hwclock --systohc
hwclock: can't open '/dev/misc/rtc': No such file or directory
root@om-gta02:~# hwclock -r --rtc /dev/rtc0
hwclock: can't open '/dev/rtc0': Device or resource busy

comment:11 Changed 4 years ago by gurucubano

it helps killing the offending proc:

root@om-gta02:~# lsof | fgrep rtc
fsodevice 98 root mem REG 179,1 18612 49745 /usr/lib/cornucopia/modules/fsodevice/kernel26_rtc.so
fsodevice 98 root 59r CHR 254,0 0t0 141 /dev/rtc0
gdbus 98 136 root mem REG 179,1 18612 49745 /usr/lib/cornucopia/modules/fsodevice/kernel26_rtc.so
gdbus 98 136 root 59r CHR 254,0 0t0 141 /dev/rtc0
root@om-gta02:~# kill 98
root@om-gta02:~# lsof | fgrep rtc
root@om-gta02:~# hwclock -w --rtc /dev/rtc0
root@om-gta02:~# hwclock --systohc

Note: See TracTickets for help on using tickets.