Bug 598850

Summary: halt fails due to hwclock failure
Product: Red Hat Enterprise Linux 6 Reporter: Andrew Jones <drjones>
Component: initscriptsAssignee: initscripts Maintenance Team <initscripts-maint-list>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: azelinka, notting, pknirsch, plautrba
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: initscripts-9.03.18-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 636861 (view as bug list) Environment:
Last Closed: 2011-05-19 13:51:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 636861    

Description Andrew Jones 2010-06-02 08:03:42 UTC
When halting the latest rhel6 running as a xen guest, these messages are printed

Syncing hardware clock to system time Cannot access the Hardware Clock via any known method.
            Use the --debug option to see the details of our search for an access method.
         [FAILED]


When adding the --debug 

hwclock from util-linux-ng 2.17.2
hwclock: Open of /dev/rtc failed, errno=2: No such file or directory.
No usable clock interface found.
Cannot access the Hardware Clock via any known method.

/dev/rtc won't exist when rhel6 is running as a PV XenDomU, and possibly also won't exist when running as a KVM guest, but I didn't check that. The easiest solution is

# diff /etc/rc.d/init.d/halt.orig /etc/rc.d/init.d/halt

107c107

< [ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock --systohc

---

> [ -x /sbin/hwclock -a -e /dev/rtc ] && action $"Syncing hardware clock to system time" /sbin/hwclock --systohc

Comment 1 RHEL Program Management 2010-06-02 08:06:11 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 2 Bill Nottingham 2010-06-02 15:20:26 UTC
Wouldn't this be needed for PV DomU on earlier releases too?

Comment 3 Andrew Jones 2010-06-02 16:21:33 UTC
(In reply to comment #2)
> Wouldn't this be needed for PV DomU on earlier releases too?    

I haven't seen this until now. Possibly I overlooked it, but I think I would have, so I'm guessing something changed that has caused it to be more verbose or present or ...

I could try an Alpha 3 or Beta 1 or whatever, if it's necessary.

Comment 4 Bill Nottingham 2010-06-02 19:26:24 UTC
I'm curious, yes. (I also am curious what happens on RHEL 5.)

Comment 5 Andrew Jones 2010-06-08 13:16:56 UTC
RHEL 5.5 I get this log to the console

audit(1276001260.860:13): audit_pid=0 old=1354 by auid=4294967295

type=1111 audit(1276001270.013:14): user pid=2676 uid=0 auid=4294967295 msg='changing system time: exe="/sbin/hwclock" (hostname=?, addr=?, terminal=console res=failed)'


RHEL 6 Beta 4, I get the following

Sending all processes the TERM signal... [  OK  ]
Sending all processes the KILL signal... init: rc main process (1133) stopped by STOP signal
init: rc main process (1133) continued by CONT signal
[  OK  ]



So in all cases there's something funny going on, but the latest RHEL6 makes it the most obvious.

Comment 6 Bill Nottingham 2010-06-08 17:25:44 UTC
...
Sending all processes the KILL signal... init: rc main process (1133) stopped
by STOP signal
init: rc main process (1133) continued by CONT signal
...

This has nothing to do with hwclock. So, I'll try and test some more, but I think the issue is that (for whatever reason) the RHEL 5 kernel creates a /dev/rtc device, and the RHEL 6 kernel doesn't.

Comment 7 RHEL Program Management 2010-07-15 14:48:00 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 10 Andrew Jones 2010-09-23 14:00:37 UTC
(In reply to comment #8)
> As the underlying problem really is why we don't get a /dev/rtc under a guest
> RHEL6 with xen i'm moving this to kernel.
> 
> Thanks & regards, Phil

No, the driver can't work on virt guests (there's no RTC), so it doesn't make sense to have a /dev/rtc node. There actually shouldn't be a /dev/rtc node on RHEL5 either because the driver also fails to load there, as can be seen in this dmesg log

rtc: IRQ 8 is not free.

That proves we bail out of rtc_init() on RHEL5 as well. However, the /dev/rtc node is in RHEL5 virt guests because it's listed in makedev.d. As I pointed out in comment 5, the presence of that node also causes errors with hwclock on shutdown. So it would be best if it wasn't there, or we also need to include a test that /dev/rtc works before trying to use it in the initscripts.

I'm kicking this bug back to initscripts to handle the case that /dev/rtc is not there for RHEL6. Then I'll clone this bug to RHEL5 to handle the case that /dev/rtc is there, but doesn't work. Both these cases RHEL6 and RHEL5 are possible when running as a guest.

Comment 15 errata-xmlrpc 2011-05-19 13:51:09 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0647.html