Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 703934

Summary: sys-boot/grub with >=sys-kernel/genkernel-4.0.1 - grub-mkconfig ignores genkernel built initramfs since naming scheme changes
Product: Gentoo Hosted Projects Reporter: davidf4
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: RESOLVED FIXED    
Severity: normal CC: hydrapolic, tschweikle
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=704266
Whiteboard:
Package list:
Runtime testing required: ---

Description davidf4 2019-12-27 02:54:41 UTC
The kernel filename changes introduced in Genkernel 4.0.1 means that if you have multiple kernel files in /boot produced by the previous version then the newest kernel (4.0.1 output) will be found/put last when grub-mkconfig is run rather than at the top as the default kernel.

As a minimum this should have been a news item or other serious announcement of the output filename changes.



Reproducible: Always

Steps to Reproduce:
1. run 'genkernel all'
2. run grub-mkconfig -o /boot/grub/grub.cfg

Actual Results:  
Generating grub configuration file ...
Found linux image: /boot/kernel-genkernel-x86_64-4.19.82-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.82-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-4.19.72-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.72-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-4.19.66-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.66-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-4.19.44-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.44-gentoo
Found linux image: /boot/vmlinuz-4.19.86-gentoo-x86_64
Found initrd image: /boot/intel-uc.img /boot/initramfs-4.19.86-gentoo-x86_64.img
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
Found Windows 10 on /dev/sda1
done


