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
  • Same here too. lvm over luks over software-raid – StefanHeimberg Apr 29 '17 at 14:04
  • Ubuntu 16.04.2 LTS – StefanHeimberg Apr 29 '17 at 14:12
  • This is effecting my main work computer. Ubuntu 17.04, Carbon X1 3rd gen. – Rick Jun 28 '17 at 13:39
  • Try to run apt-get -f install before your shutdown ... one message tells me that your package status might need to be repaired. – jmary Jun 30 '17 at 21:49
  • It looks like you are timing out because your devices are still being used, and each one relies on the previous layer not being used in order to unmount / close properly... – ben-Nabiy Derush Jul 3 '17 at 3:03

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.

| improve this answer | |
  • I'd love to see a more complete answer for this. – Elder Geek Jul 3 '17 at 23:34
  • @ElderGeek I would love to provide one, but without more information, it is hard (because people have too much of a tendency to just copy and paste, which ends up not matching their system). It is possible that the OP is being affected by both issues, independent of each other. Granted, the system should time out the unmounting of the drives, and still be able to shut down (just not cleanly) I doubt it is the drives which are actually hanging the OP's system. – ben-Nabiy Derush Jul 4 '17 at 15:45
  • This could entirely be rectified by indicating the proper order to shut down the layers. That minor change IMHO would make this a good answer and provide enough information for the OP to take further action. I don't think a copy and paste answer is necessary, It's better to teach a man to fish than to give him one. – Elder Geek Jul 5 '17 at 12:46

In my case, the reason was a WebDAV connection. Had to first umount the WebDAV mount point before allowing system shutdown processes.

Clearing the cache with slower WebDAV connections might take some time. So, the system might already have shut down the disk, but the process of umounting the WebDAV is not yet ready. When it then finally gets ready, it runs into the problem that the disk isn't available any more to flush / close or whatever it still would like to do.

Solution in my case therefore was, to integrate a shutdown script which guarantees all WebDAV connections to be unmounted, before system shutdown processes start.

Although I don't think this is a general solution for the problem, this info might still help in some cases.

Best regards, MikeKMB

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.