Skip to content

Commit 78cafe4

Browse files
LaszloGombosjohannbg
authored andcommitted
fix(nfs,virtiofs): check kernel for builtin fs drivers
Check first for fs support in `/proc/filesystems` before attempting to load the kernel module. This is needed in the --no-kernel use case to avoid the error: modprobe: FATAL: Module overlay not found in directory /lib/modules/<kver>
1 parent 4f20ae2 commit 78cafe4

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

modules.d/95nfs/nfs-start-rpc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
3+
if load_fstype sunrpc rpc_pipefs; then
44
[ ! -d /var/lib/nfs/rpc_pipefs/nfs ] \
55
&& mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
66

modules.d/95virtiofs/mount-virtiofs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
type ismounted > /dev/null 2>&1 || . /lib/dracut-lib.sh
44

55
if [ "${fstype}" = "virtiofs" -o "${root%%:*}" = "virtiofs" ]; then
6-
if ! { modprobe virtiofs || strstr "$(cat /proc/filesystems)" virtiofs; }; then
6+
if ! load_fstype virtiofs; then
77
die "virtiofs is required but not available."
88
fi
99

modules.d/99base/dracut-lib.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,12 @@ remove_hostonly_files() {
11531153
fi
11541154
}
11551155

1156-
# parameter: kernel_module filesystem_name
1156+
# parameter: kernel_module [filesystem_name]
11571157
# returns OK if kernel_module is loaded
11581158
# modprobe fails if /lib/modules is not available (--no-kernel use case)
11591159
load_fstype() {
1160-
strstr "$(cat /proc/filesystems)" "$1" || modprobe "$1"
1160+
if [ -z "$2" ]; then
1161+
set -- "$1" "$2"
1162+
fi
1163+
strstr "$(cat /proc/filesystems)" "$2" || modprobe "$1"
11611164
}

0 commit comments

Comments
 (0)