Bug#854699: Shutdown fails with an encrypted filesystem on virtio device

Yuri D'Elia wavexx at thregr.org
Thu Feb 9 15:39:50 GMT 2017


Package: systemd
Version: 232-15
Severity: normal

I've setup a VM using kvm with a virtio block device, running debian unstable
and an encrypted root filesystem (automatically setup during installation as
lvm+encrypted volume).

Somehow, systemd tries to stop the lvm/crypto block devices way too early
during shutdown, causing the root filesystem to be left unsynced.

I'm running an identical setup on the real hardware, and the shutdown sequence
is correct, so I assume there is some issue with how virtio block devices are
seen by systemd? Aside from the system using /dev/vda instead of /dev/sda, the
partition scheme and the rest of the setup is identical.

This is the visible shutdown sequence on the console:

....
[  OK  ] Stopped target System Time Synchronized.
[  OK  ] Stopped target Network is Online.
[  OK  ] Stopped target Network.
         Stopping Raise network interfaces...
[  OK  ] Started Show Plymouth Reboot Screen.
[11899.805246] systemd[1]: Stopped (with error) /dev/disk/by-id/lvm-pv-uuid-sHRNAT-RMhn-Xhi6-8maP-jAdc-OLVu-nS2bY3.
[FAILED] Stopped (with error) /dev/disk/by-i…T-RMhn-Xhi6-8maP-jAdc-OLVu-nS2bY3.
[11899.808206] systemd[1]: Stopped (with error) /dev/disk/by-id/dm-name-vda5_crypt.
[FAILED] Stopped (with error) /dev/disk/by-id/dm-name-vda5_crypt.
[11899.813510] systemd[1]: Stopped (with error) /sys/devices/virtual/block/dm-3.
[FAILED] Stopped (with error) /sys/devices/virtual/block/dm-3.
[11899.815784] systemd[1]: Stopped (with error) /dev/dm-3.
[FAILED] Stopped (with error) /dev/dm-3.
[11899.817433] systemd[1]: Stopped (with error) /dev/dm-0.
[FAILED] Stopped (with error) /dev/dm-0.
[11899.819205] systemd[1]: Stopped (with error) /sys/devices/virtual/block/dm-0.
[FAILED] Stopped (with error) /sys/devices/virtual/block/dm-0.
[11899.821010] systemd[1]: Stopped (with error) /dev/mapper/backup_crypt.
[FAILED] Stopped (with error) /dev/mapper/backup_crypt.
[11899.822558] systemd[1]: Stopped (with error) /dev/mapper/vda5_crypt.
[FAILED] Stopped (with error) /dev/mapper/vda5_crypt.
[FAILED] Stopped (with error) /dev/disk/by-i…0b4d27a1048270f285d317-vda5_crypt.
[  OK  ] Stopped LSB: Start/stop the postgrey daemon.
[  OK  ] Stopped target Basic System.
[  OK  ] Stopped target Sockets.
[  OK  ] Closed Syslog Socket.
[  OK  ] Closed UUID daemon activation socket.
[  OK  ] Closed D-Bus System Message Bus Socket.
[  OK  ] Stopped target Remote File Systems.
[  OK  ] Stopped target Slices.
[  OK  ] Removed slice User and Session Slice.
[  OK  ] Stopped target Paths.
[  OK  ] Stopped systemd-cron path monitor.
[  OK  ] Stopped ACPI Events Check.
[  OK  ] Closed ACPID Listen Socket.
[  OK  ] Stopped target System Initialization.
         Stopping Load/Save Random Seed...
         Stopping Update UTMP about System Boot/Shutdown...
[  OK  ] Stopped target Encrypted Volumes.
         Stopping Cryptography Setup for backup_crypt...
[  OK  ] Stopped Forward Password Requests to Wall Directory Watch.
         Stopping Cryptography Setup for vda5_crypt...
         Stopping Network Time Synchronization...
[  OK  ] Stopped Load/Save Random Seed.
[  OK  ] Stopped Network Time Synchronization.
[  OK  ] Stopped Update UTMP about System Boot/Shutdown.
[  OK  ] Stopped Create Volatile Files and Directories.
[  OK  ] Stopped Cryptography Setup for backup_crypt.
[  OK  ] Stopped Raise network interfaces.
[  OK  ] Stopped target Network (Pre).
         Stopping ferm firewall configuration...
