Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 188866 - sys-kernel/genkernel writes to wrong /etc/kernels/kernel-config-* file
Summary: sys-kernel/genkernel writes to wrong /etc/kernels/kernel-config-* file
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-14 17:43 UTC by Rich Gannon
Modified: 2007-08-15 17:44 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Gannon 2007-08-14 17:43:58 UTC
Since gentoo-sources-2.6.22-r2 was marked as stable in x86, I upgraded 5 up to date x86 Gentoo systems today.  I know they're as up to date as they get as I did an emerge -e world (and updated all deep deps listed in query list) on all of them over the weekend after the new expat release.

The issue at hand is that on all of the systems, the kernel config was loaded from /etc/kernels/kernel-config-x86-2.6.21-gentoo-r4 (the last stable kernel installed) in menuconfig (using genkernel --menuconfig all).  After configuring the few new options, the kernel compilation took longer than expected.  I then realized that the kernel config was written to the same file the config was imported from.  The kernel that was compiled was not at all what I had configured it for.  Everything was at its default setting.

The only fix was to move /etc/kernels/kernel-config-x86-2.6.21-gentoo-r4 to /etc/kernel/kernel-config-x86-2.6.22-gentoo-r2 after the original compilation was saved to the incorrect file.

Reproducible: Always

Steps to Reproduce:
1. genkernel --menuconfig all
2. Load an Alternate Configuration File Config > /etc/kernels/kernel-config-x86-2.6.21-gentoo-r4
3. Exit menuconfig (genkernel compiles)

Actual Results:  
Incorrect kernel configuration used.

Expected Results:  
New kernel configuration used.

rich@area51 ~ $ emerge --info
Portage 2.1.2.11 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.5-r4, 2.6.21-gentoo-r4 i686)
=================================================================
System uname: 2.6.21-gentoo-r4 i686 Intel(R) Pentium(R) D CPU 3.20GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Tue, 14 Aug 2007 16:30:11 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=prescott -msse3 -mfpmath=sse -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -march=prescott -msse3 -mfpmath=sse -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LINGUAS="en"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var"
PORTDIR="/usr/portage"
SYNC="rsync://supernova/gentoo-portage"
USE="X a52 aac acl acpi aim alsa amarok arts asf berkdb bitmap-fonts cdr cli cracklib crypt cups dbus dri dts dvd dvdr dvdread emerald esd fam ffmpeg firefox foomaticdb fortran gdbm gif glibc-omitfp glitz gpm gtk gtk2 hal iconv isdnlog java javascript jpeg kde kdeenablefinal lm_sensors logitech-mouse mad midi mmx mmxext moznopango mp3 mpeg mplayer mudflap ncurses nls nptl nptlonly nsplugin nvidia offensive old-linux openal opengl openmp oss pam pcre pdf perl png ppds pppd python qt qt3 quicktime rdesktop readline real reflection samba scanner sdk sdl session smp spl sse sse2 sse3 ssl svg symlink tcpd tiff truetype truetype-fonts type1-fonts unicode usb v4l vidix win32codecs x86 xine xinerama xorg xpm xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="joystick keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="nvidia vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

rich@area51 ~ $ equery list genkernel
[ Searching for package 'genkernel' in all categories among: ]
 * installed packages
[I--] [  ] sys-kernel/genkernel-3.4.8 (0)
rich@area51 ~ $ equery list gentoo-sources
[ Searching for package 'gentoo-sources' in all categories among: ]
 * installed packages
[I--] [  ] sys-kernel/gentoo-sources-2.6.21-r4 (2.6.21-r4)
[I--] [  ] sys-kernel/gentoo-sources-2.6.22-r2 (2.6.22-r2)
rich@area51 ~ $ ls -lh /usr/src/linux
lrwxrwxrwx 1 root root 22 Aug 14 13:01 /usr/src/linux -> linux-2.6.22-gentoo-r2
Comment 1 Andrew Gaffney (RETIRED) gentoo-dev 2007-08-15 02:11:26 UTC
What directory does /usr/src/linux point to?
Comment 2 Rich Gannon 2007-08-15 02:30:50 UTC
As stated at the very bottom of the big info:

rich@area51 ~ $ ls -lh /usr/src/linux
lrwxrwxrwx 1 root root 22 Aug 14 13:01 /usr/src/linux -> linux-2.6.22-gentoo-r2
Comment 3 Andrew Gaffney (RETIRED) gentoo-dev 2007-08-15 12:23:12 UTC
Sorry, I missed that since it was shoved together with a bunch of other info. What was the exact command you ran for genkernel? Was it just 'genkernel --menuconfig all'?
Comment 4 Rich Gannon 2007-08-15 15:32:55 UTC
Yes it was just `genkernel --menuconfig all`.  I also noticed that it saved the configuration to the same genkernel config file in /etc/kernels it loaded instead of .config and that is why it used the defaults in .config.
Comment 5 Andrew Gaffney (RETIRED) gentoo-dev 2007-08-15 15:40:32 UTC
So, the real issue here is that genkernel just needs to copy the saved config file from /etc/kernels/ to /usr/src/linux/.config before running menuconfig? Or am I missing something else?

