Ubuntu – Time out issues during shutdown

shutdown

I am doing a shutdown of Ubuntu and keep hitting an error where it times out. The only way to completely shut it down is to power off the VM. The errors I am getting are.

[Time] Timed out stopping /sys/devices/virtual/block/dm-0
[Time] Timed out stopping /dev/disk/by-id/dm=name=sda5_crypt
[Time] Timed out stopping /dev/dm-0.
[Time] Timed out stopping /dev/disk/by-d/dm-uuid-C...
[Time] Timed out stopping /dev/disk/by-id/lvm-pv-uuid-3F....
[Failed] Failed to start unattended Upgrades Shutdown

Best Answer

It appears that your devices are timing out because the top layer is not able to unmount because it is still in use, which causes the layers underneath to never be able to close out properly.

You may need to write a helper script which runs at shutdown which unmounts things and closes the cryptsetup in the proper order.

As a more complete answer about the order:

General Rule: If you had to mount it in a certain order, unmount it in reverse order.

More Specifically: In your case, from the output you gave, the order to unmount would be your partition(s) which are mounted as part of you encrypted directory (sda5_crypt) including possible encrypted swap with a sudo swapoff /path/to/swap; sudo umount /path/to/swap and once everything is unmounted from the encrypted drive, then close the crypt device with sudo cryptdisk_stop sda5_crypt . If this gives you an error, then you missed unmounting something.

Now if your LVM happens to be one of those, you will need to do vgchange -a n /dev/vgname before closing your crypt device, which will allow for the lvm pv to be cleanly stopped.

Hope this helps...

Edit: At another glance, you might also want to try this link: Unattended upgrades failing as I think you might be hitting a bug in the unattended Upgrades service.

Related Question