You are not logged in.

#1 2021-11-02 18:22:24

cloverskull
Member
Registered: 2018-09-30
Posts: 81

systemd failing to unmount/detach DM devices at reboot or poweroff

Hey friends,

Sorry if this is in the wrong section, mods, if so, please help me move it appropriately smile

The issue I'm having is with rebooting or powering off. It appears systemd is failing to unmount some devices and detaching DMs. Here's the error I get at poweroff or reboot (which flashes across the screen briefly):

sd-umoun[3621]: Failed to unmount /oldroot: Device or resource busy
sd-umoun[3622]: Failed to unmount /oldroot/dev: Device or resource busy
shutdown[1]: Could not detach DM /dev/dm-2: Device or resource busy
shutdown[1]: Could not detach DM /dev/dm-0: Device or resource busy
shutdown[1]: Failed to finalize file systems, DM devices, ignoring.

My setup is fairly straightforward as this is a fresh/new install and I haven't done much customization yet aside from installing some basic packages. My hardware is a Lenovo Carbon X1 Gen 8 which has a Skylake processor, Intel graphics (i915), 16gb RAM, and an NVME SSD.

I have two partitions on the NVME SSD: /dev/nvme0n1p1 is /boot (mounted as EFI boot partition) and /dev/nvme0n1p2 is a LUKS encrypted volume. Within the LUKS encrypted volume is LVM, with two logical volumes: one swap partition and one root partition.

To summarize the partitioning scheme, there is an EFI boot partition, and a root (ext4) and swap partition which both live in LVM on a LUKS encrypted partition.

I have the regular arch linux and linux-firmware packages and this repros 100% of the time using the default linux kernel. Additionally I have the zen kernel and this repros there as welll.

I use systemd-boot. My bootloader entry looks as follows (the zen kernel is identical aside from the vmlinuz-linux and initramfs):

title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options rd.luks.name=<UUID>=cryptlvm root=/dev/MyVolGroup/root resume=/dev/MyVolGroup/swap sysrq_always_enabled=1 rw quiet splash vt.global_cursor_default=0 loglevel=3 fbcon=nodefer nowatchdog

And mkinitcpio.conf (trimmed to uncommented lines only):

MODULES=(i915 vfat ext4)
BINARIES=()
FILES=()
HOOKS=(base systemd sd-plymouth autodetect keyboard modconf block sd-encrypt lvm2 fsck)
COMPRESSION="zstd"
COMPRESSION_OPTIONS=(-9)

And finally, my fstab entries (trimmed appropriately):

UUID=<UUID>	/         	ext4      	rw,noatime	0 1
UUID=<UUID>	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro,noauto,x-systemd.automount	0 2
UUID=<UUID>	none      	swap      	defaults  	0 0

One thing I should mention is that I've found mention of this here: https://bugs.archlinux.org/task/63697 - this alludes to either qemu or nvidia being the culprits (in some form or fashion), neither of which do I have installed. However, I _did_ notice that systemd-binftm.service is in a failed state, though I've not been able to figure out what the problem is. Disabling it completely, however, had zero impact on the primary issue mentioned in this thread regarding reboot/shutdown.

I...would like to figure out what's up with binfmt but am not sure whether or not that is a red herring as far as the primary issue is concerned.

Any help would be appreciated. I'm concerned that I keep failing to unmount filesystems at poweroff/reboot and that there's potential for disk corruption, especially since these NVME drives aren't cheap. Thanks.

Last edited by cloverskull (2021-11-02 18:25:06)

Offline

#2 2021-11-03 15:59:49

cloverskull
Member
Registered: 2018-09-30
Posts: 81

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

As a quick follow-up here, I tried changing my fstab entries from UUID to other partition/device naming schemes (i.e., /dev/nvme0n1p1 for /boot, /dev/mapper/MyVolGroup-root, etc) after reading that this fixed the issue for some folks. This didn’t change anything for me so I switched back to UUID.

Offline

#3 2021-11-03 17:40:20

Morta
Member
Registered: 2019-07-07
Posts: 229

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

Is there always this message or only if you have application open like firefox?

Try to reboot without opening a application on the desktop.

This message can be ignored more or less.

Last edited by Morta (2021-11-03 17:51:10)

Offline

#4 2021-11-03 17:51:55

Maniaxx
Member
From: .de
Registered: 2014-05-14
Posts: 488

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

Where did you get the error messages from (typed off manually)? I get similar messages barely visible (fraction of a second) before the system powers off. Its not logged in journalctl. I have nvidia early KMS modules loaded indeed.
Did you check your 'filesystem state' with 'tune2fs'? Mine are always 'clean' so i'm not really concerned.

Last edited by Maniaxx (2021-11-03 17:58:41)


sys2064

Offline

#5 2021-11-03 19:42:51

cloverskull
Member
Registered: 2018-09-30
Posts: 81

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

Is there always this message or only if you have application open like firefox?

This repros 100% of the time, and doesn't matter if I open any applications or not.

This message can be ignored more or less.

Are you certain about this? Any chance you can elaborate a bit, as this does concern me.

Where did you get the error messages from (typed off manually)?

