1

I have several Linux distributions installed on my PC (13 at last count) and I would like to know how I can find when I last booted each of them. Preferably as a list, like on one line when I last booted my Debian installation, one another line when I last booted my Gentoo install, on another line when I last booted my PCLinuxOS install, etc. I suppose I can check when the last edit to their files was made (as a way of testing when they were last started) but as I chroot into them regularly to update them (using their package manager) I thought this may not be an accurate way of checking.

6
  • 1
    last /the/chroot/var/log/wtmp perhaps? there may be a reboot line in there – thrig Jan 5 '18 at 3:10
  • Gives me a ridiculous time for my Arch and Gentoo system. I booted them less than an hour ago yet they're giving me the exact same output for that command wtmp begins Sun Dec 17 19:28:53 2017. – Josh Pinto Jan 5 '18 at 3:30
  • wtmp tells you about logins, not boot time. /bar/log/syslog or /var/log/kernel might be more useful. Looking at the modification time might be enough. – mc0e Jan 5 '18 at 5:54
  • Sorry mate but unfortunately neither file you mentioned exists (and yes after correcting for your bar typo) for any of my installed systems. – Josh Pinto Jan 5 '18 at 6:19
  • on installed systems you can use who -b or w to know how long & when system is marked "up & running" but this will not inform you on boot request time – francois P Jan 5 '18 at 7:29
1

It's a sure thing that each instance wrote more than one line of dmesg / syslog to /var/log/* files at boot time. Filenames like messages and syslog are pretty popular, but YMWV. Mount the relevant partition RO, and go grep'ing for "kernel:" bootup messages. As a bonus, the syslog output will reveal the configured uname hostname of each instance. Looking for the string "Linux version" would be a good starting point, as it tends to appear early in the boot sequence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.