Description of problem: Calling grubby with --default-kernel results in a segfault on a Calxada Highbank (ARM) system. This system uses uboot. # grubby --default-kernel grubby received SIGSEGV! Backtrace (0): # strace grubby --default-kernel ... open("/etc/popt", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) stat64("/etc/popt.d", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 openat(AT_FDCWD, "/etc/popt.d", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC) getdents64(3, /* 2 entries */, 32768) = 48 getdents64(3, /* 0 entries */, 32768) = 0 close(3) = 0 open("/root/.popt", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) access("/etc/grub2-efi.cfg", R_OK) = -1 ENOENT (No such file or directory) access("/etc/grub2.cfg", R_OK) = -1 ENOENT (No such file or directory) access("/etc/grub.d/", R_OK) = -1 ENOENT (No such file or directory) access("/boot/grub/menu.lst", R_OK) = -1 ENOENT (No such file or directory) access("/etc/grub.conf", R_OK) = -1 ENOENT (No such file or directory) stat64("/", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0 stat64("/boot", {st_mode=S_IFDIR|0555, st_size=1024, ...}) = 0 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} --- rt_sigaction(SIGSEGV, {SIG_DFL, [SEGV], SA_RESTART|0x4000000}, {0xc9a8, [SEGV], SA_RESTART|0x4000000}, 8) = 0 write(2, "grubby received SIGSEGV! Backtr"..., 41grubby received SIGSEGV! Backtrace (0): ) = 41 exit_group(1) = ? +++ exited with 1 +++ # (gdb) run --default-kernel Starting program: /usr/sbin/grubby --default-kernel Program received signal SIGSEGV, Segmentation fault. main (argc=0, argv=0xbeffede0) at grubby.c:4144 4144 config = readConfig(grubConfig, cfi); Missing separate debuginfos, use: debuginfo-install libblkid-2.22.2-3.fc18.armv7hl libgcc-4.7.2-8.fc18.armv7hl libuuid-2.22.2-3.fc18.armv7hl (gdb) bt #0 main (argc=0, argv=0xbeffede0) at grubby.c:4144 (gdb) Version-Release number of selected component (if applicable): grubby-8.22-1.fc18.armv7hl How reproducible: Every time. Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Currently, ARM-based systems use the U-Boot bootloader, and not one of the bootloaders supported by grubby (GRUB, lilo, elilo, yaboot or zipl). While the new-kernel-pkg script has been modified to install U-Boot kernel images, the grubby tool is not U-Boot aware, so while I agree it should not segfault, it will not be able to return the default kernel, or probably any other information typically stored in the supported bootloader configuration files. Perhaps grubby could be modified to check for one of the supported bootloader configuration files when run, and exit with an "Unsupported" message if none are found. This would avoid issues on ARM systems using U-Boot, or any other unsupported bootloaders it might encounter in the future.
(In reply to comment #1) > Perhaps grubby could be modified to check for one of the supported > bootloader configuration files when run, and exit with an "Unsupported" > message if none are found. This would avoid issues on ARM systems using > U-Boot, or any other unsupported bootloaders it might encounter in the > future. I agree with this approach.
The problem is line 4144: config = readConfig(grubConfig, cfi); 'grubConfig' is null. Evidence: (gdb) break 4143 Breakpoint 1 at 0xa744: file grubby.c, line 4143. (gdb) run --default-kernel Starting program: /usr/sbin/grubby --default-kernel Breakpoint 1, main (argc=0, argv=0xbefff110) at grubby.c:4144 4144 config = readConfig(grubConfig, cfi); (gdb) step readConfig (cfi=0x0, inName=0x0) at grubby.c:956 956 if (!strcmp(inName, "-")) { (gdb) step Program received signal SIGSEGV, Segmentation fault. Seems like a trivial fix unless there is a sane thing to be done in the absence of a grubConfig.
Created attachment 705760 [details] Simple patch to error out instead of segfaulting
This is fixed in grubby-8.25-1
This message is a reminder that Fedora 18 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 18. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '18'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 18's end of life. Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 18 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 18's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.