/var/log/dmesg was a useful boot time dmesg dump. I can’t find that any more. Is it somewhere else?

(/var/log/kern.log* is limited; it catches kernel messages only after the logging daemon is running. Further is it cumbersome to find the right kern.log.X.gz file where the last boot happened. (It might have been rotated away, too.))

share|improve this question
    
Does dmesg | head -n 100 give you the boot time messages you want? If so, unbuffer dmesg | head -n 100 will do it in color. – Chai T. Rex Dec 12 '16 at 11:57
    
If /var/log/kern.log* is limited try /var/log/syslog* instead. – WinEunuuchs2Unix Dec 12 '16 at 12:04
up vote 6 down vote accepted

To show the output from the last boot, you can still use the command dmesg.

However, Ubuntu 16.04 (in fact all Ubuntus >=15.04) use systemd which has a logging daemon, journald and an interface with highly flexible access to logged data: journalctl. You can see a log of the last boot equivalent to dmesg:

journalctl -k

all dmesg output in the last 2 hours

journalctl -k --since "2 hours ago"

all of the journal since last boot

journalctl -b

list boots in the journal

journalctl --list-boots

to set up persistent logging, you need to configure journald - by default its log is written non-persistently to /run/systemd/journal (a binary file - no use trying to read it) and no data is available before the current boot. To set up persistent logging, edit the file /etc/systemd/journald.conf and uncomment the line #Storage=auto and change auto to persistent. Use your favourite text editor or

sudo sed -i.bak 's/#Storage=auto/Storage=persistent/' /etc/systemd/journald.conf

Then you must restart the service (or reboot)

sudo systemctl restart systemd-journald

Having enabled persistent logging, you will in future be able to use the full functionality of journalctl for example, to see information from the boot before the current one

journalctl -b -2

See the relevant page of the wonderful <3 Arch Wiki <3 for further tips and tricks on using journalctl

share|improve this answer
1  
As I said, dmesg might not show boot time info any more (if it is out of the kernel ring buffer already). But journalctl -k seems to be complete. – Robert Siemer Feb 9 '17 at 11:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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