systemd-shutdown cannot detach DM

Bug #1905166 reported by Ingo Kueper
74
This bug affects 13 people
Affects Status Importance Assigned to Milestone
finalrd (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

when powering down the system systemd cannot unmount /

systemd-shutdown[1]: Could not detach DM /dev/dm-0: Device or resource busy
systemd-shutdown[1]: Failed to finalize DM devices, ignoring
reboot: Power down

as a result at each startup the filesystem is checked:

Press Ctrl+C to cancel all filesystem checks in progress

If systemd cannot unmount / that might not be a problem but it should be less noisy and not result in a filesystem check after each reboot.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: systemd 245.4-4ubuntu3.3
ProcVersionSignature: Ubuntu 5.4.0-54.60-generic 5.4.65
Uname: Linux 5.4.0-54-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.12
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Sun Nov 22 11:40:05 2020
MachineType: Dell Inc. Latitude 7410
ProcEnviron:
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-5.4.0-54-generic root=/dev/mapper/vgubuntu-root ro quiet splash vt.handoff=7
SourcePackage: systemd
SystemdDelta:
 [EXTENDED] /usr/lib/systemd/system/rc-local.service → /usr/lib/systemd/system/rc-local.service.d/debian.conf
 [EXTENDED] /usr/lib/systemd/system/user@.service → /usr/lib/systemd/system/user@.service.d/timeout.conf

 2 overridden configuration files found.
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 10/11/2020
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 1.4.1
dmi.board.name: 0M5G57
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 31
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr1.4.1:bd10/11/2020:svnDellInc.:pnLatitude7410:pvr:rvnDellInc.:rn0M5G57:rvrA00:cvnDellInc.:ct31:cvr:
dmi.product.family: Latitude
dmi.product.name: Latitude 7410
dmi.product.sku: 09CD
dmi.sys.vendor: Dell Inc.

Revision history for this message
Ingo Kueper (pentair-ingo-kueper) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Revision history for this message
Dan Streetman (ddstreet) wrote :

please reboot with this kernel boot parameter added:

systemd.log_level=debug

Then let the system boot up, and then perform a shutdown, to reproduce the problem. Then start the system back up (you can remove the kernel boot parameter) and capture the previous boot's journal, which should include the problem reproduction while debug is enabled; you can use the command:

$ journalctl -k -b -1 > /tmp/lp1905166.log

which will capture the log output from the previous boot.

Changed in systemd (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
j (moriati) wrote :

Have the same problem, here is the log:

Revision history for this message
Dan Streetman (ddstreet) wrote :

> Have the same problem, here is the log:

that log doesn't show the reported problematic log messages

Revision history for this message
smartman (margus-pala) wrote :

Same issue here.
5.8.0-36-generic #40~20.04.1-Ubuntu SMP Wed Jan 6 10:15:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

I had issue with glxgears and some other apps that failed to start. When restarting then the computer(Lenovo P73) hanged. I think the same hanging behaviour has happened before.

Not sure if this OpenGL issue is somehow related.
pi-imager.desktop[624532]: Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile)

Revision history for this message
j (moriati) wrote :

The message:
systemd-shutdown[1]: Could not detach DM /dev/dm-0: Device or resource busy
systemd-shutdown[1]: Failed to finalize DM devices, ignoring

is not in the logs, idk why, here are some more logs, the image shows the message and the time before. I attached also a longer log file and kern log, if it helps..?

Revision history for this message
j (moriati) wrote :
Revision history for this message
j (moriati) wrote :
Revision history for this message
j (moriati) wrote :
Revision history for this message
j (moriati) wrote :
Revision history for this message
Dan Streetman (ddstreet) wrote :

for those affected, does this happen every boot/shutdown?

is this a 'standard' installation, using the standard iso?

what do you have mounted? what's the output of 'mount' and the output of 'lsblk'?

Revision history for this message
Jo Liss (joliss42) wrote :

> for those affected, does this happen every boot/shutdown?

Yes, I'm getting the following messages on Hirsute at the end of every shut down (or reboot):

[ OK ] Reached target Reboot.
[ timestamp] XFS: attr2 mount option is deprecated.
[ timestamp] sd-umoun[2337]: Failed to unmount /oldroot: Device or resource busy
[ timestamp] sd-umoun[2337]: Failed to unmount /oldroot/sys: Device or resource busy
[ timestamp] shutdown[1]: Could not detach DM /dev/dm-1: Device or resource busy
[ timestamp] shutdown[1]: Could not detach DM /dev/dm-0: Device or resource busy
[ timestamp] shutdown[1]: Failed to finalize file systems, DM devices, ignoring.

> is this a 'standard' installation, using the standard iso?

Yes, this was installed using a nightly hirsute-live-server-amd64.iso, with disk encryption enabled during installation.

> what do you have mounted? what's the output of 'mount' and the output of 'lsblk'?

# mount
...
/dev/mapper/ubuntu--vg-ubuntu--lv on / type xfs (rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
/dev/nvme0n1p2 on /boot type ext4 (rw,relatime)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
...

Full mount output at https://gist.githubusercontent.com/joliss/c13e728ee039a2440e98f7ba6dd7ecd8/raw/25678bdaa17707a41b81b61c0fc648e01968ca90/mount

# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 99.2M 1 loop /snap/core/10908
loop1 7:1 0 25.9M 1 loop /snap/heroku/4037
loop2 7:2 0 72M 1 loop /snap/lxd/19766
loop3 7:3 0 55.5M 1 loop /snap/core18/1988
loop4 7:4 0 32.3M 1 loop /snap/snapd/11107
loop5 7:5 0 32.3M 1 loop /snap/snapd/11402
loop6 7:6 0 68.7M 1 loop /snap/lxd/19823
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 1G 0 part /boot
└─nvme0n1p3 259:3 0 1.8T 0 part
  └─dm_crypt-0 253:0 0 1.8T 0 crypt
    └─ubuntu--vg-ubuntu--lv 253:1 0 1.8T 0 lvm /

Revision history for this message
Dan Streetman (ddstreet) wrote :

> [ timestamp] sd-umoun[2337]: Failed to unmount /oldroot: Device or resource busy
> [ timestamp] sd-umoun[2337]: Failed to unmount /oldroot/sys: Device or resource busy

um, your mount output doesn't show any mounts at those dirs...you sure you're getting those messages at shutdown? ;-)

Dan Streetman (ddstreet)
Changed in systemd (Ubuntu):
status: Incomplete → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in finalrd (Ubuntu):
status: New → Confirmed
Revision history for this message
Dan Streetman (ddstreet) wrote :

This actually appears to be bug(s) in the 'finalrd', not systemd; probably bug 1920107 is a dup of this one

affects: systemd (Ubuntu) → finalrd (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in finalrd (Ubuntu):
status: New → Confirmed
Revision history for this message
Rafael (rvallel) wrote :

I am having this issue too. With failing to finalize file systems.

I can see these messages that I think could be releated:

May 02 07:25:59 server lvm[556]: 1 logical volume(s) in volume group "vg" unmonitored
May 02 07:25:59 server systemd[1]: lvm2-monitor.service: Succeeded.

Perhaps my volume group is "unmonitored" means that it will not be included in the shutdown process?

Revision history for this message
Boulardii (saccharomycesboulardii) wrote (last edit ):

I did have the same issue with lvm2:

systemd-shutdown[1]: Could not detach DM /dm/dm-2: Device or resource busy
systemd-shutdown[1]: Could not detach DM /dm/dm-1: Device or resource busy
systemd-shutdown[1]: Could not detach DM /dm/dm-0: Device or resource busy
systemd-shutdown[1]: Failed ot finalize DM devices, ignoring.

Solved it by installing dracut-core (sudo apt install dracut-core) which provides the dracut-shutdown service for systemd: https://manpages.debian.org/stretch/dracut-core/dracut-shutdown.service.8.en.html

Revision history for this message
ventsy velev (ventsyv) wrote :

Same issue:

Linux kythera-Precision-5570 6.2.0-31-generic #31~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Aug 16 13:45:26 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.