Skip to content

Commit

Permalink
kernel: Specify multiple kernel or initramfs in error message
Browse files Browse the repository at this point in the history
It sometimes happens during osbuild that there are two kernel rpms
installed while setting up the initial error message, leading to
something like:

error: Finalizing rootfs: During kernel processing: Multiple vmlinuz- in usr/lib/ostree-boot

With the user unsure what the two kernel versions were. With this change
we print the kernel versions.
  • Loading branch information
ericcurtin authored and cgwalters committed Jul 10, 2023
1 parent 16abbba commit 8886407
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libpriv/rpmostree-kernel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ find_kernel_and_initramfs_in_bootdir (int rootfs_dfd, const char *bootdir, char
if (out_ksuffix ? g_str_has_prefix (name, "vmlinuz-") : g_str_equal (name, "vmlinuz"))
{
if (ret_kernel)
return glnx_throw (error, "Multiple vmlinuz%s in %s", out_ksuffix ? "-" : "", bootdir);
return glnx_throw (error, "Multiple vmlinuz%s in %s, occurrences '%s' and '%s/%s'",
out_ksuffix ? "-" : "", bootdir, ret_kernel, bootdir, name);
if (out_ksuffix)
ret_ksuffix = g_strdup (name + strlen ("vmlinuz-"));
ret_kernel = g_strconcat (bootdir, "/", name, NULL);
}
else if (g_str_equal (name, "initramfs.img") || g_str_has_prefix (name, "initramfs-"))
{
if (ret_initramfs)
return glnx_throw (error, "Multiple initramfs- in %s", bootdir);
return glnx_throw (error, "Multiple initramfs- in %s, occurrences '%s' and '%s/%s'",
bootdir, ret_initramfs, bootdir, name);
ret_initramfs = g_strconcat (bootdir, "/", name, NULL);
}
}
Expand Down

0 comments on commit 8886407

Please sign in to comment.