Page 1 of 1

How can I retrieve messages that splash on the screen, just before shutdown?  [Solved]

Posted: Sun Jul 03, 2022 7:44 am
by SO2001
A few times, when I did a shutdown (or restart), I happened to see a number of text lines, right before the computer shut down completely. About 3 times there were about 10-15 of such text lines. It flashes by too fast to be able to read them. Is there a program that let's me look back what these messages were?


Operating System: Debian GNU/Linux 11
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.0-15-amd64
OS Type: 64-bit

Re: How can I retrieve messages that splash on the screen, just before restarting?

Posted: Sun Jul 03, 2022 9:05 am
by Earl57
Try var/log/boot.log. I had to open it as root.

Re: How can I retrieve messages that splash on the screen, just before restarting?

Posted: Mon Jul 04, 2022 4:54 am
by SO2001
Newbie question: how do I open var/log/boot.log as root?

In the right click context menu I can change "ownership to root" or "ownership to active user". Should I select one of those 2 options? I dont dare mess with these on my own, afraid I will bork the system....

Re: How can I retrieve messages that splash on the screen, just before restarting?

Posted: Mon Jul 04, 2022 5:11 am
by Eadwine Rose
I just click edit as root. And then don't edit it ;)

Re: How can I retrieve messages that splash on the screen, just before restarting?

Posted: Mon Jul 04, 2022 5:56 am
by Huckleberry Finn

Code: Select all

sudo cat /var/log/boot.log
However, probably that won't display exactly what you want.

So, here's it: https://forum.mxlinux.org/viewtopic.php ... 20#p684220

Re: How can I retrieve messages that splash on the screen, just before restarting?

Posted: Mon Jul 04, 2022 8:15 am
by markol
You can install KDE's KSystemLog via Synaptic/Discover/.. or terminal:

Code: Select all

sudo apt install ksystemlog

Re: How can I retrieve messages that splash on the screen, just before shutdown?

Posted: Thu Jul 07, 2022 12:27 am
by SO2001
I rightclicked the boot.log file in var/log/boot.log and selected "ownership to active user". Afterwards I changed it back to "ownership to root". The bootlog file gave information about one startup yesterday. No other startups info. And it only seemed to be info about starting the OS up, not shutting it down.

I have installed Ksystemlog now. I have changed the settings to save the logs for multiple boots, because what I am eager to find out is what the messages are right before shutdown (or restart), not the ones during startup. Right before the screen goes completely black before shutdown, sometimes there are a lot of textlines.

Now I am waiting for these textlines to appear again and now they (ofcourse) dont :).

Ksytemlog has lots of information and I guess that I have to select the systemlog, because that seems to have the most relevant info. In the systemlog tab I then select the date tab, so I can scroll down to the time my computer shut down.
But again, now I have to wait for these messages to appear again... :)

Re: How can I retrieve messages that splash on the screen, just before shutdown?

Posted: Thu Jul 07, 2022 12:22 pm
by SO2001
Yes, I had one of those moments again, that right before shutdown, some 15-20 textlines very briefly appeared. I searched for the time my computer shutdown in the system log of the program Ksystemlog, but I couldnt find/recognize the messages. Because Ksystemlog keeps putting in new entries in the system log all the time, while I was reading, I couldnt keep the page frozen at one point, for me to read all the many entries well.

No biggie, it's nice to have Ksystemlog installed anyway, especially if there are severe errors, then Ksystemlog is the place to look, as far as I know. And there arent any severe errors. That's positive!

Re: How can I retrieve messages that splash on the screen, just before shutdown?

Posted: Fri Jul 08, 2022 4:54 am
by markol
SO2001 wrote: Thu Jul 07, 2022 12:22 pm I searched for the time my computer shutdown in the system log of the program Ksystemlog, but I couldnt find/recognize the messages. Because Ksystemlog keeps putting in new entries in the system log all the time, while I was reading, I couldnt keep the page frozen at one point, for me to read all the many entries well.
Here you go:
https://docs.kde.org/stable5/en/ksystem ... ading.html
KSystemLog provides an easy way to control the reading and the monitoring of log files. Indeed, sometimes you only need to analyze some existing log lines. In this case, you cannot tolerate the appearance of a new line. You can deactivate the monitoring of log files by clicking on the Stop button. This stops the opened log files from being updated while still letting them get filled by other processes. Of course, you can reactivate the monitoring by clicking on Resume, which will display the log lines added since the last pause.

Re: How can I retrieve messages that splash on the screen, just before shutdown?

Posted: Fri Jul 08, 2022 4:41 pm
by Stuart_M
I know you were asking about a way to "look back what these messages were", but I do not believe that is possible from the system logs because the file system is being dismounted as part of the shutdown (halt) procedure.

There are other ways to record this information such as taking a video or image of the screen during shutdown or using a video capture card (from another computer?) to record the video output from the motherboard, etc., but they are not really practical.

I found a way that will pause the end of the rapidly scrolling text that occurs during a shutdown or restart. While it will NOT write that information to a log file, it will pause the text so it can be read and then "Enter" is used to complete the shutdown (halt).

