Saving linux boot messages in a file
Solution 1
Install the bootlogd
package. Bootlogd is a daemon that will record all boot messages to /var/log/boot
. Install the package with:
sudo apt-get install bootlogd
Then enable it by creating a new file called bootlogd
in /etc/default/
:
sudo vim /etc/default/bootlogd
And add the follwing to the file:
BOOTLOGD_ENABLE=yes
Save and exit. Now all boot messages will be put in /var/log/boot
file, you can view them by using less
like this:
less /var/log/boot
Solution 2
I have raspbian […]
Then you can use the old Debian /etc/init.d/bootlogs
that saves the last up to 0.5MiB of kernel messages to /var/log/dmesg
at startup. And of course, as mentioned in another answer, the old bootlogd
from the same source, which only captures kernel messages that are at or above the kernel's console minimum log priority level.
And you can use one of the several Debian kernel log daemons or system log daemons (busybox-syslogd, dsyslog, klogd, inetutils-syslogd, sysklogd, socklog-run, syslog-ng, or rsyslog), which push kernel log messages to … wherever the package that you have has been configured to push kernel log messages. But these don't all capture kernel messages.
Or you can use systemd, which takes everything that it can get its mitts on — application syslog()
calls, dæmon output, kernel log buffer — mixes it all together and pushes it to its journal, which you can read with:
journalctl -b -x.
Related videos on Youtube
Ali Hassan
Updated on September 18, 2022Comments
-
Ali Hassan over 1 year
I have raspbian running on my raspberry PI. When I switch it on, boot messages crawl on the screen. I believe it would be beneficial to read them in order to get an idea about how the system starts. Hence I would like to know whether it is possible (and how) to redirect them to a file in order to read them thoroughly afterwards. Do I have to make a script that runs at startup?
-
PersianGulf almost 9 years
dmesg
only prints kernel ring buffer. -
roaima almost 9 yearsIf it's based on Debian the messages will already be saved to
/var/log/kern.log