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?
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
sudo vim /etc/default/bootlogd
And add the follwing to the file:
Save and exit. Now all boot messages will be put in
/var/log/boot file, you can view them by using
less like this:
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.
Try to execute command
And you will get them. If you want to save the message redirect the output to file