You are not logged in.
I have a weird problem with systemd, which shows me an error on startup. systemd-modules-load fails to load:
% sudo systemctl status systemd-modules-load.service
● systemd-modules-load.service - Load Kernel Modules
Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static; vendor preset: disabled)
Active: failed (Result: signal) since Sun 2019-09-01 20:42:19 CEST; 1h 38min left
Condition: start condition failed at Sun 2019-09-01 19:03:16 CEST; 5s ago
├─ ConditionDirectoryNotEmpty=|/lib/modules-load.d was not met
├─ ConditionDirectoryNotEmpty=|/usr/lib/modules-load.d was not met
├─ ConditionDirectoryNotEmpty=|/usr/local/lib/modules-load.d was not met
├─ ConditionDirectoryNotEmpty=|/etc/modules-load.d was not met
├─ ConditionDirectoryNotEmpty=|/run/modules-load.d was not met
├─ ConditionKernelCommandLine=|modules-load was not met
└─ ConditionKernelCommandLine=|rd.modules-load was not met
Docs: man:systemd-modules-load.service(8)
man:modules-load.d(5)
Main PID: 217 (code=killed, signal=ABRT)
Looking further:
% sudo journalctl _PID=217
Sep 01 20:42:19 archlinux systemd-modules-load[217]: Assertion 'err < 0' failed at ../systemd-stable/src/shared/module-util.c:56, function module_load_and_warn(). Aborting.
What does this assertion error mean? Is this a programming error? Or is there a module broken (I don't think I have any modules because all module directories are empty)?
Offline
systemd-modules-load tried to load a module [1] and failed with an unexpected error [2]
[1] https://github.com/systemd/systemd/blob … util.c#L47
[2] https://github.com/systemd/systemd/blob … util.c#L55
Offline
How am I going to find out which module failed and what the error was? Is there a way to get more logging output from systemd?
Offline
Does the following produce more output?
# SYSTEMD_LOG_LEVEL=DEBUG /usr/lib/systemd/systemd-modules-load
It should hopefully produce the name of the module but probably not the error code.
Offline
It only says
% sudo SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-modules-load
Found container virtualization none.
Offline
No config files were found which matches why the service start conditions are not met so no kernel modules were loaded.
Something unknown starts systemd-modules-load and it then fails to load an unknown module.
Edit:
Try adding the kernel parameter systemd.loglevel=debug
If that fails you may need to rebuild the systemd package with debuging enabled.
Last edited by loqs (2019-09-01 20:45:25)
Offline
Ok, can I disable to load systemd-modules-load at all (I don't think I need it)? I don't seem to be able to do a systemctl disable systemd-modules-load because it is already disabled. I can list all units:
% sudo systemctl list-unit-files | cat
UNIT FILE STATE
proc-sys-fs-binfmt_misc.automount static
-.mount generated
boot.mount generated
dev-hugepages.mount static
dev-mqueue.mount static
home.mount generated
media-ext.mount generated
media-ext3.mount generated
media-phone.mount generated
media-win.mount generated
proc-sys-fs-binfmt_misc.mount static
sys-fs-fuse-connections.mount static
sys-kernel-config.mount static
sys-kernel-debug.mount static
tmp.mount generated
var-lib-machines.mount static
systemd-ask-password-console.path static
systemd-ask-password-wall.path static
session-1.scope transient
alsa-restore.service static
alsa-state.service static
auditd.service disabled
autovt@.service enabled
avahi-daemon.service disabled
avahi-dnsconfd.service disabled
blk-availability.service disabled
btrfs-scrub@.service static
canberra-system-bootup.service disabled
canberra-system-shutdown-reboot.service disabled
canberra-system-shutdown.service disabled
clean-mount-point@.service static
colord.service static
console-getty.service disabled
container-getty@.service static
cpupower.service disabled
cronie.service enabled
dbus-org.freedesktop.hostname1.service static
dbus-org.freedesktop.import1.service static
dbus-org.freedesktop.locale1.service static
dbus-org.freedesktop.login1.service static
dbus-org.freedesktop.machine1.service static
dbus-org.freedesktop.portable1.service static
dbus-org.freedesktop.timedate1.service static
dbus.service static
debug-shell.service disabled
dhcpcd.service disabled
dhcpcd@.service indirect
dm-event.service static
dmraid.service disabled
dropbox@.service disabled
e2scrub@.service static
e2scrub_all.service static
e2scrub_fail@.service static
e2scrub_reap.service disabled
emergency.service static
fancontrol.service disabled
fstrim.service static
ftpd.service disabled
geoclue.service static
getty@.service enabled
git-daemon@.service static
gpm.service disabled
healthd.service disabled
initrd-cleanup.service static
initrd-parse-etc.service static
initrd-switch-root.service static
initrd-udevadm-cleanup-db.service static
ip6tables.service disabled
iptables.service disabled
irexec.service disabled
kmod-static-nodes.service static
krb5-kadmind.service disabled
krb5-kdc.service disabled
krb5-kpropd.service disabled
krb5-kpropd@.service static
ldconfig.service static
lircd-setup.service disabled
lircd-uinput.service disabled
lircd.service disabled
lircmd.service disabled
lm_sensors.service disabled
logrotate.service static
lvm2-lvmetad.service static
lvm2-lvmpolld.service static
lvm2-monitor.service static
lvm2-pvscan@.service static
man-db.service static
mdadm-grow-continue@.service static
mdadm-last-resort@.service static
mdmon@.service static
mdmonitor.service static
mkinitcpio-generate-shutdown-ramfs.service static
ndctl-monitor.service disabled
netctl-auto@.service disabled
netctl-ifplugd@.service disabled
netctl-sleep.service disabled
netctl-wait-online.service disabled
netctl.service disabled
netctl@.service static
nscd.service disabled
ntpd.service enabled
ntpdate.service disabled
nvidia-persistenced.service disabled
paccache.service static
pkgfile-update.service static
polkit.service static
quotaon.service static
rescue.service static
rfkill-block@.service disabled
rfkill-unblock@.service disabled
rlogin@.service static
rsh@.service static
rsyncd.service disabled
rsyncd@.service static
rtkit-daemon.service disabled
sensord.service disabled
serial-getty@.service disabled
shadow.service static
smartd.service disabled
sshd.service disabled
sshd@.service static
sshdgenkeys.service static
syslog-ng@.service disabled
system-update-cleanup.service static
systemd-ask-password-console.service static
systemd-ask-password-wall.service static
systemd-backlight@.service static
systemd-binfmt.service static
systemd-bless-boot.service static
systemd-boot-check-no-failures.service disabled
systemd-coredump@.service static
systemd-exit.service static
systemd-firstboot.service static
systemd-fsck-root.service enabled-runtime
systemd-fsck@.service static
systemd-halt.service static
systemd-hibernate-resume@.service static
systemd-hibernate.service static
systemd-hostnamed.service static
systemd-hwdb-update.service static
systemd-hybrid-sleep.service static
systemd-importd.service static
systemd-initctl.service static
systemd-journal-catalog-update.service static
systemd-journal-flush.service static
systemd-journal-gatewayd.service indirect
systemd-journal-remote.service indirect
systemd-journal-upload.service disabled
systemd-journald.service static
systemd-kexec.service static
systemd-localed.service static
systemd-logind.service static
systemd-machine-id-commit.service static
systemd-machined.service static
systemd-modules-load.service static
systemd-networkd-wait-online.service disabled
systemd-networkd.service disabled
systemd-nspawn@.service disabled
systemd-portabled.service static
systemd-poweroff.service static
systemd-quotacheck.service static
systemd-random-seed.service static
systemd-reboot.service static
systemd-remount-fs.service enabled-runtime
systemd-resolved.service disabled
systemd-rfkill.service static
systemd-suspend-then-hibernate.service static
systemd-suspend.service static
systemd-sysctl.service static
systemd-sysusers.service static
systemd-time-wait-sync.service disabled
systemd-timedated.service static
systemd-timesyncd.service disabled
systemd-tmpfiles-clean.service static
systemd-tmpfiles-setup-dev.service static
systemd-tmpfiles-setup.service static
systemd-udev-settle.service static
systemd-udev-trigger.service static
systemd-udevd.service static
systemd-update-done.service static
systemd-update-utmp.service static
systemd-user-sessions.service static
systemd-vconsole-setup.service static
systemd-volatile-root.service static
talk.service indirect
telnet@.service static
udisks2.service disabled
updatedb.service static
user-runtime-dir@.service static
user@.service static
uuidd.service indirect
vnstat.service enabled
vpnc@.service disabled
wpa_supplicant-nl80211@.service disabled
wpa_supplicant-wired@.service disabled
wpa_supplicant.service disabled
wpa_supplicant@.service disabled
xfs_scrub@.service static
xfs_scrub_all.service static
xfs_scrub_fail@.service static
xinetd.service disabled
zram-setup@.service static
machine.slice static
user.slice static
avahi-daemon.socket disabled
dbus.socket static
dm-event.socket static
git-daemon.socket disabled
krb5-kpropd.socket disabled
lircd.socket disabled
lvm2-lvmetad.socket static
lvm2-lvmpolld.socket static
rlogin.socket disabled
rsh.socket disabled
rsyncd.socket disabled
sshd.socket disabled
syslog.socket static
systemd-coredump.socket static
systemd-initctl.socket static
systemd-journal-gatewayd.socket disabled
systemd-journal-remote.socket disabled
systemd-journald-audit.socket static
systemd-journald-dev-log.socket static
systemd-journald.socket static
systemd-networkd.socket disabled
systemd-rfkill.socket static
systemd-udevd-control.socket static
systemd-udevd-kernel.socket static
talk.socket disabled
telnet.socket disabled
uuidd.socket disabled
dev-disk-by\x2duuid-a…da730\x2d447b\x2db48b\x2d53ae6e31b5df.swap generated
basic.target static
bluetooth.target static
boot-complete.target static
cryptsetup-pre.target static
cryptsetup.target static
ctrl-alt-del.target enabled
default.target static
emergency.target static
exit.target disabled
final.target static
getty-pre.target static
getty.target static
graphical.target static
halt.target disabled
hibernate.target static
hybrid-sleep.target static
initrd-fs.target static
initrd-root-device.target static
initrd-root-fs.target static
initrd-switch-root.target static
initrd.target static
kexec.target disabled
local-fs-pre.target static
local-fs.target static
machines.target disabled
multi-user.target static
network-online.target static
network-pre.target static
network.target static
nss-lookup.target static
nss-user-lookup.target static
paths.target static
poweroff.target disabled
printer.target static
reboot.target enabled
remote-cryptsetup.target disabled
remote-fs-pre.target static
remote-fs.target enabled
rescue.target static
rpcbind.target static
runlevel0.target disabled
runlevel1.target static
runlevel2.target static
runlevel3.target static
runlevel4.target static
runlevel5.target static
runlevel6.target enabled
shutdown.target static
sigpwr.target static
sleep.target static
slices.target static
smartcard.target static
sockets.target static
sound.target static
suspend-then-hibernate.target static
suspend.target static
swap.target static
sysinit.target static
system-update-pre.target static
system-update.target static
time-set.target static
time-sync.target static
timers.target static
umount.target static
btrfs-scrub@.timer disabled
e2scrub_all.timer disabled
fstrim.timer disabled
logrotate.timer disabled
man-db.timer disabled
mdadm-last-resort@.timer static
paccache.timer disabled
pkgfile-update.timer disabled
shadow.timer static
systemd-tmpfiles-clean.timer static
updatedb.timer static
xfs_scrub_all.timer disabled
308 unit files listed.
I found that I can list a dependecy tree:
% sudo systemctl list-dependencies | cat
default.target
● ├─display-manager.service
● └─multi-user.target
● ├─cronie.service
● ├─dbus.service
● ├─dhcpcd@eth0.service
● ├─man-db.timer
● ├─ntpd.service
● ├─systemd-ask-password-wall.path
● ├─systemd-logind.service
● ├─systemd-user-sessions.service
● ├─updatedb.timer
● ├─vnstat.service
● ├─basic.target
● │ ├─-.mount
● │ ├─tmp.mount
● │ ├─paths.target
● │ ├─slices.target
● │ │ ├─-.slice
● │ │ └─system.slice
● │ ├─sockets.target
● │ │ ├─dbus.socket
● │ │ ├─dm-event.socket
● │ │ ├─systemd-coredump.socket
● │ │ ├─systemd-initctl.socket
● │ │ ├─systemd-journald-audit.socket
● │ │ ├─systemd-journald-dev-log.socket
● │ │ ├─systemd-journald.socket
● │ │ ├─systemd-udevd-control.socket
● │ │ └─systemd-udevd-kernel.socket
● │ ├─sysinit.target
● │ │ ├─dev-hugepages.mount
● │ │ ├─dev-mqueue.mount
● │ │ ├─kmod-static-nodes.service
● │ │ ├─ldconfig.service
● │ │ ├─lvm2-lvmetad.socket
● │ │ ├─lvm2-lvmpolld.socket
● │ │ ├─lvm2-monitor.service
● │ │ ├─proc-sys-fs-binfmt_misc.automount
● │ │ ├─sys-fs-fuse-connections.mount
● │ │ ├─sys-kernel-config.mount
● │ │ ├─sys-kernel-debug.mount
● │ │ ├─systemd-ask-password-console.path
● │ │ ├─systemd-binfmt.service
● │ │ ├─systemd-firstboot.service
● │ │ ├─systemd-hwdb-update.service
● │ │ ├─systemd-journal-catalog-update.service
● │ │ ├─systemd-journal-flush.service
● │ │ ├─systemd-journald.service
● │ │ ├─systemd-machine-id-commit.service
● │ │ ├─systemd-modules-load.service
● │ │ ├─systemd-random-seed.service
● │ │ ├─systemd-sysctl.service
● │ │ ├─systemd-sysusers.service
● │ │ ├─systemd-tmpfiles-setup-dev.service
● │ │ ├─systemd-tmpfiles-setup.service
● │ │ ├─systemd-udev-trigger.service
● │ │ ├─systemd-udevd.service
● │ │ ├─systemd-update-done.service
● │ │ ├─systemd-update-utmp.service
● │ │ ├─cryptsetup.target
● │ │ ├─local-fs.target
● │ │ │ ├─-.mount
● │ │ │ ├─boot.mount
● │ │ │ ├─home.mount
● │ │ │ ├─media-ext.mount
● │ │ │ ├─media-ext3.mount
● │ │ │ ├─media-win.mount
● │ │ │ ├─systemd-fsck-root.service
● │ │ │ ├─systemd-remount-fs.service
● │ │ │ └─tmp.mount
● │ │ └─swap.target
● │ │ └─dev-disk-by\x2duuid-aa4f31d9\x2da730\x2d447b\x2db48b\x2d53ae6e31b5df.…
● │ └─timers.target
● │ ├─logrotate.timer
● │ ├─shadow.timer
● │ └─systemd-tmpfiles-clean.timer
● ├─getty.target
● │ └─getty@tty1.service
● └─remote-fs.target
● └─var-lib-machines.mount
Could this mean that systemd-modules-load is loaded by sysinit? Does sysinit have a configuration file somewhere?
Offline
Check the journal after adding the kernel parameter I suggested that may indicate what called systemd-modules-load.
Offline
Not sure if the debug parameter has any effect because I can't see any difference in the logging output. Is there a specific part of the journal that I need to access?
% sudo journalctl -b
Sep 01 23:00:38 archlinux kernel: microcode: microcode updated early to revision 0x27, date = 2019-02-26
Sep 01 23:00:38 archlinux kernel: Linux version 5.2.1-arch1-1-ARCH (builduser@heftig-55221) (gcc version 9.1.0 (GCC)) #1 SMP PREEMPT Sun Jul 14 14:52:52 UTC 2019
Sep 01 23:00:38 archlinux kernel: Command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=262c5209-d942-4446-b66e-972ddefc8e70 rw audit=0 loglevel=3 quiet systemd.loglevel=debug
...
Sep 01 23:00:38 archlinux systemd[1]: systemd 242.32-3-arch running in system mode. (+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
Sep 01 23:00:38 archlinux systemd[1]: Detected architecture x86-64.
Sep 01 23:00:38 archlinux systemd[1]: Running in initial RAM disk.
Sep 01 23:00:38 archlinux systemd[1]: Initializing machine ID from random generator.
Sep 01 23:00:38 archlinux systemd[1]: Listening on Journal Socket (/dev/log).
Sep 01 23:00:38 archlinux systemd[1]: Listening on udev Control Socket.
Sep 01 23:00:38 archlinux systemd[1]: Condition check resulted in Journal Audit Socket being skipped.
Sep 01 23:00:38 archlinux systemd[1]: Reached target Swap.
Sep 01 23:00:38 archlinux systemd[1]: Reached target Timers.
Sep 01 23:00:38 archlinux systemd[1]: Reached target Slices.
Sep 01 23:00:38 archlinux kernel: Linux agpgart interface v0.103
Sep 01 23:00:38 archlinux kernel: Core dump to |/bin/false pipe failed
Sep 01 23:00:38 archlinux kernel: fbcon: Taking over console
Sep 01 23:00:38 archlinux kernel: Console: switching to colour frame buffer device 240x67
Sep 01 23:00:38 archlinux kernel: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
Sep 01 23:00:38 archlinux kernel: ehci-pci: EHCI PCI platform driver
Sep 01 23:00:38 archlinux kernel: ehci-pci 0000:00:1a.0: EHCI Host Controller
Sep 01 23:00:38 archlinux kernel: ehci-pci 0000:00:1a.0: new USB bus registered, assigned bus number 1
Sep 01 23:00:38 archlinux kernel: ehci-pci 0000:00:1a.0: debug port 2
Sep 01 23:00:38 archlinux kernel: ehci-pci 0000:00:1a.0: cache line size of 64 is not supported
Sep 01 23:00:38 archlinux kernel: ehci-pci 0000:00:1a.0: irq 16, io mem 0xf3138000
Sep 01 23:00:38 archlinux kernel: SCSI subsystem initialized
Sep 01 23:00:38 archlinux systemd-journald[217]: Journal started
Sep 01 23:00:38 archlinux systemd-journald[217]: Runtime journal (/run/log/journal/b8643a7beb174568955d464b68d242ab) is 8.0M, max 1.1G, 1.1G free.
Sep 01 23:00:38 archlinux systemd-modules-load[220]: Assertion 'err < 0' failed at ../systemd-stable/src/shared/module-util.c:56, function module_load_and_warn(). Aborting.
Sep 01 23:00:38 archlinux systemd[1]: Reached target System Initialization.
Sep 01 23:00:38 archlinux systemd[1]: Reached target Basic System.
...
Offline
I missed an underscore systemd.log_level=debug
Offline
Alright, this time it worked:
% sudo journalctl _PID=218 -b
-- Logs begin at Sat 2018-07-21 20:43:06 CEST, end at Sun 2019-09-01 23:41:55 CEST. --
Sep 01 23:33:11 archlinux systemd[218]: systemd-modules-load.service: Executing: /usr/lib/systemd/systemd-modules-load
Sep 01 23:33:11 archlinux systemd-modules-load[218]: apply: /etc/modules-load.d/MODULES.conf
Sep 01 23:33:11 archlinux systemd-modules-load[218]: Loading module: i915
Sep 01 23:33:11 archlinux systemd-modules-load[218]: Assertion 'err < 0' failed at ../systemd-stable/src/shared/module-util.c:56, function module_load_and_warn(). Aborting.
MODULES.conf does not exist. The problem can only be module i915. It is the intel graphics driver, which I don't need since I have a nvidia graphics card. However, I thought I had it disabled:
% cat /etc/modprobe.d/blacklist.conf
install i915 /usr/bin/false
install intel_agp /usr/bin/false
Offline
What is the contents of /etc/mkinitcpio.conf ?
Offline
That was it! The i915 module was loaded in mkinitcpio.conf. I noticed that I had a pacnew version of it laying around. Here is the diff to the old one:
% sudo colordiff -r -u mkinitcpio.conf.sav mkinitcpio.conf
--- mkinitcpio.conf.sav 2019-09-02 00:16:31.958162714 +0200
+++ mkinitcpio.conf 2019-05-23 19:10:15.000000000 +0200
@@ -3,20 +3,20 @@
# The following modules are loaded before any boot hooks are
# run. Advanced users may wish to specify all system modules
# in this array. For instance:
-# MODULES="piix ide_disk reiserfs"
-MODULES="i915"
+# MODULES=(piix ide_disk reiserfs)
+MODULES=()
# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image. This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
-BINARIES=""
+BINARIES=()
# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way. This is useful for config files.
-FILES=""
+FILES=()
# HOOKS
# This is the most important setting in this file. The HOOKS control the
@@ -30,26 +30,26 @@
# Examples:
## This setup specifies all modules in the MODULES setting above.
## No raid, lvm2, or encrypted root is needed.
-# HOOKS="base"
+# HOOKS=(base)
#
## This setup will autodetect all modules for your system and should
## work as a sane default
-# HOOKS="base udev autodetect block filesystems"
+# HOOKS=(base udev autodetect block filesystems)
#
## This setup will generate a 'full' image which supports most systems.
## No autodetection is done.
-# HOOKS="base udev block filesystems"
+# HOOKS=(base udev block filesystems)
#
## This setup assembles a pata mdadm array with an encrypted root FS.
## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
-# HOOKS="base udev block mdadm encrypt filesystems"
+# HOOKS=(base udev block mdadm encrypt filesystems)
#
## This setup loads an lvm2 volume group on a usb device.
-# HOOKS="base udev block lvm2 filesystems"
+# HOOKS=(base udev block lvm2 filesystems)
#
## NOTE: If you have /usr on a separate partition, you MUST include the
# usr, fsck and shutdown hooks.
-HOOKS="systemd autodetect modconf block filesystems keyboard fsck"
+HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
@@ -63,4 +63,4 @@
# COMPRESSION_OPTIONS
# Additional options for the compressor
-#COMPRESSION_OPTIONS=""
+#COMPRESSION_OPTIONS=()
After removing the i915, the error is gone. However, there is another change in the pacnew version. It is in the HOOKS section. Do you know if it is correct to replace systemd with base udev? Because I notice with this change I no longer get a startup log shown before the login screen. Beside from that it doesn't seem to have any other effect.
Offline
You can switch that back to the systemd hook if you want. You did actively switch that to systemd at some point, whether this or the other is better for you depends on your usecase.
Offline
Test code to try and reproduce the issue
#include <libkmod.h>
#include <stddef.h>
#include <stdio.h>
int main(void)
{
struct kmod_list *itr;
struct kmod_ctx *ctx = NULL;
struct kmod_list *modlist = NULL;
const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST;
const char *module = "i915";
int r = 0;
ctx = kmod_new(NULL, NULL);
if (!ctx)
return 1;
r = kmod_module_new_from_lookup(ctx, module, &modlist);
if (r < 0)
{
fprintf(stderr, "kmod_module_new_from_lookup returned %i\n",r);
return r;
}
if (!modlist)
{
fprintf(stderr, "modlist is empty\n");
return 2;
}
kmod_list_foreach(itr, modlist)
{
int state, err;
struct kmod_module *mod = NULL;
mod = kmod_module_get_module(itr);
state = kmod_module_get_initstate(mod);
switch (state)
{
case KMOD_MODULE_BUILTIN:
fprintf(stderr, "KMOD_MODULE_BUILTIN\n");
break;
case KMOD_MODULE_LIVE:
fprintf(stderr, "KMOD_MODULE_LIVE\n");
break;
default:
err = kmod_module_probe_insert_module(mod, probe_flags,NULL, NULL, NULL, NULL);
if (err == 0)
fprintf(stderr, "module loaded without error\n");
else if (err == KMOD_PROBE_APPLY_BLACKLIST)
fprintf(stderr, "KMOD_PROBE_APPLY_BLACKLIST\n");
else
{
if (err < 0)
{
fprintf(stderr, "The unexpected err code is %i\n",err);
return err;
}
else
fprintf(stderr, "The expected err code is %i\n",err);
}
}
}
return 0;
}
Build and run the test
gcc test.c -lkmod
./a.out
If /etc/modprobe.d/blacklist.conf still has the same contents does that produce an unexpected negative error code?
Offline
You can switch that back to the systemd hook if you want. You did actively switch that to systemd at some point, whether this or the other is better for you depends on your usecase.
I can't remember why I switched to systemd in the first place. Anyway, without loading the i915 module, the error is gone.
If /etc/modprobe.d/blacklist.conf still has the same contents does that produce an unexpected negative error code?
yes, error code is -1
Offline
From kmod v26 libkmod/libkmod-module.c
/**
* kmod_module_probe_insert_module:
* @mod: kmod module
* @flags: flags are not passed to Linux Kernel, but instead they dictate the
* behavior of this function, valid flags are
* KMOD_PROBE_FORCE_VERMAGIC: ignore kernel version magic;
* KMOD_PROBE_FORCE_MODVERSION: ignore symbol version hashes;
* KMOD_PROBE_IGNORE_COMMAND: whether the probe should ignore install
* commands and softdeps configured in the system;
* KMOD_PROBE_IGNORE_LOADED: do not check whether the module is already
* live in kernel or not;
* KMOD_PROBE_DRY_RUN: dry run, do not insert module, just call the
* associated callback function;
* KMOD_PROBE_FAIL_ON_LOADED: if KMOD_PROBE_IGNORE_LOADED is not specified
* and the module is already live in kernel, the function will fail if this
* flag is specified;
* KMOD_PROBE_APPLY_BLACKLIST_ALL: probe will apply KMOD_FILTER_BLACKLIST
* filter to this module and its dependencies. If any of the dependencies (or
* the module) is blacklisted, the probe will fail, unless the blacklisted
* module is already live in kernel;
* KMOD_PROBE_APPLY_BLACKLIST: probe will fail if the module is blacklisted;
* KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY: probe will fail if the module is an
* alias and is blacklisted.
* @extra_options: module's options to pass to Linux Kernel. It applies only
* to @mod, not to its dependencies.
* @run_install: function to run when @mod is backed by an install command.
* @data: data to give back to @run_install callback
* @print_action: function to call with the action being taken (install or
* insmod). It's useful for tools like modprobe when running with verbose
* output or in dry-run mode.
*
* Insert a module in Linux kernel resolving dependencies, soft dependencies,
* install commands and applying blacklist.
*
* If @run_install is NULL, this function will fork and exec by calling
* system(3). Don't pass a NULL argument in @run_install if your binary is
* setuid/setgid (see warning in system(3)). If you need control over the
* execution of an install command, give a callback function instead.
*
* Returns: 0 on success, > 0 if stopped by a reason given in @flags or < 0 on
* failure.
*/
KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
unsigned int flags, const char *extra_options,
int (*run_install)(struct kmod_module *m,
const char *cmd, void *data),
const void *data,
void (*print_action)(struct kmod_module *m,
bool install,
const char *options))
The systemd assert requires return > 0 with the flag KMOD_PROBE_APPLY_BLACKLIST when the install invocation fails the return code is minus the value returned by the install invocation.
/usr/bin/false returns 1 so kmod_module_probe_insert_module returns -1
If this is a bug depends on if systemd upstream intended such a case to fail that assert.
Last edited by loqs (2019-09-02 17:11:24)
Offline