Your description was a little bit confusing. It seems like you're saying that it's pulling the config for your existing kernel from /etc/kernels/ to configure your new kernel of a different version. From what I can see of the genkernel code, that's just not possible unless you specifically point genkernel at it. Did you set DEFAULT_KERNEL_CONFIG in /etc/genkernel.conf?
Comment 6 Chris Gianelloni (RETIRED) gentoo-dev 2007-08-15 17:34:57 UTC
This is actually a problem in the way you're doing things.  See, when you tell the kernel (via menuconfig) to load an alternate config, it will load it.  When you tell it to save, it'll save to that alternate config location.  This is *not* genkernel, this is the upstream kernel doing this.  Now, genkernel is completely unaware of this, so it sees that there is no config, and uses the shipped defaults.  To accomplish what you're looking to do, use:

genkernel --kernel-config=/path/to/file --menuconfig all

This will cause genkernel to use /path/to/file as input/defaults for menuconfig, then it'll run menuconfig, where you can make any necessary changes, then when you save, it'll be saved to the local .config in /usr/src/linux and also copied to /etc/kernels under the right name.
Comment 7 Rich Gannon 2007-08-15 17:42:20 UTC
Sorry if I'm not the most clear in this...I don't do run into bugs often :)

I'll try to run through what I did as best I can.  And this happened on 5 2007.0 Gentoo boxes so it's not limited to one.

1. Installed the new gentoo-sources-2.6.22-r2
2. Since symlink USE flag is set, I confirmed that /usr/src/linux pointed to the new source directory
3. Ran `genkernel --menuconfig all`
4. In menuconfig: Load an Alternate Configuration File Config
5. Choose to load: /etc/kernels/kernel-config-x86-2.6.21-gentoo-r4
6. Configure a few new kernel options since the previous version's config that was imported
7. Exit menuconfig; genkernel begins compiling the kernel
8. When kernel compilation is complete, the configuration I intended to be compiled (the 2.6.22-gentoo-r2 kernel config) was saved to /etc/kernels/kernel-config-x86-2.6.21-gentoo-r4 and NOT to /usr/src/linux/.config.
9. /usr/src/linux/.config is saved to /etc/kernels/kernel-config-x86-2.6.22-gentoo-r2.  Since the config was never saved to this file, it ends up being the default kernel configuration which is incorrect.

To counter the issue, here's what I did:
1. Move /etc/kernels/kernel-config-x86-2.6.21-gentoo-r4 to /etc/kernels/kernel-config-x86-2.6.22-gentoo-r2
2. Run `genkernel --mmenuconfig all`
3. Configure the few new options since the previous config file
4. Exit menuconfig and genkernel compiles the correct kernel configuration.

With the above said, I am not certain if this is a change in the kernel's menuconfig operation where it saves to a different file instead of .config if another config file is loaded or if this is genkernel itself.

To answer your question about genkernel.conf, it is the default configuration on all 5 systems.  DEFAULT_KERNEL_SOURCE="/usr/src/linux"

Hope I am making some sort of sense :).
Comment 8 Rich Gannon 2007-08-15 17:44:43 UTC
(In reply to comment #6)
> This is actually a problem in the way you're doing things.  See, when you tell
> the kernel (via menuconfig) to load an alternate config, it will load it.  When
> you tell it to save, it'll save to that alternate config location.  This is
> *not* genkernel, this is the upstream kernel doing this.  Now, genkernel is
> completely unaware of this, so it sees that there is no config, and uses the
> shipped defaults.  To accomplish what you're looking to do, use:
> 
> genkernel --kernel-config=/path/to/file --menuconfig all
> 
> This will cause genkernel to use /path/to/file as input/defaults for
> menuconfig, then it'll run menuconfig, where you can make any necessary
> changes, then when you save, it'll be saved to the local .config in
> /usr/src/linux and also copied to /etc/kernels under the right name.
> 

Chris,

Thanks for the tip.  I'll use that from now on.  I am just confused because it used to not be like this for previous builds.  When I upgraded, I used the same steps I listed in my last comment without issues.  It's just now it started to happen.  It may very well be a change in menuconfig, but I'll just use the method you have described.  Thanks, again.