Expected Results:  
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.86-gentoo-x86_64
Found initrd image: /boot/intel-uc.img /boot/initramfs-4.19.86-gentoo-x86_64.img
Found linux image: /boot/kernel-genkernel-x86_64-4.19.82-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.82-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-4.19.72-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.72-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-4.19.66-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.66-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-4.19.44-gentoo
Found initrd image: /boot/intel-uc.img /boot/initramfs-genkernel-x86_64-4.19.44-gentoo
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
Found Windows 10 on /dev/sda1
done
Comment 1 davidf4 2019-12-27 02:57:56 UTC
emerge --info
Portage 2.3.79 (python 3.6.9-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-9.2.0, glibc-2.29-r7, 4.19.82-gentoo x86_64)
=================================================================
System uname: Linux-4.19.82-gentoo-x86_64-Intel-R-_Core-TM-_i5-3210M_CPU_@_2.50GHz-with-gentoo-2.6
KiB Mem:     3924080 total,   1631040 free
KiB Swap:    6291452 total,   6229220 free
Timestamp of repository gentoo: Wed, 25 Dec 2019 00:00:02 +0000
Head commit of repository gentoo: 18ff09608f6c2a3af22d384e996b644b04427a2c
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
distcc 3.3.3 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17::gentoo, 3.6.9::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 berkdb bluetooth branding browser-integration bzip2 cairo cdda cdr classic cli consolekit cpudetect crypt cups cxx dbus declarative discover display-manager distcc dri dts dvd dvdr emboss encode exif f77 fam flac fontconfig fontforge fortran fuse gdbm gif graphicsmagick grub gtk iconv icu ipv6 java jpeg kde kdesu kipi kwallet lcms ldap legacy-systray libnotify libtirpc mad makeinfo mng motif mp3 mp4 mpeg multilib mysql ncurses networkmanager nls nptl nsplugin ntfs3g objc objc++ objc-gc offlinehelp ogg opengl openmp pam pango pcre pdf pdfinport pearl phonon plasma png policykit postscript ppds python qml qt5 readline sdl seccomp spell split-usr sqlite ssl startup-notification svg tcl tcpd texinfo tiff tk toolbar truetype udev udisks unicode upower usb vlc vorbis widgets wxwidgets x264 xattr xcb xcomposite xml xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="intel fbdev vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2019-12-27 14:28:41 UTC
Proposed news item: https://archives.gentoo.org/gentoo-dev/message/91f09183b737f0c8533ca5138da45215
Comment 4 davidf4 2019-12-28 02:49:24 UTC
(In reply to Thomas Deutschmann from comment #2)
> Well, there's an ewarn:
> https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-kernel/genkernel/
> genkernel-4.0.1.ebuild?id=e90880c8c28ee889d3ccb7317aa5ef16f3e376b2#n235

Thanks for the heads-up Thomas.  The machine that got upgraded first had over 400 different things (Perl + KDE) that the ewarn got lost in the noise..
Comment 5 davidf4 2019-12-28 02:49:47 UTC
One other thought...this may also mess with eclean-kernel...
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2019-12-30 15:14:58 UTC
Why do you believe that eclean-kernel should be affected? It supported both naming schemas. And the --num feature uses MTIME.
Comment 7 Larry the Git Cow gentoo-dev 2019-12-30 20:00:30 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/data/gentoo-news.git/commit/?id=b53539af13d77a7ad811327b677b9933e1dfb1b0

commit b53539af13d77a7ad811327b677b9933e1dfb1b0
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-12-30 19:57:43 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-12-30 19:57:43 +0000

    2019-12-30-genkernel-4-default-filenames: Add news item
    
    Bug: https://bugs.gentoo.org/703934
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 ...2019-12-30-genkernel-4-default-filenames.en.txt | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
Comment 8 davidf4 2019-12-31 02:45:27 UTC
(In reply to Thomas Deutschmann from comment #6)
> Why do you believe that eclean-kernel should be affected? It supported both
> naming schemas. And the --num feature uses MTIME.

Thomas, if that's the case then I withdraw my comment.  I hadn't tested it but assumed that eclean-kernel used the same case sensitive sort that grub was using.
Comment 9 Mikiya Okuno 2020-01-04 00:56:56 UTC
I face this bug, too. My temporary workaround is to set the following config in genkernel.conf:

KERNEL_FILENAME="kernel-genkernel-%%ARCH%%-%%KV%%"
INITRAMFS_FILENAME="initramfs-genkernel-%%ARCH%%-%%KV%%"

And to set the following command line option when executing genkernel:

--systemmap-filename="System.map-genkernel-%%ARCH%%-%%KV%%"

However, this setting causes extra architecture name at the end of file name. For example, kernel name becomes "kernel-genkernel-x86_64-4.19.86-gentoo-x86_64" instead of "kernel-genkernel-x86_64-4.19.86-gentoo". This works for grub, but is not beautiful.

So, I have three suggestions:

1. Introduce a new variable like $KV, but without architecture name.
2. Add a new parameter in genkernel.conf for a systemmap filename.
3. Add sample configuration parameters in genkernel.conf which generates compatible filenames.

BTW, changing defaults has very big impact in general, and should be avoided as much as possible, IMHO.

Kind regards,
Mikiya
Comment 10 Thomas Deutschmann (RETIRED) gentoo-dev 2020-01-04 01:49:13 UTC
(In reply to Mikiya Okuno from comment #9)
> I face this bug, too. My temporary workaround is to set the following config
> in genkernel.conf:
> 
> KERNEL_FILENAME="kernel-genkernel-%%ARCH%%-%%KV%%"
> INITRAMFS_FILENAME="initramfs-genkernel-%%ARCH%%-%%KV%%"
> 
> And to set the following command line option when executing genkernel:
> 
> --systemmap-filename="System.map-genkernel-%%ARCH%%-%%KV%%"
> 
> However, this setting causes extra architecture name at the end of file
> name. For example, kernel name becomes
> "kernel-genkernel-x86_64-4.19.86-gentoo-x86_64" instead of
> "kernel-genkernel-x86_64-4.19.86-gentoo". This works for grub, but is not
> beautiful.

Please read man page: Set --kernel-localversion='' and you will get rid of $ARCH at the end.


> So, I have three suggestions:
> [...]

This is not a bug.

We changed this on purpose. Old names were bad and common tools had to be adjusted to support this naming. New naming schema is in line with other distributions and most important, finally compatible with `uname -r`.

This will not go away.

I don't know how many kernels people keep around but all you have to do is migrate *old* kernels *once* (or clean them up) and be done. Renaming files in /boot shouldn't be a problem for anyone using Gentoo.


> BTW, changing defaults has very big impact in general, and should be avoided
> as much as possible, IMHO.

Note that genkernel-4 is a new major release.
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-09 10:14:19 UTC
*** Bug 705026 has been marked as a duplicate of this bug. ***