[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



On Wed, Dec 6, 2023 at 4:57 PM Mark Hindley <mark@hindley.org.uk> wrote:
>
> 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 <mark@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}"

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.

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

Martin-Éric


Reply to: