Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 689060 - genkernel 3.5.3.3 not running grub correctly to add new kernels
Summary: genkernel 3.5.3.3 not running grub correctly to add new kernels
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-01 07:27 UTC by Mark G. Woodruff
Modified: 2019-07-01 23:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Steps to reproduce (steps-to-reproduce.txt,15.71 KB, text/plain)
2019-07-01 07:27 UTC, Mark G. Woodruff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark G. Woodruff 2019-07-01 07:27:22 UTC
Created attachment 581588 [details]
Steps to reproduce

genkernel consistently fails to add a new kernel to /boot/grub/grub.cfg with the following messages:

* Adding kernel to /boot/grub/grub.conf...
* No /boot/grub/grub.conf found, generating!
awk: fatal: cannot open file `/var/tmp/genkernel/14909.13079.25425.58967/grub.map' for reading (No such file or directory)
* Error! /boot/grub/grub.conf does not exist and the correct settings can not be automatically detected.
* Please manually create your /boot/grub/grub.conf file.

The problem seems to be in /usr/share/genkernel/gen_bootloader.sh around line 78 in set_bootloader_grub():
------------
set_bootloader_grub() {
        local GRUB_CONF="${BOOTDIR}/grub/grub.conf"

        print_info 1 "Adding kernel to ${GRUB_CONF}..."

        if [ ! -e ${GRUB_CONF} ]
        then
                print_warning 1 "No ${GRUB_CONF} found, generating!"
                local GRUB_BOOTFS
                if [ -n "${BOOTFS}" ]
                then
                        GRUB_BOOTFS=$BOOTFS
                else
                        GRUB_BOOTFS=$(set_bootloader_read_fstab | cut -d' ' -f2)
                fi

                # Get the GRUB mapping for our device
                local GRUB_BOOT_DISK1=$(echo ${GRUB_BOOTFS} | sed -e 's#\(/dev/.\+\)[[:digit:]]\+#\1#')
                local GRUB_BOOT_DISK=$(awk '{if ($2 == "'${GRUB_BOOT_DISK1}'") {gsub(/(\(|\))/, "", $1); print $1;}}' ${TEMP}/grub.map)
                local GRUB_BOOT_PARTITION=$(($(echo ${GRUB_BOOTFS} | sed -e 's#/dev/.\+\([[:digit:]]?*\)#\1#') - 1))
------------
It's failing to parse the /etc/fstab correctly, both when /boot is mounted as a device and via a UUID. Fails regardless of filesystem /boot is formatted.

Workaround is to run grub-mkconfig -o /boot/grub/grub.cfg after genkernel every time.

It can be reproduced every time if you create a dummy /boot partition. See attachment.
Comment 1 Brian Evans (RETIRED) gentoo-dev 2019-07-01 12:54:46 UTC
(In reply to Mark G. Woodruff from comment #0)
> Created attachment 581588 [details]
> Steps to reproduce
> 
> genkernel consistently fails to add a new kernel to /boot/grub/grub.cfg with
> the following messages:
> 
> * Adding kernel to /boot/grub/grub.conf...
> * No /boot/grub/grub.conf found, generating!


grub.cfg is grub2 while grub.conf is grub-legacy

Apparently, you've set BOOTLOADER=grub instead of BOOTLOADER=grub2 in genkernel.conf.  Please fix that.
Comment 2 Mark G. Woodruff 2019-07-01 23:25:15 UTC
That was it! Thanks.