Summary: | net-fs/ksmbd-tools-3.4.4 ksmbd init script fails if module is already included in kernel | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | marius |
Component: | Current packages | Assignee: | Georgy Yakovlev <gyakovlev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | marius |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | kernel config |
Description
marius
2023-01-16 15:48:22 UTC
modprobe should silently exit if module loaded/is in kernel. --first-time Normally, modprobe will succeed (and do nothing) if told to insert a module which is already present or to remove a module which isn't present. This is ideal for simple scripts; however, more complicated scripts often want to know whether modprobe really did something: this option makes modprobe fail in the case that it actually didn't do anything # zcat /proc/config.gz | grep EXT4 CONFIG_EXT4_FS=y ^ as you see ext4 is builtin. # modprobe ext4 # echo $? 0 what's your implementation of modprobe? mine is: qfile /sbin/modprobe sys-apps/kmod: /sbin/modprobe so even if ti try modprobing it, it will return 0. || exit 1 is to catch situations when it actually failed. maybe it's actually failing in your case? like same kernel build with it builtin and still a leftover module present from previous build of same version? please also provide output of modinfo ksmbd as an example: modinfo ext4 name: ext4 filename: (builtin) softdep: pre: crc32c license: GPL file: fs/ext4/ext4 description: Fourth Extended Filesystem author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others alias: fs-ext4 alias: ext3 alias: fs-ext3 alias: ext2 alias: fs-ext2 also it does NOT have directory in /sys/module/ext4, so that check is not correct, at least not for ext4. System is Raspberry Pi 3B+, Gentoo arm64 musl openrc. qfile is not installed # modprobe -V kmod version 30 +ZSTD +XZ +ZLIB -LIBCRYPTO -EXPERIMENTAL # modprobe ksmbd modprobe: FATAL: Module ksmbd not found in directory /lib/modules/5.15.76_p20221104-raspberrypi-M95D There is no /lib/modules on my system. I never did "make modules" or "make modules install". # which modprobe /sbin/modprobe # equery b /sbin/modprobe * Searching for /sbin/modprobe ... sys-apps/kmod-30-r1 (/sbin/modprobe -> ../bin/kmod) sys-apps/kmod-30-r1 (/bin/kmod) Can you attach kernel config? Is module support enabled at all? Maybe you can strace modprobe invocation? I can’t reproduce on kernel where modules are enabled but ksmbd is builtin. Created attachment 848835 [details]
kernel config
No, modules are NOT enabled. strace -f modprobe ksmbd execve("/sbin/modprobe", ["modprobe", "ksmbd"], 0x3ffc6937ff0 /* 39 vars */) = 0 set_tid_address(0x3ff91cbce38) = 22855 brk(NULL) = 0x2aaf8110000 brk(0x2aaf8130000) = 0x2aaf8130000 mmap(0x2aaf8110000, 65536, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2aaf8110000 openat(AT_FDCWD, "/etc/ld-musl-aarch64.path", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 fstat(3, {st_mode=S_IFREG|0644, st_size=75, ...}) = 0 read(3, "/usr/lib/gcc/aarch64-gentoo-linu"..., 75) = 75 close(3) = 0 openat(AT_FDCWD, "/usr/lib/gcc/aarch64-gentoo-linux-musl/12.2.0/libzstd.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/libzstd.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 fstat(3, {st_mode=S_IFREG|0755, st_size=633856, ...}) = 0 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960 mmap(NULL, 720896, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3ff91b20000 mmap(0x3ff91bc0000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x90000) = 0x3ff91bc0000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/gcc/aarch64-gentoo-linux-musl/12.2.0/liblzma.so.5", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/liblzma.so.5", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 fstat(3, {st_mode=S_IFREG|0755, st_size=198912, ...}) = 0 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960 mmap(NULL, 327680, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3ff91ad0000 mmap(0x3ff91b00000, 131072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x20000) = 0x3ff91b00000 close(3) = 0 openat(AT_FDCWD, "/usr/lib/gcc/aarch64-gentoo-linux-musl/12.2.0/libz.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/libz.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 fstat(3, {st_mode=S_IFREG|0755, st_size=84072, ...}) = 0 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960 mmap(NULL, 196608, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3ff91aa0000 mmap(0x3ff91ac0000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x10000) = 0x3ff91ac0000 close(3) = 0 mprotect(0x3ff91b00000, 65536, PROT_READ) = 0 mprotect(0x2aac2380000, 65536, PROT_READ) = 0 uname({sysname="Linux", nodename="RPi3", ...}) = 0 newfstatat(AT_FDCWD, "/etc/modprobe.d", {st_mode=S_IFDIR|0755, st_size=18, ...}, 0) = 0 openat(AT_FDCWD, "/etc/modprobe.d", O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_DIRECTORY) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 getdents64(3, 0x3ff91cbcf08 /* 3 entries */, 2048) = 80 newfstatat(3, "zram.conf", {st_mode=S_IFREG|0644, st_size=27, ...}, 0) = 0 getdents64(3, 0x3ff91cbcf08 /* 0 entries */, 2048) = 0 close(3) = 0 newfstatat(AT_FDCWD, "/run/modprobe.d", 0x3ffcc162650, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/usr/local/lib/modprobe.d", 0x3ffcc162650, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/lib/modprobe.d", {st_mode=S_IFDIR|0755, st_size=90, ...}, 0) = 0 openat(AT_FDCWD, "/lib/modprobe.d", O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_DIRECTORY) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 getdents64(3, 0x3ff91b1c338 /* 5 entries */, 2048) = 160 newfstatat(3, "aliases.conf", {st_mode=S_IFREG|0644, st_size=1186, ...}, 0) = 0 newfstatat(3, "i386.conf", {st_mode=S_IFREG|0644, st_size=122, ...}, 0) = 0 newfstatat(3, "usb-load-ehci-first.conf", {st_mode=S_IFREG|0644, st_size=62, ...}, 0) = 0 getdents64(3, 0x3ff91b1c338 /* 0 entries */, 2048) = 0 close(3) = 0 openat(AT_FDCWD, "/lib/modprobe.d/aliases.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 read(3, "# Aliases to tell insmod/modprob"..., 1024) = 1024 read(3, "mars6\nalias cipher-11\t\trc62\nalia"..., 1024) = 162 read(3, "", 1024) = 0 close(3) = 0 openat(AT_FDCWD, "/lib/modprobe.d/i386.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 read(3, "alias parport_lowlevel parport_p"..., 1024) = 122 read(3, "", 1024) = 0 close(3) = 0 openat(AT_FDCWD, "/lib/modules/5.15.76_p20221104-raspberrypi-M95D/modules.softdep", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/modprobe.d/usb-load-ehci-first.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 read(3, "softdep uhci_hcd pre: ehci_hcd\ns"..., 1024) = 62 read(3, "", 1024) = 0 close(3) = 0 openat(AT_FDCWD, "/etc/modprobe.d/zram.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 read(3, "options zram num_devices=3\n", 1024) = 27 read(3, "", 1024) = 0 close(3) = 0 openat(AT_FDCWD, "/proc/cmdline", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 read(3, "coherent_pool=1M 8250.nr_uarts=1"..., 4095) = 234 read(3, "", 3861) = 0 close(3) = 0 openat(AT_FDCWD, "/lib/modules/5.15.76_p20221104-raspberrypi-M95D/modules.dep.bin", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/modules/5.15.76_p20221104-raspberrypi-M95D/modules.dep.bin", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/modules/5.15.76_p20221104-raspberrypi-M95D/modules.alias.bin", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/modules/5.15.76_p20221104-raspberrypi-M95D/modules.builtin.bin", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/modules/5.15.76_p20221104-raspberrypi-M95D/modules.builtin.alias.bin", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory) writev(2, [{iov_base="modprobe: FATAL: ", iov_len=17}, {iov_base="Module ksmbd not found in direct"..., iov_len=84}], 2) = 101 modprobe: FATAL: Module ksmbd not found in directory /lib/modules/5.15.76_p20221104-raspberrypi-M95D writev(2, [{iov_base="", iov_len=0}, {iov_base=NULL, iov_len=0}], 2) = 0 exit_group(1) = ? +++ exited with 1 +++ The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17932f0fd7e8dc001c6fc26c084f1a2ea6672a16 commit 17932f0fd7e8dc001c6fc26c084f1a2ea6672a16 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2023-01-19 17:51:46 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2023-01-19 17:55:32 +0000 net-fs/ksmbd-tools: revbump 3.4.6, improve openrc startup/reload * don't check for modprobe errors, some systems may have specific configuration where modprobe returns errors #891129 * add reload() openrc subcommand to initscript. * allow passing arbitrary KSMBD_OPTS for ksmbd.mountd(8) * remove incorrect mountd opts. Thanks-to: Pedro de Oliveira <falsovsky@gmail.com> Closes: https://bugs.gentoo.org/891129 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> net-fs/ksmbd-tools/files/ksmbd.confd | 3 +++ net-fs/ksmbd-tools/files/ksmbd.initd | 15 ++++++++++++--- ...mbd-tools-3.4.6.ebuild => ksmbd-tools-3.4.6-r1.ebuild} | 0 3 files changed, 15 insertions(+), 3 deletions(-) thanks. after thinking about it I opted to ignore return codes by running 'modprobe -q ksmbd || return 0' there's little value of checking for error here tbh. OK. Thanks. |