6

I have a raspberry pi and every reboot I see this output in last:

root@RaspberryPi:~# last | grep boot reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01) reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01) reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01) 

This is despite having both fake-hwclock and a hardware RTC installed.

Currently the service for fake-hwclock.service starts before sysinit.target, like this:

[Unit] Before=sysinit.target [Service] ExecStart=/sbin/fake-hwclock load [Install] WantedBy=sysinit.target 

How do I make it run before /var/log/wtmp is updated?

1

2 Answers 2

1

I believe that this is a bug in systemd-update-utmp. See my comment here: https://github.com/systemd/systemd/issues/6057#issuecomment-435247567

A workaround is to run fake-hwclock in initramfs, before it passes control to the main systemd instance.

-1

wtmp "reboot" login records are handled by the systemd-update-utmp systemd service. It must start before the sysinit target which means before that start is complete this service will start IF it wasn't started already. It does not mean that systemd-timesyncd will necessarily start before systemd-update-utmp.

I tested on my arch linux server and consistently systemd-timesyncd always runs well before systemd-update-utmp however. On the other hand they are almost always one pid away from each other.

But since it isn't explicitly running after NTP I suppose this should still be considered a bug.

From the systemd manual:

"After= is the inverse of Before=, i.e. while After= ensures that the configured unit is started after the listed unit finished starting up"

https://www.freedesktop.org/software/systemd/man/systemd.unit.html

What you should do:

systemctl edit systemd-update-utmp [Unit] After=systemd-timesyncd.service Wants=systemd-timesyncd.service 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.