different times for last boot between last and uptime -s

Tom Mitchell niftyubuntu at niftyegg.com
Mon Dec 5 18:50:29 UTC 2022


On Mon, Dec 5, 2022 at 1:36 AM Lentes, Bernd
<bernd.lentes at helmholtz-muenchen.de> wrote:
>
> Hi guys,
>
> i just realized a strange behaviour. I had to find out the last boot procedure
> for an Ubuntu 20.04.3 LTS.
> uptime -s says:
> root at crispor-server:/var/log/atop# uptime -s
> 2022-12-02 21:37:18
>
> last says:
> reboot   system boot  5.4.0-91-generic Fri Dec  2 22:37   still running
>
> The current date and time is correct, timezone is Berlin/Europe.

Two details come to mind.
*) Time zone for the system and for the user could be mismatched.
*) mismatch of hardware real time clock setup or absence of a RTC.

System boot is recorded early and then time management tools like NTP start.
$ timedatectl show --all
$ echo $TZ

This is worth exploring.
$ sh
$ TZ="GMT"
$ date
Mon 05 Dec 2022 10:47:34 AM PST
$ date -u
Mon 05 Dec 2022 06:47:38 PM UTC
$ export TZ
$ date
Mon 05 Dec 2022 06:48:13 PM GMT
$ date -u
Mon 05 Dec 2022 06:48:17 PM UTC



More information about the ubuntu-users mailing list