Systemd shutdown order unmounts filesystem used by qemu/kvm guest before shutting down the guest
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libvirt (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Last night I started a reboot without manually shutting down a qemu/kvm guest first. After X went down a bunch of I/O errors associated with a network block device that contains a NTFS filesystem showed up on the console. I noticed that the umount.target had been reached but the virt-guest-
Wouldn't it be beneficial for all guests to be shutdown before unmounting all filesystems?
ProblemType: Bug
DistroRelease: Ubuntu 20.10
Package: systemd 246.6-1ubuntu1.3
ProcVersionSign
Uname: Linux 5.8.0-49-generic x86_64
ApportVersion: 2.20.11-0ubuntu50.5
Architecture: amd64
CasperMD5CheckR
Date: Thu Apr 15 08:35:48 2021
InstallationDate: Installed on 2021-01-17 (88 days ago)
InstallationMedia: Ubuntu 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
MachineType: HP HP ZBook 15u G6
ProcKernelCmdLine: BOOT_IMAGE=
SourcePackage: systemd
UpgradeStatus: Upgraded to groovy on 2021-04-08 (6 days ago)
dmi.bios.date: 01/08/2021
dmi.bios.release: 8.1
dmi.bios.vendor: HP
dmi.bios.version: R70 Ver. 01.08.01
dmi.board.name: 8549
dmi.board.vendor: HP
dmi.board.version: KBC Version 52.67.00
dmi.chassis.type: 10
dmi.chassis.vendor: HP
dmi.ec.
dmi.modalias: dmi:bvnHP:
dmi.product.family: 103C_5336AN HP ZBook
dmi.product.name: HP ZBook 15u G6
dmi.product.sku: 9AP56LP#ABA
dmi.sys.vendor: HP
affects: | systemd (Ubuntu) → libvirt (Ubuntu) |
Hi Pedro,
> Wouldn't it be beneficial for all guests to be shutdown before unmounting all filesystems?
Yes on first sight that looks like a compelling suggestion.
But i've learned the hard way that usually adding dependencies eventually breaks more things than it fixes - so let us first try to understand what to expect and what happened.
The ordering at the moment includes: guests. service shutdown. target
- libvirt-
- virt-guest-
- libvirtd.service
Of these the "big one" is libvirtd.service which has network. target local-fs. target remote- fs.target
After=
After=
After=
And many more which imply further lateness on startup.
libvirt- guests. service is what shuts down the guests and starts as libvirtd. service
After=
and thereby after all of the above.
virt-guest- shutdown. target exists to allow people to hook arbitrary things into this chain in case any thing needs to be done. /bugzilla. redhat. com/show_ bug.cgi? id=1401054 for this.
Note: In most cases it is better t identify what a local system has that makes it special and set it up to go down before this. See the discussion and references from https:/
On shutdown usually the order of these is reversed - I'd expect that libvirt- guests. service needs to stop before libvirtd.service stops (which also is reasonable as it needs to interact with libvirt).
And libvirt.service should need to be passed to leave the local/remote-FS targets on the way out, but targets might be more special in this regard.
Therefore the question becomes - which FS or FS-target was stopped/cut in your case before libvirt.service was stopped.
Could you maybe share the journal of that boot so that we can try to dissect what was going down beofore it?
You can access those with
$ journalctl --list-boots
And then select the right one and redirect it into a file like
$ journalctl -b <number> > logfile