Skip to content

Commit

Permalink
fix(dmsquash-live): check kernel for built-in squashfs drivers
Browse files Browse the repository at this point in the history
Check first for squashfs in `/proc/filesystems`.
This is needed in the --no-kernel use case to avoid the error:
modprobe: FATAL: Module overlay not found in directory /lib/modules/<kver>

Introduce load_fstype function to make it easier to check `/proc/filesystems`
before calling modprobe.
  • Loading branch information
LaszloGombos authored and johannbg committed Aug 15, 2022
1 parent ec333c3 commit 922c9e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules.d/90dmsquash-live/dmsquash-live-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ det_img_fs() {
blkid -s TYPE -u noraid -o value "$1"
}

modprobe squashfs
load_fstype squashfs
CMDLINE=$(getcmdline)
for arg in $CMDLINE; do
case $arg in
Expand Down Expand Up @@ -204,7 +204,7 @@ do_live_overlay() {
fi
fi
if [ -n "$overlayfs" ]; then
if ! { strstr "$(< /proc/filesystems)" overlay || modprobe overlay; }; then
if ! load_fstype overlay; then
if [ "$overlayfs" = required ]; then
die "OverlayFS is required but not available."
exit 1
Expand Down
7 changes: 7 additions & 0 deletions modules.d/99base/dracut-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1152,3 +1152,10 @@ remove_hostonly_files() {
done < /lib/dracut/hostonly-files
fi
}

# parameter: kernel_module filesystem_name
# returns OK if kernel_module is loaded
# modprobe fails if /lib/modules is not available (--no-kernel use case)
load_fstype() {
strstr "$(cat /proc/filesystems)" "$1" || modprobe "$1"
}

0 comments on commit 922c9e2

Please sign in to comment.