bug-gnulib
[Top][All Lists]
Advanced

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

Re: boot time on Linux


From: Natanael Copa
Subject: Re: boot time on Linux
Date: Thu, 10 Aug 2023 11:30:19 +0200

Hi, I had a quick look at the thread, and I have a few comments.

1) it is openrc's bootmisc (https://github.com/OpenRC/openrc/blob/86efc43d0e0d7569f5d2e7a58b8c461ac9f7dae8/init.d/bootmisc.in#L197) that creates /var/run/utmp. There is no guarantee that this exists. You  can for example run emacs in a alpine docker container.
2) Even if it does exist, there is no guarantee that the timestamp is correct. There are machines without RTC (Raspberry PI for example), and in this case the time stamp may end up to be the same every reboot (if correctly set up it should save the shutdown time for the reboot and set time to this on next boot, but there is no guarantee).

For emacs' use case I'd say the best solution would be to use uptime from sysinfo(2) and assume system time is correct (NTP client should be running at the time emacs is started).

-nc


On Wed, Aug 9, 2023 at 9:31 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
[For those cc'ed, the thread's at <https://bugs.gnu.org/64937#142>.]

On 2023-08-09 07:29, Bruno Haible wrote:

> And on Alpine Linux, while /var/run/utmp is empty, its time stamp is
> essentially the boot time.
>
> The approach used by Emacs, namely to look at the time stamp of
> /var/run/random-seed, is therefore essentially one of the best approaches.
> It just needs to also look at /var/lib/systemd/random-seed and - on Alpine
> Linux - /var/run/utmp .

Thanks for looking into this. Clearly Emacs had some catching up to do,
since it was using a location for the random-seed file that current
GNU/Linux distros no longer use. To try to fix this I installed the
attached patch to Emacs master on Savannah.

This patch does not address the problem for Alpine, nor I suspect for
Android. I suppose Alpine could use the timestamp of /var/run/utmp (or
is that /run/utmp?) but I don't know how 'configure' would reliably
detect it's being built or cross-built for Alpine. I'll cc this to
Natanael Copa, who does the Alpine ports for Emacs, to see whether he
can give advice.

Also, I don't know how Android records boot time so I'll cc this to Po
Lu, the main developer for Emacs on Android.


--
Natanael Copa

reply via email to

[Prev in Thread] Current Thread [Next in Thread]