While this works to read the text, it will not allow scrolling or paging the text so there is no way to read any text above the top line in the screen.

PgUp/Dn does not work, Shift+PgUp/Dn no longer works (see bullet below), and the 25+ special key combinations I tried do not work. I tried the screen and tmux commands but that is useless here because any command to enter needs the Enter key to run, and that same key is what resumes the shutdown process.
  • Shift+PgUp/Dn did work a few years ago to page up/down when paused but not now because beginning with kernel 5.9 it is no longer supported (thank you Linus Torvalds) https://www.phoronix.com/scan.php?page= ... Scrollback

    I also tested MX-21 using the 4.19.202 kernel because I thought Shift+PgUp/Dn would work with kernels earlier than 5.9 but it did not.
For some reason pausing does not work with MX-19 Xfce (4.19.0-18 and 5.10.0-15 were tested). When MX-19 is shutdown, about 1.5 pages of text will quickly scroll by ending with only one line on the screen: "Shutting down system...". That will remain for about 3 seconds and then the shutdown completes ending with the computer powering off. That is normal MX-19 shutdown behavior.

However when pausing the text, "Shutting down system..." will remain on the screen indefinitely and the keyboard, while recognized, will have no effect on the system regardless of any key or key combination used (the "Press Enter to continue" prompt never appears). The only thing to do at this point is to remove power from the computer or reset or hold the power switch in for several seconds so the motherboard will take control.

The pause function DOES work on MX-21 Xfce 5.10.0-15 (I also tested with 4.19.202-antix.1-amd64-smp) but both will only pause on the last full screen of text. Any text above that is not accessible, at least not that I am aware of.

I took a video of the monitor showing the shutdown text scrolling by. I was using the pause feature and pieced together two images from that video so all the lines of text appear in this one image. The text has stopped scrolling and is waiting for the Enter key to finish the shutdown (Ctrl+D or typing in "exit" will also work) as can be seen on the bottom line. The red rectangle at the top shows the text that cannot be seen when the "Press Enter to continue" line is displayed at the bottom. A 1920x1080 screen is being used so with that screen resolution and my system there are only five lines that cannot be read.
shutdown_text_last_window.jpg


Since you said that you were new (Post #3) I will try to make the procedure as easy as possible by using the Terminal so only commands are needed to configure the files.

In testing I used MX-21 Xfce with the Thunar file manager so I don't know if KDE will produce the same results.

1. In /etc/init.d/, create a new document called "pause_hook". There are several ways to do this but the easiest will be to simply run the below command. When this command is pasted into the terminal a warning will appear "Unsafe Paste" because the command contains line feeds. If you trust the code (I do) then click on "Paste". If not then use the text in the next code window to manually add it to the "pause_hook" file.

Code: Select all

sudo tee /etc/init.d/pause_hook <<!
#! /bin/sh
### BEGIN INIT INFO
# Provides:          pause_hook
# Required-Start:
# Required-Stop:     halt reboot
# Default-Start:
# Default-Stop:      0 6
# X-Stop-After:      umountroot
# X-Interactive:     true
# Short-Description: Pause before halt or reboot
# Description:
### END INIT INFO

do_stop () {
    [ -r /etc/pause_hook.conf ] && . /etc/pause_hook.conf

    [ "\$PAUSE_HOOK_ENABLED" = true ] && read -p "Press Enter to continue" reply
}

case "\$1" in
    start)
        # No-op
        ;;
    restart|reload|force-reload)
        echo "Error: argument '\$1' not supported" >&2
        exit 3
        ;;
    stop)
        do_stop
        ;;
    *)
        echo "Usage: \$0 start|stop" >&2
        exit 3
        ;;
esac
!


If you want to manually put the text into the "pause_hook" file then use this text:

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides:          pause_hook
# Required-Start:
# Required-Stop:     halt reboot
# Default-Start:
# Default-Stop:      0 6
# X-Stop-After:      umountroot
# X-Interactive:     true
# Short-Description: Pause before halt or reboot
# Description:
### END INIT INFO

do_stop () {
    [ -r /etc/pause_hook.conf ] && . /etc/pause_hook.conf

    [ "$PAUSE_HOOK_ENABLED" = true ] && read -p "Press Enter to continue" reply
}

case "$1" in
    start)
        # No-op
        ;;
    restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
    stop)
        do_stop
        ;;
    *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac
!

2. Make the Step 1 file executable by running the below command:

Code: Select all

sudo chmod -c 755 /etc/init.d/pause_hook
If the command is successful then the output should look like this:

Code: Select all

mode of '/etc/init.d/pause_hook' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
3. Run the below command so the script will be run at shutdown or reboot. This will add "pause_hood" as a service:

Code: Select all

