luksfix xfs file system fix cipher

This commit is contained in:
Alperen42v 2026-07-02 14:17:33 +03:00
parent 1c471d201a
commit 45cf08a3be
1 changed files with 9 additions and 2 deletions

View File

@ -195,7 +195,14 @@ class Luks2:
for child in lsblk_info.children:
for mountpoint in child.mountpoints:
debug(f'Unmounting {mountpoint}')
umount(mountpoint, recursive=True)
# mountpoint is a directory path, not a block device — umount()
# internally calls get_lsblk_info() which runs lsblk on the path
# and fails with "not a block device". Use run() directly to call
# umount(8) on the directory instead.
try:
run(['umount', '--recursive', str(mountpoint)])
except Exception as e:
debug(f'Could not unmount {mountpoint}: {e}')
# Wait for udev to finish processing events so the kernel drops
# any lingering reference on the mapper device before we close it.
@ -313,4 +320,4 @@ def unlock_luks2_dev(
if not luks_handler.is_unlocked():
luks_handler.unlock()
return luks_handler
return luks_handler