Skip to content

Commit

Permalink
fix: search for btrfs devices from actual mount poiont
Browse files Browse the repository at this point in the history
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 <kasong@redhat.com>
  • Loading branch information
ryncsn authored and haraldh committed Apr 26, 2021
1 parent b92af86 commit 3fdc734
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1419,8 +1419,10 @@ for line in "${fstab_lines[@]}"; do
esac
[ -z "$dev" ] && dwarn "Bad fstab entry $*" && continue
if [[ $3 == btrfs ]]; then
for i in $(btrfs_devs "$2"); do
push_host_devs "$i"
for mp in $(findmnt --source "$1" -o TARGET -n); do
for i in $(btrfs_devs "$mp"); do
push_host_devs "$i"
done
done
fi
push_host_devs "$dev"
Expand Down

0 comments on commit 3fdc734

Please sign in to comment.