Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a buildroot generated kernel (3.6.11) and root file system running on an x86 device. It uses busybox and I am trying to set the BIOS hardware clock using hwclock. I get this error whenever I invoke hwclock :

can't open '/dev/misc/rtc': No such file or directory

I understand this as I only have a /dev/rtc device file present on my system. However, using strace I see that hwclock has already tried to open /dev/rtc and fails with message

open("/dev/rtc",O_READONLY|O_LARGEFILE) = -1 ENODEV (No such device)

Upon inspecting the kernel configuration for the Real Time Clock under the Device Drivers section of the kernel configuration I can see that I have enabled the option for /dev/rtcN (character devices) and /proc/driver/rtc (procfs for rtc0). I also only have the driver PC-style 'CMOS' platform RTC driver selected. However under the help section here I read the following:

Say "yes" here to get direct support for the real time clock found in every PC or ACPI-based system, and some other boards. Specifically the original MC146818, compatibles like those in PC south bridges, the DS12887 or M48T86, some multifunction or LPC bus chips, and so on.

Your system will need to define the platform device used by this driver, otherwise it won't be accessible

I am very confused as to why I cannot open the `/dev/rtc' file. It is present and I get output when I invoke

cat /proc/driver/rtc

Is there something else I need to do to register the device ? I was thinking of perhaps changing the driver to become a module and do an insmod after boot up but I do not know if that is a good idea or not. Can anyone suggest how I can fix this or get more details about what has gone wrong?

EDIT From online reading I performed dmesg | grep -i rtc and obtained the following output:

[ ... ] RTC time: 16:01:07, date 09/24/13
[ ... ] rtc_cmos 00:02: RTC can wake from S4
[ ... ] rtc_cmos 00:02: rtc core: registered rtc_cmos as rtc0
[ ... ] rtc0: alarms up to one year, y3k, 114 bytes nvram

Which makes me wonder why I have no /dev/rtc0. I am using a static device table in buildroot so is it possible I would need to alter this to provide a /dev/rtc0 device node since I am not using udev ?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I can explain some of the symptoms, but not tell you how to get hwclock to work.

There is often some confusion regarding the meaning of the word device in a unix context. It can mean:

  • A filesystem entry of type character device or block device.
  • The kernel entity behind that filesystem node.
  • The logical entity connected to a hardware bus.
  • A physically separate hardware component.

In the message “no such device”, the word device refers to the kernel entity. There appears to be no kernel entity that has registered the device /dev/rtc. Given the dmesg output, the CMOS RTC driver is present in the kernel and has found an RTC and given it the number 0.

Devices (again, in the sense of the kernel entity) are accessed through device files (first sense above) which is identified by their type (character or device), their major number and their minor number. The name is irrelevant to the kernel, so /dev/rtc vs /dev/rtc0 isn't a problem as long as hwclock finds the right file. Check that /dev/rtc has the correct device number:

crw------- 1 root root 254, 0 Sep 24 13:29 /dev/rtc

If /dev/rtc is a symbolic link, it should be a link to rtc0, which should have the device number (254,0) as above.

share|improve this answer
Thanks for this. The problem was the device major minor numbers in the buildroot provided /dev/rtc file are not correct. I created a new device /dev/rtc0 as part of my initramfs with 254,0 and now it all works as I would expect. –  mathematician1975 Sep 25 '13 at 8:07
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.