Featured image of post System not shutting down?

System not shutting down?

Let’s stab the system.

The Issue

During shutdown and reboot, I had an issue where the screen would hang on a terminal line like this: Shutdown issue Obviously, some processes weren’t terminating properly.

Analysis

What helped was letting the system run for a while to see if it would print something else I could catch.

Eventually, the terminal snitched on the likely suspect:

1
2
3
4
...
ailed deactivating swap /dev/disk/by->
dev-disk-by\x2ddiskseq-3\x2dpart2.swap>
...

Yeah, the swap partition was likely to blame. After rebooting, I checked in the terminal:

1
journalctl -b -1 -r

And following advice from more experienced Linux gurus, I first tried adding in:

1
2
sudo nano /etc/systemd/system.conf
DefaultTimeoutStopSec=15s

(make sure to uncomment the line)

But that didn’t help either.

Solution

Finally, an expert suggested adding the swap to fstab.

First, I found the UUID of the swap partition using:

1
sudo blkid -t TYPE=swap -o export

Then I added this to 🗂️ /etc/fstab:

1
2
Swap partition – wait max 5 s for device
UUID="FILL WITH YOUR UUID"  none  swap  defaults,x-systemd.device-timeout=5s  0  0

Since then, the issue has been gone. Just a reminder: before shutting down, close everything, as turning off swap will wipe any unsaved data stored there.

Final thoughts

I’m mainly writing this for myself in case I need to deal with it again in the future. It probably depends on how you have your swap set up, and it might not work for you (systemd vs fstab). Also, keep in mind that if you misconfigure something in fstab, you’ll need to recover it, for example using a USB stick.

Life is a choice: reboot or be root


Built with Hugo
Theme Stack designed by Jimmy