Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1057634: Fwd: Re: Bug#1057634: /sbin/hwclock: unrecognized option '--rtc=/dev/rtc0'

0 views
Skip to first unread message

Svante Signell

unread,
Dec 6, 2023, 9:00:05 AM12/6/23
to

Mark Hindley

unread,
Dec 6, 2023, 10:10:05 AM12/6/23
to
Control: tags -1 = patch

Svante,

On Wed, Dec 06, 2023 at 02:20:09PM +0100, Svante Signell wrote:
> On a qemu Hurd image:
>
> /sbin/hwclock --help | grep rtc
> --directisa use the ISA bus instead of /dev/rtc0 access
>
> /sbin/hwclock --directisa --show
> 2023-12-06 14:17:54.949951+01:00

Many thanks, that is a great help.

Could you and Martin test this patch, please?

I also propose downgrading the initscripts Depends: util-linux-extra to
Recommends. Even on non-systemd systems, hwclock.sh is far from essential as
many now use NTP and hwclock.sh already handles a missing /sbin/hwclock
gracefully.

Mark

commit acdbb98f05db8f24ddc9e72adb2b6a0982e69748
Author: Mark Hindley <ma...@hindley.org.uk>
Date: Wed Dec 6 10:20:41 2023 +0000

hwclock.sh: support HURD direct ISA I/O.

Closes: #1057634

diff --git a/debian/src/initscripts/etc/init.d/hwclock.sh b/debian/src/initscripts/etc/init.d/hwclock.sh
index a9872b64..055508e7 100644
--- a/debian/src/initscripts/etc/init.d/hwclock.sh
+++ b/debian/src/initscripts/etc/init.d/hwclock.sh
@@ -38,13 +38,24 @@ hwclocksh()
# Updates the Hardware Clock with the System Clock time.
# This will *override* any changes made to the Hardware Clock,
# for example by the Linux kernel when NTP is in use.
- log_action_msg "Saving the system clock to /dev/$HCTOSYS_DEVICE"
- if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc; then
- verbose_log_action_msg "Hardware Clock updated to `date`"
- fi
+ if [ "$(uname -s)" = GNU ]; then
+ log_action_msg "Saving the system clock to CMOS"
+ /sbin/hwclock --directisa --systohc
+ else
+ log_action_msg "Saving the system clock to /dev/$HCTOSYS_DEVICE"
+ /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc
+ fi
+ if [ $? -eq 0 ]; then
+ verbose_log_action_msg "Hardware Clock updated to `date`"
+ fi
+
;;
show)
- /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show
+ if [ "$(uname -s)" = GNU ]; then
+ /sbin/hwclock --directisa --show
+ else
+ /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show
+ fi
;;
*)
log_success_msg "Usage: hwclock.sh {stop|reload|force-reload|show}"

Mark Hindley

unread,
Dec 6, 2023, 12:00:04 PM12/6/23
to
Martin,

On Wed, Dec 06, 2023 at 06:06:41PM +0200, Martin-Éric Racine wrote:
> Please note that the start target refers to a non-existing
> /usr/lib/udev/rules.d/85-hwclock.rules. The correct file is
> /usr/lib/udev/rules.d/hwclock.rules instead. That file contains a
> reference to rtc0 that probably needs fixing for Hurd as well.

Hmmm, udev is linux only, so I imagine udev rules are cruft on Hurd.

> Anyhow, what I get with the patched init script:
>
> [2023-12-06 18:04](HURD i386)perkelix@pxeth:~$ LC_ALL=C sudo
> /etc/init.d/hwclock.sh start
> [2023-12-06 18:04](HURD i386)perkelix@pxeth:~$ LC_ALL=C sudo
> /etc/init.d/hwclock.sh restart
> Saving the system clock to CMOS.
> Hardware Clock updated to Wed Dec 6 18:05:05 EET 2023.
> [2023-12-06 18:05](HURD i386)perkelix@pxeth:~$ LC_ALL=C sudo
> /etc/init.d/hwclock.sh stop
> Saving the system clock to CMOS.
> Hardware Clock updated to Wed Dec 6 18:05:12 EET 2023.
> [2023-12-06 18:05](HURD i386)perkelix@pxeth:~$ LC_ALL=C sudo
> /etc/init.d/hwclock.sh show
> 2023-12-06 18:05:18.129566+02:00

Thanks. Looks OK to me.

Mark

Mark Hindley