sudo update-rc.d pause_hook defaults
4. Now "pause_hood" needs to be enabled. Create /etc/pause_hook.conf and add "PAUSE_HOOK_ENABLED=true" (without the quotes) in the "pause_hook.conf" file. An easy way to do all of that is to run the below command (see the step 1 "Paste" warning - it's okay to click on "Paste" at this point - otherwise do it manually):

Code: Select all

sudo tee /etc/pause_hook.conf <<!
PAUSE_HOOK_ENABLED=true
!
That's it. The next time there is a shutdown or restart, the scrolling text will (should) be paused until "Enter" is used to complete the action.

To disable the pause on shutdown/restart, just go into the /etc/pause_hook.conf file and comment out the only line there, which will then look like "#PAUSE_HOOK_ENABLED=true" (without the quotes). To enable it, just un-comment it (remove the number symbol "#"). This must be done as root of which there are several ways. One way, in Thunar, is to right-click that file and select "Edit as Root".

Re: How can I retrieve messages that splash on the screen, just before shutdown?

Posted: Thu Jul 14, 2022 10:28 am
by SO2001
markol wrote: Fri Jul 08, 2022 4:54 am
KSystemLog provides an easy way to control the reading and the monitoring of log files. Indeed, sometimes you only need to analyze some existing log lines. In this case, you cannot tolerate the appearance of a new line. You can deactivate the monitoring of log files by clicking on the Stop button. This stops the opened log files from being updated while still letting them get filled by other processes.
Oh that's a terrific tip. Very helpful. Thanks!

Re: How can I retrieve messages that splash on the screen, just before shutdown?

Posted: Thu Jul 14, 2022 10:33 am
by SO2001
Stuart_M wrote: Fri Jul 08, 2022 4:41 pm I know you were asking about a way to "look back what these messages were", but I do not believe that is possible from the system logs because the file system is being dismounted as part of the shutdown (halt) procedure.

There are other ways to record this information such as taking a video or image of the screen during shutdown or using a video capture card (from another computer?) to record the video output from the motherboard, etc., but they are not really practical.

I found a way that will pause the end of the rapidly scrolling text that occurs during a shutdown or restart. While it will NOT write that information to a log file, it will pause the text so it can be read and then "Enter" is used to complete the shutdown (halt).
Thanks alot for that extensive help guide. I dont know if I will succeed in making this all work, because I have zero experience with the terminal. But many thanks for posting this helpful guide. Cheers!

Re: How can I retrieve messages that splash on the screen, just before shutdown?

Posted: Thu Jul 14, 2022 11:23 am
by Stuart_M
SO2001 wrote: Thu Jul 14, 2022 10:33 am I dont know if I will succeed in making this all work, because I have zero experience with the terminal.
That's what I figured and that is why I tried to make it as simple as possible. Even though it's a somewhat long post, all that is needed is to run four commands in the order given. I know it works with MX-21 Xfce but I have not tested it with MX-21 KDE (I would think it should work).

In the hopes of making it easier to follow I consolidated my Post #10 here. The only thing that needs to be done is to run the below four commands in a Terminal in the order given. For each command there are basically only two steps needed to get it into the Terminal:
  • Highlight everything inside the code window by clicking on "SELECT ALL" and then right-click over the highlighted text and select "Copy" (another way is to press Ctrl+C after the text is highlighted to copy).
  • Now Paste what was just copied into a Terminal. This is done by right-clicking on the Terminal and select "Paste" (another way to paste in a Terminal is by using Ctrl+Shift+V [press the Control + Shift + V keys together).
  • When pasting the commands from the 1st and 4th code window below into the Terminal, you will be prompted to accept pasting. This is because those two commands contains line-feeds (similar to what the "Enter" key does) and is a security concern with unknown commands. The commands are safe to use so accept the prompt by clicking the "Paste" button in the warning window.

    All four commands will require you to enter your User password after the command is run. This is because those commands use "sudo" for elevated privileges (files are being modified in the root directory). Just follow the prompts in the Terminal.
These are the four commands to copy and paste, in this order, and that's it:

Code: Select all

sudo tee /etc/init.d/pause_hook <<!
#! /bin/sh
### BEGIN INIT INFO
# Provides:          pause_hook
# Required-Start:
# Required-Stop:     halt reboot
# Default-Start:
# Default-Stop:      0 6
# X-Stop-After:      umountroot
# X-Interactive:     true
# Short-Description: Pause before halt or reboot
# Description:
### END INIT INFO

do_stop () {
    [ -r /etc/pause_hook.conf ] && . /etc/pause_hook.conf

    [ "\$PAUSE_HOOK_ENABLED" = true ] && read -p "Press Enter to continue" reply
}

case "\$1" in
    start)
        # No-op
        ;;
    restart|reload|force-reload)
        echo "Error: argument '\$1' not supported" >&2
        exit 3
        ;;
    stop)
        do_stop
        ;;
    *)
        echo "Usage: \$0 start|stop" >&2
        exit 3
        ;;
esac
!

Code: Select all

sudo chmod -c 755 /etc/init.d/pause_hook

Code: Select all

sudo update-rc.d pause_hook defaults

Code: Select all

sudo tee /etc/pause_hook.conf <<!
PAUSE_HOOK_ENABLED=true
!


If you later decide you don't want the pause during shutdown/restart then just comment out the only line that appears in /etc/pause_hook.conf (see the last paragraph of Post #10). If you need help/clarification please ask.