### systemd version the issue has been seen with
252.17-1~deb12u1
### Used dis…tribution
Debian 12 bookworm
### Linux kernel version used
_No response_
### CPU architectures issue was seen on
i686
### Component
_No response_
### Expected behaviour you didn't see
No such errors.
### Unexpected behaviour you saw
Some failed unmounts during shutdown.
```
[FAILED] Failed unmounting var-log.mount.
[FAILED] Failed unmounting var-tmp.mount.
[FAILED] Failed unmounting var.mount.
[ 1923.023754] (sd-remount)[43306]: Failed to remount '/var/log' read-only: Invalid argument
[ 1923.026285] (sd-umount)[43307]: Failed to unmount /var/log: Invalid argument
[ 1923.029123] (sd-remount)[43308]: Failed to remount '/var/tmp' read-only: Invalid argument
[ 1923.031693] (sd-umount)[43309]: Failed to unmount /var/tmp: Invalid argument
```
### Steps to reproduce the problem
In short:
Command `mount --options nosuid,nodev,noexec --bind /sysroot/var/log /sysroot/var/log` run at dracut boot hook `cleanup` confuses systemd sd-umount.
Details:
1. install dracut
3. [Remount Script](https://github.com/Kicksecure/security-misc/blob/master/usr/bin/remount-secure)
4. [dracut module](https://github.com/Kicksecure/security-misc/tree/master/usr/lib/dracut/modules.d/20remount-secure)
5. `sudo dracut -f`
6. `echo GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX remountsecure=3" | sudo tee /etc/default/grub.d/50_user.cfg`
(Or install [https://github.com/Kicksecure/security-misc `security-misc`].)
### Additional program output to the terminal or log subsystem illustrating the issue
```sh
This is what is being done at boot time:
Oct 22 21:43:11 localhost systemd[1]: dracut-mount.service - dracut mount hook was skipped because no trigger condition checks were met.
Oct 22 21:43:11 localhost systemd[1]: Starting dracut-pre-pivot.service - dracut pre-pivot and cleanup hook...
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /usr/bin/remount-secure: INFO: START
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: dracut detected: yes - NEWROOT: '/sysroot'
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: level 3/3 (high)
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: using nosuid,nodev: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: using noexec for all: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: 'findmnt --list' output at the START.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: TARGET SOURCE FSTYPE OPTIONS
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: / rootfs rootfs rw
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /proc proc proc rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys sysfs sysfs rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /dev devtmpfs devtmpfs rw,nosuid,size=4096k,nr_inodes=245119,mode=755,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /dev/shm tmpfs tmpfs rw,nosuid,nodev,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run tmpfs tmpfs rw,nosuid,nodev,size=401864k,nr_inodes=819200,mode=755,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/lock tmpfs tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/credentials/systemd-tmpfiles-setup-dev.service ramfs ramfs ro,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/credentials/systemd-tmpfiles-setup.service ramfs ramfs ro,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/credentials/systemd-sysctl.service ramfs ramfs ro,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot /dev/sda1 ext4 ro,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/boot' old_mount_options: ''
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/boot' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/boot' not yet mounted, therefore using mount bind.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options nosuid,nodev,noexec --bind /sysroot/boot /sysroot/boot
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/boot' new_mount_options: ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/run' old_mount_options: 'rw,nosuid,nodev,size=401864k,nr_inodes=819200,mode=755,inode64'
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/run' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/run' already mounted, therefore using remount.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options remount,nosuid,nodev,noexec /run
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/run' new_mount_options: rw,nosuid,nodev,noexec,size=401864k,nr_inodes=819200,mode=755,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev' old_mount_options: 'rw,nosuid,size=4096k,nr_inodes=245119,mode=755,inode64'
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev' already mounted, therefore using remount.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options remount,nosuid,noexec /dev
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev' new_mount_options: rw,nosuid,noexec,size=4096k,nr_inodes=245119,mode=755,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev/shm' old_mount_options: 'rw,nosuid,nodev,inode64'
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev/shm' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev/shm' already mounted, therefore using remount.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options remount,nosuid,nodev,noexec /dev/shm
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/dev/shm' new_mount_options: rw,nosuid,nodev,noexec,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/tmp' old_mount_options: ''
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/tmp' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/tmp' not yet mounted, therefore using mount bind.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options nosuid,nodev,noexec --bind /sysroot/tmp /sysroot/tmp
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/tmp' new_mount_options: ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var' old_mount_options: ''
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var' not yet mounted, therefore using mount bind.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options nosuid,nodev --bind /sysroot/var /sysroot/var
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var' new_mount_options: ro,nosuid,nodev,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/tmp' old_mount_options: ''
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/tmp' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/tmp' not yet mounted, therefore using mount bind.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options nosuid,nodev,noexec --bind /sysroot/var/tmp /sysroot/var/tmp
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/tmp' new_mount_options: ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: ro,nosuid,nodev,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/log' old_mount_options: ''
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/log' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/log' not yet mounted, therefore using mount bind.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options nosuid,nodev,noexec --bind /sysroot/var/log /sysroot/var/log
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/var/log' new_mount_options: ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: ro,nosuid,nodev,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/home' old_mount_options: ''
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/home' folder exists: yes
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/home' not yet mounted, therefore using mount bind.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: Executing: mount --options nosuid,nodev,noexec --bind /sysroot/home /sysroot/home
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: '/sysroot/home' new_mount_options: ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: 'findmnt --list' output at the END.
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: TARGET SOURCE FSTYPE OPTIONS
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: / rootfs rootfs rw
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /proc proc proc rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys sysfs sysfs rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /dev devtmpfs devtmpfs rw,nosuid,noexec,size=4096k,nr_inodes=245119,mode=755,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /dev/shm tmpfs tmpfs rw,nosuid,nodev,noexec,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run tmpfs tmpfs rw,nosuid,nodev,noexec,size=401864k,nr_inodes=819200,mode=755,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/lock tmpfs tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k,inode64
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/credentials/systemd-tmpfiles-setup-dev.service ramfs ramfs ro,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/credentials/systemd-tmpfiles-setup.service ramfs ramfs ro,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /run/credentials/systemd-sysctl.service ramfs ramfs ro,nosuid,nodev,noexec,relatime,mode=700
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot /dev/sda1 ext4 ro,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/boot /dev/sda1[/boot] ext4 ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/tmp /dev/sda1[/tmp] ext4 ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/var /dev/sda1[/var] ext4 ro,nosuid,nodev,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/var/tmp /dev/sda1[/var/tmp] ext4 ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/var/tmp /dev/sda1[/var/tmp] ext4 ro,nosuid,nodev,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/var/log /dev/sda1[/var/log] ext4 ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/var/log /dev/sda1[/var/log] ext4 ro,nosuid,nodev,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /sysroot/home /dev/sda1[/home] ext4 ro,nosuid,nodev,noexec,relatime
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: INFO: exit_code: 0
Oct 22 21:43:11 localhost dracut-pre-pivot[409]: /usr/bin/remount-secure: INFO: END
Oct 22 21:43:11 localhost dracut-pre-pivot[396]: /bin/dracut-pre-pivot: INFO: 'remount-secure 3' success.
Oct 22 21:43:11 localhost systemd[1]: Finished dracut-pre-pivot.service - dracut pre-pivot and cleanup hook.
```
Longer log during shutdown:
```
[ OK ] Stopped target local-fs.target - Local File Systems.
Unmounting boot.mount - /boot...
Unmounting home.mount...
Unmounting run-credentials…dentials/systemd-sysctl.service...
Unmounting run-credentials…ntials/systemd-sysusers.service...
Unmounting run-credentials…temd-tmpfiles-setup-dev.service...
Unmounting run-msgcollector.mount - /run/msgcollector...
Unmounting tmp.mount...
Unmounting var-log.mount...
Unmounting var-tmp.mount...
[ OK ] Stopped systemd-modules-lo…service - Load Kernel Modules.
[ 1922.556991] audit: type=1131 audit(1698009222.706:410): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='unit=systemd-modules-load comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ OK ] Unmounted boot.mount - /boot.
[ OK ] Unmounted home.mount.
[ OK ] Unmounted run-credentials-…redentials/systemd-sysctl.service.
[ OK ] Unmounted run-credentials-…dentials/systemd-sysusers.service.
[ OK ] Unmounted run-credentials-…ystemd-tmpfiles-setup-dev.service.
[ OK ] Unmounted run-msgcollector.mount - /run/msgcollector.
[ OK ] Unmounted tmp.mount.
[FAILED] Failed unmounting var-log.mount.
[ OK ] Stopped target swap.target - Swaps.
[FAILED] Failed unmounting var-tmp.mount.
Unmounting var.mount...
[FAILED] Failed unmounting var.mount.
[ OK ] Stopped target local-fs-pr…reparation for Local File Systems.
[ OK ] Reached target umount.target - Unmount All Filesystems.
[ OK ] Stopped systemd-tmpfiles-s…reate Static Device Nodes in /dev.
[ 1922.670633] audit: type=1131 audit(1698009222.818:411): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='unit=systemd-tmpfiles-setup-dev comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ OK ] Stopped systemd-sysusers.service - Create System Users.
[ 1922.675135] audit: type=1131 audit(1698009222.822:412): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='unit=systemd-sysusers comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ OK ] Stopped systemd-remount-fs…ount Root and Kernel File Systems.
[ 1922.678313] audit: type=1131 audit(1698009222.826:413): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='unit=systemd-remount-fs comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ OK ] Stopped systemd-fsck-root.… File System Check on Root Device.
[ OK ] Reached target shutdown.target - System Shutdown.
[ OK ] Reached target final.target - Late Shutdown Services.
[ OK ] Finished systemd-poweroff.service - System Power Off.
[ OK ] Reached target poweroff.target - System Power Off.
[ 1922.945104] systemd-shutdown[1]: Syncing filesystems and block devices.
[ 1922.971729] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
[ 1922.975104] systemd-journald[518]: Received SIGTERM from PID 1 (systemd-shutdow).
[ 1922.987141] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
[ 1922.989948] systemd-shutdown[1]: Unmounting file systems.
[ 1922.991355] (sd-remount)[43304]: Remounting '/var/log' read-only with options 'errors=remount-ro'.
[ 1923.005198] EXT4-fs (sda1): re-mounted. Quota mode: none.
[ 1923.021128] (sd-umount)[43305]: Unmounting '/var/log'.
[ 1923.022672] (sd-remount)[43306]: Remounting '/var/log' read-only with options 'errors=remount-ro'.
[ 1923.023754] (sd-remount)[43306]: Failed to remount '/var/log' read-only: Invalid argument
[ 1923.025414] (sd-umount)[43307]: Unmounting '/var/log'.
[ 1923.026285] (sd-umount)[43307]: Failed to unmount /var/log: Invalid argument
[ 1923.027942] (sd-remount)[43308]: Remounting '/var/tmp' read-only with options 'errors=remount-ro'.
[ 1923.029123] (sd-remount)[43308]: Failed to remount '/var/tmp' read-only: Invalid argument
[ 1923.030880] (sd-umount)[43309]: Unmounting '/var/tmp'.
[ 1923.031693] (sd-umount)[43309]: Failed to unmount /var/tmp: Invalid argument
[ 1923.033427] (sd-remount)[43310]: Remounting '/var' read-only with options 'errors=remount-ro'.
[ 1923.034464] EXT4-fs (sda1): re-mounted. Quota mode: none.
[ 1923.035832] (sd-umount)[43311]: Unmounting '/var'.
[ 1923.037161] (sd-remount)[43312]: Remounting '/' read-only with options 'errors=remount-ro'.
[ 1923.038104] EXT4-fs (sda1): re-mounted. Quota mode: none.
[ 1923.039631] (sd-umount)[43313]: Unmounting '/var/log'.
[ 1923.041043] (sd-umount)[43314]: Unmounting '/var/tmp'.
[ 1923.042124] systemd-shutdown[1]: All filesystems unmounted.
[ 1923.042963] systemd-shutdown[1]: Deactivating swaps.
[ 1923.043801] systemd-shutdown[1]: All swaps deactivated.
[ 1923.044617] systemd-shutdown[1]: Detaching loop devices.
[ 1923.045952] systemd-shutdown[1]: All loop devices detached.
[ 1923.046654] systemd-shutdown[1]: Stopping MD devices.
[ 1923.047414] systemd-shutdown[1]: All MD devices stopped.
[ 1923.048119] systemd-shutdown[1]: Detaching DM devices.
[ 1923.049798] systemd-shutdown[1]: All DM devices detached.
[ 1923.050531] systemd-shutdown[1]: All filesystems, swaps, loop devices, MD devices and DM devices detached.
[ 1923.053849] systemd-shutdown[1]: Syncing filesystems and block devices.
[ 1923.054574] systemd-shutdown[1]: Powering off.
[ 1923.055475] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 1923.056420] sd 0:0:0:0: [sda] Stopping disk
[ 1923.068889] ACPI: PM: Preparing to enter system sleep state S5
[ 1923.069942] reboot: Power down
```
```