unread,
Dec 6, 2023, 12:10:05 PM12/6/23
to
Chris,

Thanks

On Wed, Dec 06, 2023 at 05:57:55PM +0100, Chris Hofstaedtler wrote:
> * Mark Hindley <ma...@hindley.org.uk>:
> > On Wed, Dec 06, 2023 at 06:06:41PM +0200, Martin-Éric Racine wrote:
> > > Please note that the start target refers to a non-existing
> > > /usr/lib/udev/rules.d/85-hwclock.rules. The correct file is
> > > /usr/lib/udev/rules.d/hwclock.rules instead. That file contains a
> > > reference to rtc0 that probably needs fixing for Hurd as well.
> >
> > Hmmm, udev is linux only, so I imagine udev rules are cruft on Hurd.
>
> That would be my understanding as well.
>
> However on linux, the file should be named 85-hwclock.rules again.
> Maybe this could be fixed too?

Of course, queued and pending.

> For hurd (and maybe linux), the big question remains, _if_ updating
> the hwclock should be done by hwclock.sh by default.
> I don't know the answer to this design question for hurd, or for
> linux-with-sysvinit systems.

I don't have a definitive answer either, but either way the script should not
fail on Hurd and by downgrading the Depends to Recommends it is easy to change
the behaviour if it is not to your liking.

Mark

Chris Hofstaedtler

unread,
Dec 6, 2023, 12:10:05 PM12/6/23
to
* Mark Hindley <ma...@hindley.org.uk>:
> On Wed, Dec 06, 2023 at 06:06:41PM +0200, Martin-Éric Racine wrote:
> > Please note that the start target refers to a non-existing
> > /usr/lib/udev/rules.d/85-hwclock.rules. The correct file is
> > /usr/lib/udev/rules.d/hwclock.rules instead. That file contains a
> > reference to rtc0 that probably needs fixing for Hurd as well.
>
> Hmmm, udev is linux only, so I imagine udev rules are cruft on Hurd.

That would be my understanding as well.

However on linux, the file should be named 85-hwclock.rules again.
Maybe this could be fixed too?

For hurd (and maybe linux), the big question remains, _if_ updating
the hwclock should be done by hwclock.sh by default.
I don't know the answer to this design question for hurd, or for
linux-with-sysvinit systems.

Chris

Svante Signell

unread,
Dec 6, 2023, 12:10:05 PM12/6/23
to
On Wed, 2023-12-06 at 16:52 +0000, Mark Hindley wrote:
> Martin,
>
> On Wed, Dec 06, 2023 at 06:06:41PM +0200, Martin-Éric Racine wrote:
> > Please note that the start target refers to a non-existing
> > /usr/lib/udev/rules.d/85-hwclock.rules.  The correct file is
> > /usr/lib/udev/rules.d/hwclock.rules instead. That file contains a
> > reference to rtc0 that probably needs fixing for Hurd as well.
>
> Hmmm, udev is linux only, so I imagine udev rules are cruft on Hurd.

On a Hurd box:
ls /usr/lib/udev/rules.d/85-hwclock.rules
ls: cannot access '/usr/lib/udev/rules.d/85-hwclock.rules': No such file or
directory
ls /usr/lib/udev/rules.d/hwclock.rules
/usr/lib/udev/rules.d/hwclock.rules

dpkg -S /usr/lib/udev/rules.d/hwclock.rules
initscripts: /usr/lib/udev/rules.d/hwclock.rules

On a Devuan/Daedalus box:
ls /usr/lib/udev/rules.d/85-hwclock.rules
/usr/lib/udev/rules.d/85-hwclock.rules
ls /usr/lib/udev/rules.d/hwclock.rules
ls: cannot access '/usr/lib/udev/rules.d/hwclock.rules': No such file or
directory

dpkg -S /usr/lib/udev/rules.d/85-hwclock.rules
util-linux-extra: /usr/lib/udev/rules.d/85-hwclock.rules

Svante Signell

unread,
Dec 6, 2023, 12:20:04 PM12/6/23
to
And on a Devuan/Ceres box:
dpkg -S /usr/lib/udev/rules.d/hwclock.rules
initscripts: /usr/lib/udev/rules.d/hwclock.rules

dpkg -S /usr/lib/udev/rules.d/85-hwclock.rules
dpkg-query: no path found matching pattern /usr/lib/udev/rules.d/85-
hwclock.rules
0 new messages