Skip to content

Commit 3fdc734

Browse files
ryncsnharaldh
authored andcommitted
fix: search for btrfs devices from actual mount poiont
Currently when dracut search for btrfs device used for initramfs, it assumes the mount points passed in with "--mount" are all mounted with given mount path. If user want the device to be mounted to a different location in initramfs, this will not be true. eg. with "--mount '/dev/mapper/vol /sysroot btrfs rw,relatime,subvolid=256,subvol=/root'" and having '/dev/mapper/vol' currently mounted on '/', will raise an error: ERROR: cannot access '/sysroot': No such file or directory So search for actual mount point of given device. Signed-off-by: Kairui Song <[email protected]>
1 parent b92af86 commit 3fdc734

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dracut.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,8 +1419,10 @@ for line in "${fstab_lines[@]}"; do
14191419
esac
14201420
[ -z "$dev" ] && dwarn "Bad fstab entry $*" && continue
14211421
if [[ $3 == btrfs ]]; then
1422-
for i in $(btrfs_devs "$2"); do
1423-
push_host_devs "$i"
1422+
for mp in $(findmnt --source "$1" -o TARGET -n); do
1423+
for i in $(btrfs_devs "$mp"); do
1424+
push_host_devs "$i"
1425+
done
14241426
done
14251427
fi
14261428
push_host_devs "$dev"

0 commit comments

Comments
 (0)