Ubuntu – How to diagnose Hang on Shutdown

freezelogshutdownsysrq

Since one or two months ago, my laptop with ubuntu 12.10×64 hangs during shutdown. There's just a black screen, no harddisk activity, it justs sits there. I feel it happens near the end of a normal shutdown cycle, judging from time elapsed.

Only resolution is hard power-off (holding power key for several seconds) – neither Ctrl-Alt-Backspace (which normally works, I have it switched on in Settings) nor Ctrl-Alt-Del help, nor can I get into a text console with Ctrl-Alt-F1.

How do I diagnose that? It does not happen on every shutdown, but often enough to be annoying (as it forces a diskcheck on reboot, of course).

Which log files can tell me what's going wrong? More or less blindly searching in the sys log viewer reminds me of needles in a haystack.

I imagine I could pinpoint the time it happens via log timestamps, but how do I read timestamps like e.g. in kern.log: [36169.146130]? How do I get this human-readable?

Lastly, a bit of a btw, I've never managed to execute an Alt-Sysrq-REISUB to force a cleaner shutdown, but that's probably because I'm on a laptop, PrintScr is only accessible via an Fn key, and I'm not sure of the exact key sequence I need. Is there a "harmless" but user-visible magic command I could practice this with (during normal operation), so I can find out how to do a REISUB next time?

Thanks all! Comment if you need additional data…

Best Answer

You need to shutdown without the splash screen, and from the command line to see what's going on. First you need to disable splash via GRUB (See verbose shutdown)

Boot and hold SHIFT to enter grub. Press while over the linux entry to edit it. Then go to the kernel line (press END to go to the end of the line) and remove the "quiet" and "splash" arguments. In fact, for this one test skip out the GUI al together and add the argument "text". (Without this you can get to the command line with CTRL+ALT+F1)

Login, then type:

sudo shutdown -v -h now

(-v for verbose, -h for halt.)

Kernel log files in /var/log/kern.log should contain human readable time stamps. Open them with the log file viewer

gnome-system-log

(File>open) And you should see the human readable time stamp on the left. If you still don't see the human readable ones, this guy made some python/perl scripts to parse them.