[  OK  ] Stopped target Local File Systems.
         Unmounting /boot...
         Unmounting Temporary Directory...
         Unmounting /run/user/0...
[  OK  ] Stopped Apply Kernel Variables.
[  OK  ] Stopped Load Kernel Modules.
[  OK  ] Unmounted /run/user/0.
[  OK  ] Unmounted Temporary Directory.
[  OK  ] Stopped target Swap.
         Deactivating swap /dev/test-vg/swap_1...
[  OK  ] Deactivated swap /dev/test-vg/swap_1.
[  OK  ] Deactivated swap /dev/disk/by-uuid/…b58ce-41b3-4341-bd9d-98c4a7bab372.
[  OK  ] Deactivated swap /dev/disk/by-id/dm…vo0DXoVoelCMxoj00n4D8AA9T0tuJtogp.
[  OK  ] Deactivated swap /dev/disk/by-id/dm-name-test--vg-swap_1.
[  OK  ] Deactivated swap /dev/dm-2.
[  OK  ] Deactivated swap /dev/mapper/test--vg-swap_1.
[  OK  ] Unmounted /boot.
[  OK  ] Stopped File System Check on /dev/d…24dbc-8f9e-44c4-8f4b-82c25271a2a4.
[  OK  ] Stopped target Local File Systems (Pre).
[  OK  ] Stopped Remount Root and Kernel File Systems.
         Stopping Monitoring of LVM2 mirrors…ng dmeventd or progress polling...
[  OK  ] Stopped Create Static Device Nodes in /dev.
[  OK  ] Removed slice system-systemd\x2dfsck.slice.
[  OK  ] Stopped Monitoring of LVM2 mirrors,…sing dmeventd or progress polling.
         Stopping LVM2 metadata daemon...
[  OK  ] Stopped LVM2 metadata daemon.
[  OK  ] Stopped ferm firewall configuration.
[  OK  ] Stopped Cryptography Setup for vda5_crypt.
[  OK  ] Reached target Unmount All Filesystems.
[  OK  ] Removed slice system-systemd\x2dcryptsetup.slice.
[  OK  ] Reached target Shutdown.

Since the filesystem is not cleanly umounted, the systemd journal is corrupted
and "moved out" on the subsequent boot. I cannot see the specific error
occurred when stopping the block device, but I simply assume that it cannot be
stopped as it's currently in use by the root filesystem.

How do I debug this issue?

-- Package-specific info:

-- System Information:
Debian Release: 9.0
  APT prefers unstable
  APT policy: (900, 'unstable'), (800, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-1-rt-amd64 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages systemd depends on:
ii  adduser         3.115
ii  libacl1         2.2.52-3
ii  libapparmor1    2.11.0-2
ii  libaudit1       1:2.6.7-1
ii  libblkid1       2.29.1-1
ii  libc6           2.24-9
ii  libcap2         1:2.25-1
ii  libcryptsetup4  2:1.7.3-3
ii  libgcrypt20     1.7.6-1
ii  libgpg-error0   1.26-2
ii  libidn11        1.33-1
ii  libip4tc0       1.6.0+snapshot20161117-5
ii  libkmod2        23-2
ii  liblz4-1        0.0~r131-2
ii  liblzma5        5.2.2-1.2
ii  libmount1       2.29.1-1
ii  libpam0g        1.1.8-3.5
ii  libseccomp2     2.3.1-2.1
ii  libselinux1     2.6-3
ii  libsystemd0     232-15
ii  mount           2.29.1-1
ii  util-linux      2.29.1-1

Versions of packages systemd recommends:
ii  dbus            1.10.14-1
ii  libpam-systemd  232-15

Versions of packages systemd suggests:
ii  policykit-1        0.105-17
pn  systemd-container  <none>
ii  systemd-ui         3-4

Versions of packages systemd is related to:
pn  dracut           <none>
ii  initramfs-tools  0.127
ii  udev             232-15

-- Configuration Files:
/etc/systemd/journald.conf changed [not included]
/etc/systemd/logind.conf changed [not included]
/etc/systemd/resolved.conf changed [not included]
/etc/systemd/timesyncd.conf changed [not included]



More information about the Pkg-systemd-maintainers mailing list