3

Whenever I shutdown my Debian system, stop jobs are running for 1m30. I don't know what causes this and would like to investigate.

I've look for various questions about shutdown logs however neither syslog or messages displays relevant info on that (logs seems to stop at the exact same time I press shutdown). Kern.log only have the boot logs.

The install is pretty fresh and do not always do that. It is installed on a SSD and boot really fast.

How can I log everything done on shutdown ?

EDIT :

So I made journalctl storage to persistent and I can know read shutdown logs. However I can't read the stop jobs logs. Indeed I have a 1min30 blackhole in the logs :

janv. 02 14:47:56 Orion systemd-logind[611]: Removed session 3.
janv. 02 14:47:56 Orion systemd[1]: Unmounted /run/user/1000.
janv. 02 14:49:25 Orion systemd[738]: at-spi-dbus-bus.service: State 'stop-sigterm' timed out. Killing.
janv. 02 14:49:25 Orion systemd[1]: dev-disk-by\x2did-dm\x2dname\x2dsdb7_crypt.device: Job dev-disk-by\x2did-dm\x2dname\x2dsdb7_crypt.device/stop timed out.
Lich4r
  • 161
  • Have to tried un archiving the previous log files? – Raman Sailopal Jan 02 '18 at 11:12
  • The current log file is old enough. I can't see many boots. Only shutdown boots are not logged – Lich4r Jan 02 '18 at 11:14
  • One simple way is to modify Grub to not display the splash screen, so you can see whatis going on on reboot (i.e., when/where the process hangs). Modify ' /etc/default/grubto readGRUB_CMDLINE_LINUX_DEFAULT="nosplash". Assyslogservice is stopped very early in shutdown procedure (needs e.g. filesystems mounted and probably network), it does not log entries stopped later. Maybe modifying/etc/init.d/rsyslog` (depending on your system, may vary) could help, but that might confuse your system. – ridgy Jan 02 '18 at 12:02
  • By setting this in grub I could read what's going on on screen but it won't be print out in a file ? Because I can actually see what the jobs are. There is one line printed, changing for each job. They are all linked to /dev – Lich4r Jan 02 '18 at 13:20
  • Does journalctl show anything useful? – Stephen Kitt Jan 02 '18 at 13:22
  • I've set up journalctld.conf with persistent storage but it still reset on boot. I've tried journalctl --since "2018-01-02 12:00:00 > export.txt but nothing before the boot. – Lich4r Jan 02 '18 at 13:39

1 Answers1

4

Things done at shutdown are already logged.

They are logged to the journal.

The problem is that Debian out of the box uses the journal in what amounts to a pass-through mode that saves no journal files to disc (only to memory) and that passes journal contents through rsyslog. This means that the log files on disc in a Debian system just stop when the rsyslog service is shut down, even though there is stuff still to be logged.

So alter this out of the box default. Adjust the journal to be persistently stored to disc by altering /etc/systemd/journald.conf or by explicitly making the /var/log/journal directory, and then telling journald about this. Then after you have rebooted, look in the journal. You will have to make your unprivileged user account part of the group that has access to the journal.

Further reading

JdeBP
  • 68,745
  • I've change '#storage=auto' to 'storage=persistent' in journald.conf but I still can only see one boot. – Lich4r Jan 02 '18 at 13:43
  • Ok after ANOTHER reboot this works. I can read logs of shutdown. Weird it didn't work first time. ALthough this not solve my problem. I edit the question – Lich4r Jan 02 '18 at 13:55
  • As I said, you have to first tell journald about the new configuration. Rebooting is one way to tell it. It's best not to radically change your question like that. You asked how to get things logged. What the logs mean when you did so is another, follow-on, question. – JdeBP Jan 02 '18 at 14:13
  • I didn't change my question. Should I change the title to "How view shutdown logs on Debian ?" and then open a new one about the specific point of stop jobs logging ? Which was my actual question :) – Lich4r Jan 02 '18 at 16:45