I'm using Lubuntu 11.10. Every time I shut down I can read FAIL in red letters, but I can not read more.
So, how to read the log messages and try to solve the problem?
initlogsopenrcshutdown
I'm using Lubuntu 11.10. Every time I shut down I can read FAIL in red letters, but I can not read more.
So, how to read the log messages and try to solve the problem?
Best Answer
There seems to be no way to log this data to a file. For the boot process, there is the
bootlogd
package which creates the file/var/log/boot
, but nothing for the shutdown/reboot process. As far as I can see there is no way to log withrsyslog
either, and even if there was, there are messages printed afterrsyslog
is stopped. Part of my shutdown/reboot process is to remount the rootfs readonly and umount everything else, after this logging to a file that will still be there at the next boot is virtually impossible.The easiest way I can see to view the messages is to edit the
/etc/init.d/halt
and/or/etc/init.d/reboot
scripts to pause just before the actualhalt
/reboot
. For thehalt
script, run the commandsudoedit /etc/init.d/halt
(or use a GUI editor) and look for the line that does the actual halt. For me this is the line:Otherwise it should be at the end of the
do_stop
function and the only line that calls thehalt
command. Once you find the line, just insert a new line above with the following:Save the file and exit. Now when you shutdown, the system will pause until you press enter (or CTRL-C, CTRL-D, etc). You can the read the messages printed on the screen. If there is more than a single screenful of text, you can see terminal scrollback by pressing
Shift+PgUp
. If this is still not enough, there are ways to increase the size of the scrollback buffer (perhaps a different question though).To do the same when the system reboots, you have to edit the
/etc/init.d/reboot
file. The command used here is of coursereboot
as opposed tohalt
and should again be at the end of thedo_stop
function. For me the line is:Again just insert the following on a new line above:
Note also that these files are listed as conffiles for the
initscripts
package. These edits won't be clobbered by default when the packages is upgraded, although they will cause a conflict.A more complete solution would be to use the following script:
This should be placed in
/etc/init.d/pause_hook
and can be enabled to run at shutdown/reboot with the following command:To then enable the actual hook, create the files
/etc/pause_hook.conf
containing the line:The shutdown/reboot process should now pause just before the
halt
orreboot
script is called, giving time to view the messages. It can also be easily disabled/re-enabled by commenting/uncommmenting the enable line in/etc/pause_hook.conf
. There will also be nodpkg
conffile conflicts during upgrades this way.