Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 658436 - sys-kernel/genkernel-3.5.3.3 fails to generate grub entry if LVM fstab devnam for /boot. (EFI)
Summary: sys-kernel/genkernel-3.5.3.3 fails to generate grub entry if LVM fstab devnam...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal critical
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-18 20:10 UTC by Nico Baggus
Modified: 2018-06-24 22:01 UTC (History)
2 users (show)

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


Attachments
genkernel.conf (genkernel.conf,9.78 KB, text/plain)
2018-06-23 07:37 UTC, Nico Baggus
Details
genkernel.log (genkernel.log.gz,68.86 KB, application/octet-stream)
2018-06-23 07:41 UTC, Nico Baggus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Baggus 2018-06-18 20:10:58 UTC
genkernel fails with:

* Adding kernel to /boot/grub/grub.conf...
* No /boot/grub/grub.conf found, generating!
awk: fatal: cannot open file `/var/tmp/genkernel/26701.6836.18011.23096/grub.map' for reading (No such file or directory)
/usr/share/genkernel/gen_bootloader.sh: line 78: 1/boot - 1: division by 0 (error token is "boot - 1")

* WARNING... WARNING... WARNING...
* Additional kernel cmdline arguments that *may* be required to boot properly...


when fstab entry holds:
/dev/vg1/boot                   /boot                   ext2            defaults,nodev,nosuid,noexec    1 2


On EFI systems the setup created:  (done in January)

/boot/EFI/boot/grub/grub.cfg with:
set prefix=(lvm/vg1-boot)/grub
set root=(lvm/vg1-boot)
source ${prefix}/grub.cfg

Offending lines:
        GRUB_BOOTFS=$(set_bootloader_read_fstab | cut -d' ' -f2)
        local GRUB_BOOT_PARTITION=$(($(echo ${GRUB_BOOTFS} | sed -e 's#/dev/.\+\([[:digit:]]?*\)#\1#') - 1))

It needs something better.... on a GPT filesystem this partition is needed:
   1            2048          616447   300.0 MiB   EF02  BIOS boot partition
Comment 1 Nico Baggus 2018-06-18 22:36:15 UTC
Lv table:

  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
  LV      VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  boot    vg1  -wi-ao---- 200,00m                                                    
  data    vg1  -wi-ao---- 150,00g                                                    
  home    vg1  -wi-ao----  10,00g                                                    
  root    vg1  -wi-ao----  50,00g                                                    
  var     vg1  -wi-ao----  10,00g                                                    

resulting in:
# ls -l /dev/vg1/
total 0
lrwxrwxrwx 1 root root 20 28 apr 01:07 boot -> /dev/mapper/vg1-boot
lrwxrwxrwx 1 root root 20 28 apr 01:07 data -> /dev/mapper/vg1-data
lrwxrwxrwx 1 root root 20 28 apr 01:07 home -> /dev/mapper/vg1-home
lrwxrwxrwx 1 root root 20 28 apr 01:07 root -> /dev/mapper/vg1-root
lrwxrwxrwx 1 root root 19 28 apr 01:07 var -> /dev/mapper/vg1-var

# ls -l /dev/mapper
total 0
crw------- 1 root root  10, 236  6 jun 01:01 control
brw------- 1 root root 253,   0 28 apr 01:07 vg1-boot
brw------- 1 root root 253,   3 27 apr 23:07 vg1-data
brw------- 1 root root 253,   5 27 apr 23:07 vg1-home
brw------- 1 root root 253,   1 28 apr 01:07 vg1-root
brw------- 1 root root 253,   2 27 apr 23:07 vg1-var

# df
Filesystem              1K-blocks     Used Available Use% Mounted on
udev                        10240        4     10236   1% /dev
/dev/mapper/vg1-root     51474912 12166032  36671056  25% /
tmpfs                      740316     1920    738396   1% /run
shm                       3701580    26896   3674684   1% /dev/shm
cgroup_root                 10240        0     10240   0% /sys/fs/cgroup
/dev/mapper/vg1-boot       198337    88570     99527  48% /boot
/dev/mapper/vg1-var      10190100  8417608   1231820  88% /var
/dev/mapper/vg1-data    154686928 70329844  76476380  48% /data
/dev/mapper/vg1-home     10255636  1199712   8515252  13% /home
/dev/md1                   306520      336    306184   1% /boot/ESP
tmpfs                      740316        0    740316   0% /run/user/2000

/boot/ESP is the EFI (EF02 boot partition).
grub is installed in /boot


(oh this is also a system without systemd if it matters).
Comment 2 Nico Baggus 2018-06-18 23:31:50 UTC
Another observation:

this genkernel is looking for /boot/grub/grub.conf
while AFAIK grub2 is using /boot/grub/grub.cfg
(grub.cfg is existing on the /boot/grub directory, /boot/grub/grub.conf is not).

I have another system that might work by accident...

/dev/sda1 & /dev/sdb1 are a mirrored pair of disk named /dev/md1....
in this case the numbering fits., when booted from CD these volumes mostly are called something else (/dev/md254 or something near that..) 
that obviously won't match the logic for partition finding while the arithmatic expression would succeed.
Comment 3 Nico Baggus 2018-06-18 23:39:18 UTC
further reading of the code revealed a grub.map is used, where the file is called device.map in the existing /boot/grub directory.

I have a feeling of fundamental things radically changed without a lot of noise about the changes. This might break more installations.
Comment 4 Nico Baggus 2018-06-18 23:48:22 UTC
This genkernel version also has some issues with patching sources:

* busybox: >> Applying patches...
patching file console-tools/openvt.c
Hunk #1 succeeded at 147 (offset 23 lines).
*           - 1.18.1-openvt.diff
patching file modutils/modprobe.c
Hunk #1 succeeded at 444 (offset 31 lines).
Hunk #2 succeeded at 492 (offset 32 lines).
*           - busybox-1.20.2-modprobe.patch
patching file util-linux/mdStart.c
*           - busybox-1.26.0-mdstart.patch
patching file libbb/u_signal_names.c
Hunk #1 succeeded at 76 (offset 10 lines).
Hunk #2 succeeded at 100 (offset 10 lines).
*           - busybox-1.7.4-signal-hack.patch
* busybox: >> Configuring...
* busybox: >> Compiling...
* busybox: >> Copying to cache...
* initramfs: >> Initializing...
*         >> Appending devices cpio data...
*         >> Appending base_layout cpio data...
*         >> Appending auxilary cpio data...
*         >> Copying keymaps
*         >> Appending busybox cpio data...
*         >> Appending e2fsprogs cpio data...
*         >> Appending lvm cpio data...
*           LVM: Adding support (compiling binaries)...
* lvm: >> Patching ...
* lvm: >> Applying patches...
patching file configure.in
Hunk #1 succeeded at 32 (offset 1 line).
Hunk #2 succeeded at 2129 (offset 119 lines).
patching file daemons/dmeventd/Makefile.in
Hunk #1 succeeded at 66 (offset -1 lines).
patching file make.tmpl.in
Hunk #1 succeeded at 58 (offset 9 lines).
patching file tools/Makefile.in
Hunk #1 succeeded at 133 (offset 4 lines).
Hunk #2 succeeded at 160 (offset 14 lines).
*           - lvm2-2.02.139-dynamic-static-ldflags.patch
* lvm: >> Autoconf ...
* lvm: >> Configuring...
* lvm: >> Compiling...
* lvm: >> Installing to DESTDIR...
*       >> Copying to bincache...
*         >> Appending luks cpio data...
* Including LUKS support
*         >> Appending modules cpio data...
*         >> Appending blkid cpio data...
*         >> Appending modprobed cpio data...
*         >> Appending linker cpio data...
*         >> Deduping cpio...
*         >> Compressing cpio data (.xz)...

* WARNING... WARNING... WARNING...
* Additional kernel cmdline arguments that *may* be required to boot properly...
* add "dolvm" for lvm support
* With support for several ext* filesystems available, it may be needed to
* add "rootfstype=ext3" or "rootfstype=ext4" to the list of boot parameters.

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
* 
* Make sure you have the latest ~arch genkernel before reporting bugs.

* RUNNING FINAL CACHE/TMP CLEANUP
* CACHE_DIR: /var/cache/genkernel
* Clearing cache dir contents from /var/cache/genkernel
*        >> removing /var/cache/genkernel/3.5.3.3/LVM2.2.02.173-x86_64.tar.bz2
*        >> removing /var/cache/genkernel/3.5.3.3/busybox-1.27.2-x86_64.tar.bz2

* TMPDIR: /var/tmp/genkernel
* Removing tmp dir contents
*        >> removing initramfs-4.14.49-gentoo
Comment 5 Ben Kohler gentoo-dev 2018-06-22 11:17:33 UTC
You need to set BOOTLOADER="grub2" for grub2, BOOTLOADER="grub" is for grub legacy (0.97)
Comment 6 Nico Baggus 2018-06-22 19:40:44 UTC
The line in genkernel.conf was

#BOOTLOADER="grub"

ie. it was unconfigured.
Comment 7 Ben Kohler gentoo-dev 2018-06-22 20:55:20 UTC
Can you share your complete genkernel.log and genkernel.conf?
Comment 8 Nico Baggus 2018-06-23 07:36:16 UTC
After adding BOOT_LOADER=grub2
the genkernel does work with out errors except it doesn't update the grub.cfg

I will create upload the logs...

Console output:

# genkernel initramfs            
* Gentoo Linux Genkernel; Version 3.5.3.3
* Running with options: initramfs

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..
* Linux Kernel 4.14.49-gentoo for x86_64...
* .. with config file /etc/kernels/kernel-config-x86_64-4.14.49-gentoo

* Preparing to run callback: "emerge --quiet @module-rebuild".....

>>> Verifying ebuild manifests
>>> Emerging (1 of 2) app-emulation/virtualbox-modules-5.1.36::gentoo
>>> Installing (1 of 2) app-emulation/virtualbox-modules-5.1.36::gentoo
>>> Emerging (2 of 2) net-firewall/xtables-addons-2.13::gentoo
>>> Installing (2 of 2) net-firewall/xtables-addons-2.13::gentoo

!!! existing preserved libs found

* <<< Callback exit status: 0

* busybox: >> Applying patches...
patching file console-tools/openvt.c
Hunk #1 succeeded at 147 (offset 23 lines).
*           - 1.18.1-openvt.diff
patching file modutils/modprobe.c
Hunk #1 succeeded at 444 (offset 31 lines).
Hunk #2 succeeded at 492 (offset 32 lines).
*           - busybox-1.20.2-modprobe.patch
patching file util-linux/mdStart.c
*           - busybox-1.26.0-mdstart.patch
patching file libbb/u_signal_names.c
Hunk #1 succeeded at 76 (offset 10 lines).
Hunk #2 succeeded at 100 (offset 10 lines).
*           - busybox-1.7.4-signal-hack.patch
* busybox: >> Configuring...
* busybox: >> Compiling...
* busybox: >> Copying to cache...
* initramfs: >> Initializing...
*         >> Appending devices cpio data...
*         >> Appending base_layout cpio data...
*         >> Appending auxilary cpio data...
*         >> Copying keymaps
*         >> Appending busybox cpio data...
*         >> Appending e2fsprogs cpio data...
*         >> Appending lvm cpio data...
*           LVM: Adding support (compiling binaries)...
* lvm: >> Patching ...
* lvm: >> Applying patches...
patching file configure.in
Hunk #1 succeeded at 32 (offset 1 line).
Hunk #2 succeeded at 2129 (offset 119 lines).
patching file daemons/dmeventd/Makefile.in
Hunk #1 succeeded at 66 (offset -1 lines).
patching file make.tmpl.in
Hunk #1 succeeded at 58 (offset 9 lines).
patching file tools/Makefile.in
Hunk #1 succeeded at 133 (offset 4 lines).
Hunk #2 succeeded at 160 (offset 14 lines).
*           - lvm2-2.02.139-dynamic-static-ldflags.patch
* lvm: >> Autoconf ...
* lvm: >> Configuring...
* lvm: >> Compiling...
* lvm: >> Installing to DESTDIR...
*       >> Copying to bincache...
*         >> Appending luks cpio data...
* Including LUKS support
*         >> Appending modules cpio data...
*         >> Appending blkid cpio data...
*         >> Appending modprobed cpio data...
*         >> Appending linker cpio data...
*         >> Deduping cpio...
*         >> Compressing cpio data (.xz)...

* WARNING... WARNING... WARNING...
* Additional kernel cmdline arguments that *may* be required to boot properly...
* add "dolvm" for lvm support
* With support for several ext* filesystems available, it may be needed to
* add "rootfstype=ext3" or "rootfstype=ext4" to the list of boot parameters.

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
* 
* Make sure you have the latest ~arch genkernel before reporting bugs.

* RUNNING FINAL CACHE/TMP CLEANUP
* CACHE_DIR: /var/cache/genkernel
* Clearing cache dir contents from /var/cache/genkernel
*        >> removing /var/cache/genkernel/3.5.3.3/LVM2.2.02.173-x86_64.tar.bz2
*        >> removing /var/cache/genkernel/3.5.3.3/busybox-1.27.2-x86_64.tar.bz2

* TMPDIR: /var/tmp/genkernel
* Removing tmp dir contents
*        >> removing initramfs-4.14.49-gentoo
laptop-6 /var/log # grep kernel /boot/grub/grub.cfg
grub.cfg       grub.cfg.orig  
laptop-6 /var/log # grep kernel /boot/grub/grub.cfg
        linux   /kernel-genkernel-x86_64-4.14.29-gentoo root=/dev/mapper/root ro root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1 
        initrd  /initramfs-genkernel-x86_64-4.14.29-gentoo
        linux   /kernel-genkernel-x86_64-4.14.29-gentoo root=/dev/mapper/root ro single root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1
        initrd  /initramfs-genkernel-x86_64-4.14.29-gentoo
        linux   /kernel-genkernel-x86_64-4.14.12-gentoo root=/dev/mapper/root ro root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1 
        initrd  /initramfs-genkernel-x86_64-4.14.12-gentoo
        linux   /kernel-genkernel-x86_64-4.14.12-gentoo root=/dev/mapper/root ro single root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1
        initrd  /initramfs-genkernel-x86_64-4.14.12-gentoo
        linux   /kernel-genkernel-x86_64-4.14.8-gentoo-r1 root=/dev/mapper/root ro root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1 
        initrd  /initramfs-genkernel-x86_64-4.14.8-gentoo-r1
        linux   /kernel-genkernel-x86_64-4.14.8-gentoo-r1 root=/dev/mapper/root ro single root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1
        initrd  /initramfs-genkernel-x86_64-4.14.8-gentoo-r1
        linux   /kernel-genkernel-x86_64-4.14.7-gentoo root=/dev/mapper/root ro root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1 
        initrd  /initramfs-genkernel-x86_64-4.14.7-gentoo
        linux   /kernel-genkernel-x86_64-4.14.7-gentoo root=/dev/mapper/root ro single root=/dev/ram0 rw crypt_root=/dev/mapper/Disk1-croot ramdisk=12288 scandelay=2 dolvm rootfstype=ext4 i8042.nopnp i8042.nomux=1 i8042.reset processor.ignore_ppc=1 radeon.bapm=1
        initrd  /initramfs-genkernel-x86_64-4.14.7-gentoo
Comment 9 Nico Baggus 2018-06-23 07:37:57 UTC
Created attachment 536882 [details]
genkernel.conf

In this version the bootloader is set to grub2...
Comment 10 Nico Baggus 2018-06-23 07:41:23 UTC
Created attachment 536884 [details]
genkernel.log

Build with BOOT_LOADER=grub2

gziped (file was 20K too large).
Comment 11 Ben Kohler gentoo-dev 2018-06-23 17:13:16 UTC
So, that's a log from a successful build, isn't it?
Comment 12 Nico Baggus 2018-06-24 12:43:53 UTC
yes.  
Except that kernel version ...49 is NOT in /boot/grub/grub.cfg
Comment 13 Nico Baggus 2018-06-24 22:01:17 UTC
I cannot reproduce this any more.

The problems might have occurred before any successfull run of genkernel.
I will close the issue