When bootc install to-filesystem runs via podman run --pid=host, the LUKS device cleanup fails.
Error:
device-mapper: remove ioctl on fisherman-root failed: Device or resource busy
cryptsetup luksClose fisherman-root: exit status 5
Root Cause:
The Cleanup.Run() function in internal/post/post.go calls luksClose immediately after unmounting, without flushing pending I/O or releasing device references that may be held after the container exits.
Solution:
Add the following cleanup steps before calling luks.Close(), mirroring the strategy in internal/disk/partition.go:unmountAll():
- fuser -km to kill remaining processes holding device references
- blockdev --flushbufs to flush pending I/O
- udevadm settle to wait for device-mapper to release handles
This prevents the Device or resource busy error when LUKS devices are closed after container-based installs.
References:
When bootc install to-filesystem runs via podman run --pid=host, the LUKS device cleanup fails.
Error:
device-mapper: remove ioctl on fisherman-root failed: Device or resource busy
cryptsetup luksClose fisherman-root: exit status 5
Root Cause:
The Cleanup.Run() function in internal/post/post.go calls luksClose immediately after unmounting, without flushing pending I/O or releasing device references that may be held after the container exits.
Solution:
Add the following cleanup steps before calling luks.Close(), mirroring the strategy in internal/disk/partition.go:unmountAll():
This prevents the Device or resource busy error when LUKS devices are closed after container-based installs.
References: