]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: Also display the root for entry paths
authorJan Janssen <medhefgo@web.de>
Sat, 3 Sep 2022 21:07:44 +0000 (23:07 +0200)
committerJan Janssen <medhefgo@web.de>
Wed, 12 Oct 2022 13:11:14 +0000 (15:11 +0200)
People apparently expect the bootloader to magically know the userspace
filesystem tree and get confused when boot files aren't found because of
this. Printing the root of entry paths will hopefully make it easier for
people to understand a bad configuration.

To hopefully make it clear that the prefix should not be used inside of
a config snipped, it is greyed out and uses an extra path separator:
    <gray>/root/</gray>/boot/loader/path

src/shared/bootspec.c

index 6a34b10c044c3c403e9295d5fcaf962cacde7399..b88d42fdc183515fe9f5381d6c81fa47d814c849 100644 (file)
@@ -726,7 +726,7 @@ static int boot_entry_load_unified(
         if (!tmp.root)
                 return log_oom();
 
-        tmp.kernel = strdup(skip_leading_chars(k, "/"));
+        tmp.kernel = path_make_absolute(k, "/");
         if (!tmp.kernel)
                 return log_oom();
 
@@ -1278,7 +1278,11 @@ static void boot_entry_file_list(
 
         int status = chase_symlinks_and_access(p, root, CHASE_PREFIX_ROOT, F_OK, NULL, NULL);
 
-        printf("%13s%s ", strempty(field), field ? ":" : " ");
+        /* Note that this shows two '/' between the root and the file. This is intentional to highlight (in
+         * the abscence of color support) to the user that the boot loader is only interested in the second
+         * part of the file. */
+        printf("%13s%s %s%s/%s", strempty(field), field ? ":" : " ", ansi_grey(), root, ansi_normal());
+
         if (status < 0) {
                 errno = -status;
                 printf("%s%s%s (%m)\n", ansi_highlight_red(), p, ansi_normal());