Restarting freezes due to snap

I have Ubuntu 22.04 Dell laptop.

It freezes on restarts before I get to the disk encryption password.
Looking at the restart log, I get:

Could not detach /dev/dm-0. Device or resource busy

Looking at the system log, I found that this is due to snap:

Sep 01 09:28:38 machine-Precision-5570 systemd-udevd[857]: dm-0: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/dm-0' failed with exit code 1.

I tried googling but I can’t find anything that’s relevant.

Asked By: ventsyv

||

This is a bug in Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1966203

The workaround is to delete /lib/udev/rules.d/66-snapd-autoimport.rules This resolves the snapd error in journal, but I’m still not getting a clean shutdown.

It appears the issue might be another bug:
https://bugs.launchpad.net/ubuntu/+source/finalrd/+bug/1905166

EDIT:

I was able to resolve this issue by going back to an older kernel. I was running 6.2.0-32-generic. When I switched to 5.19-50-generic, the issue went away.

I made it permanent by following this answer: https://askubuntu.com/a/1000735/433791

Basically:

sudo cp /etc/default/grub /etc/default/grub.bak
sudo vi /etc/default/grub

Add the following 2 lines to the file

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then update the boot file:

sudo update-grub

Restart, then press "esc" when at the manufacturer logo. From the boot menu, select "Advanced" then select the kernel you want. That kernel will now be loaded at boot / restart.

Answered By: ventsyv
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.