Yeah, this just flashes across the screen at reboot or shutdown, I had to capture it with my phone in a video and then slow it down enough to actually read the text. It does _not_ appear in my journal anywhere.

I can check the filesystem state, but my concern is that even if things are fine today, I'm worried that over time they won't be...maybe I'm panicking for no reason but nevertheless I don't have a warm and fuzzy on whether or not this is actually even problematic at this point.

Offline

#6 2021-11-03 21:08:53

loqs
Member
Registered: 2014-03-06
Posts: 14,258

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

/oldroot is a RAM disk based filesystem containing the contents of the initrd. /oldroot/dev is a virtual filesystem.  As both of these are virtual filesystems with no device storage they can be ignored with respect shutdown.
If you perform a halt instead of shutdown that should preserve the shutdown messages as it does not poweroff the system.  See if there are any messages at the very end related to the DM devices.

Last edited by loqs (2021-11-03 21:09:28)

Offline

#7 2021-11-06 00:47:51

cloverskull
Member
Registered: 2018-09-30
Posts: 81

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

On the one hand, knowing these are virtual filesystems does give me some confidence (and SMART monitoring hasn't fired off any warning messages or anything about my hard disk). It is still a strange error IMO and I suspect a lot of people probably see it not knowing exactly what it is.

I tried using 'halt' to preserve the errors but wound up with a black screen after the error flashed across, and then my computer was completely unresponsive and even REISUB didn't work to reboot and I was stuck doing a hard shutdown. I'm not sure how else I could find any relevant error messages, perhaps I did something wrong?

Offline

#8 2021-11-06 00:59:14

loqs
Member
Registered: 2014-03-06
Posts: 14,258

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

You could try Debugging/#diagnosingshutdownproblems  see if it is captured in the generated shutdown-log.txt

Offline

#9 2021-11-22 08:04:40

dront78
Member
From: Moscow
Registered: 2010-11-24
Posts: 46

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

is this solved? I have the same problem after upgrading to recent systemd

Offline

#10 2021-11-22 10:49:14

ndhakara
Member
Registered: 2015-01-16
Posts: 5

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

I have the same issue after the last update systemd update.
Linux kahve 5.10.80-1-lts #1 SMP Thu, 18 Nov 2021 13:34:49 +0000 x86_64 GNU/Linux.
Name            : systemd
Version         : 249.7-1

Offline

#11 2021-11-22 14:54:44

cloverskull
Member
Registered: 2018-09-30
Posts: 81

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

I have not solved this, I’ve just been ignoring the error messages at shutdown. It hasn’t seemingly caused any problems, and I don’t anticipate it will, but it is pretty gross to have a glaring error message like this every time I shut my computer off.

Offline

#12 2021-11-23 12:28:40

Vizitor
Member
Registered: 2015-01-05
Posts: 62

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

Here is mine:

[xx.xxxxxx] sd-umount[xxxx]: Failed to umount /oldroot: Device or resource busy
[xx.xxxxxx] sd-umount[xxxx]: Failed to umount /oldroot/sys: Device or resource busy 
[xx.xxxxxx] shutdown[1]: Could not detach DM /dev/dm-0
[xx.xxxxxx] shutdown[1]: Failed to finalize filesystems, DM devices, ignoring.

I have two computers with very similar hardware based arround AMD Ryzen 2700x/b450 and Ryzen 3600/x470, only difference is: one has nVidia and other has ADM VGA.
'Failed' messages appears only on Comp with nVidia VGA.
(BTW this bug is plaguing Pop_os for years, and is related to nVidia proprietary drivers - as I said, Comp with AMD VGA does not have Error Messages also in Pop_OS)

On Arch, this bug was reported here
Today I applied solution from there (scroll down to the bottom, Comment by Ivan Lyapunov (dront78) - Monday, 22 November 2021, 09:19;

instead of the hacking shutdown initcpio task, try to create

/usr/lib/systemd/system-shutdown/nvidia.shutdown
#!/bin/sh
# remove nvidia modules
/usr/bin/modprobe -r nvidia_drm nvidia_modeset nvidia_uvm && /usr/bin/modprobe -r nvidia


and make it executable. helped me to resolve the issue.

And this works for me, too.

Offline

#13 2021-11-23 14:26:52

cloverskull
Member
Registered: 2018-09-30
Posts: 81

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

Interesting. I don’t have an NVIDIA GPU, I have intel. Is it possible that removing the modules actually just suppress the message from displaying because you’re removing your kernel’s ability to print the errors to tty?

Offline

#14 2021-11-23 14:48:08

Vizitor
Member
Registered: 2015-01-05
Posts: 62

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

Ooops, I didn't noticed You have an Intel graphic.

Offline

#15 2021-11-23 14:51:59

diana
Member
Registered: 2021-11-23
Posts: 9

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

have you tried using the "shutdown" hook?

Offline

#16 2021-11-24 02:51:45

cloverskull
Member
Registered: 2018-09-30
Posts: 81

Re: systemd failing to unmount/detach DM devices at reboot or poweroff

Yeah, shutdown hook didn’t help in my case

Offline

Board footer

Powered by FluxBB