]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
modules-load: do not fail service if modules are not present
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 27 Oct 2019 09:00:31 +0000 (10:00 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 28 Oct 2019 13:55:36 +0000 (22:55 +0900)
It is pretty common for the service to fail in the initramfs (for example
because certain modules have not been copied over or haven't been built yet in
case of dkms modules). This seems to be more trouble than it is worth. Let's
change the service to simply log any missing modules at error level, but not
fail the whole service.

https://bugzilla.redhat.com/show_bug.cgi?id=1254340

src/modules-load/modules-load.c

index 36bda3433ff39ba8dd28f103b3779cbfacbddabb..7797f36d44916ddc44c71130f4204ba27eff370d 100644 (file)
@@ -96,6 +96,8 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
                         continue;
 
                 k = module_load_and_warn(ctx, l, true);
+                if (k == -ENOENT)
+                        continue;
                 if (k < 0 && r >= 0)
                         r = k;
         }
@@ -124,7 +126,6 @@ static int help(void) {
 }
 
 static int parse_argv(int argc, char *argv[]) {
-
         enum {
                 ARG_VERSION = 0x100,
         };
@@ -141,7 +142,6 @@ static int parse_argv(int argc, char *argv[]) {
         assert(argv);
 
         while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
-
                 switch (c) {
 
                 case 'h':
@@ -202,6 +202,8 @@ static int run(int argc, char *argv[]) {
 
                 STRV_FOREACH(i, arg_proc_cmdline_modules) {
                         k = module_load_and_warn(ctx, *i, true);
+                        if (k == -ENOENT)
+                                continue;
                         if (k < 0 && r == 0)
                                 r = k;
                 }