Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 112749 - Missing information on reusing old .config when updating the kernel
Summary: Missing information on reusing old .config when updating the kernel
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs-user
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Docs Team
URL: http://forums.gentoo.org/viewtopic-t-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-16 14:41 UTC by paapaa125
Modified: 2006-02-27 08:47 UTC (History)
2 users (show)

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 paapaa125 2005-11-16 14:41:05 UTC
The following behaviour is not described in the official "Gentoo Linux Kernel
Upgrade Guide" found here:

http://www.gentoo.org/doc/en/kernel-upgrade.xml

It seems that when you emerge new gentoo-sources, update the symlink and run
"make menuconfig", the configuration program _automatically_ tries to find an
old .config file and reuse it to ease the configuration. It searches at least in
/boot/. 

I had the .config from an older kernel saved as /boot/config-2.6.13-gentoo-r5.
When I emerged gentoo-sources 2.6.14-r2 and ran "make menuconfig", it
automatically found the old settings and applied them. This functionality should
be described in the above documentation. The next things should be added to
"Gentoo Linux Kernel Upgrade Guide":

1. Encourage the user to always copy /usr/src/linux/.config to /boot/config-...
after building the kernel image using the correct naming scheme. This copying is
now described only in the "Gentoo Linux Handbook" in section 7, not in "Gentoo
Linux Kernel Upgrade Guide" for some reason.
2. Describe that "make menuconfig" tries to find and reuse an old .config file.
3. Rewrite the section "10: Advanced: Using your old kernel .config to configure
a new one" to reflect the above functionality and possible tell which method is
more secure or recommended: this one, or using "make oldconfig" as described in
the docs.
4. Mention this functionality briefly in "Gentoo Linux Handbook" in section "7.
Configuring the Kernel".

This automation doesn't probably work if /boot/ is not mounted during "make
menuconfig". Haven't tested that, though.

I also don't know if old .config files are searched somewhere else, like
/usr/src/ ? 

I also don't know how they should be named correctly. The above name DID work.
And what about mixing different kernel families, like gentoo-sources and vanilla
kernels? Could that cause problems?

I tested this only on x86, but I assume this applies to all platforms.

Reproducible: Always
Steps to Reproduce:
0.Mount /boot, if needed.
1."cd /usr/src/linux/"
2."cp .config /boot/config-" (append correct "old" kernel version here)
3.Emerge new gentoo-sources if present.
4.Update the symlink /usr/src/linux as described in the docs.
5."cd /usr/src/linux" 
6."make menuconfig"

Actual Results:  
You should now see your old settings automatically applied.

Expected Results:  
This bug report is about docs, but the software should probably ask the user if
he wants to reuse the old settings.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-11-16 14:52:29 UTC
Bad idea for upgrading between anything else then revisions of the same kernel
version, and even then you should use make oldconfig, not just load the old
kernel config in menuconfig.
Comment 2 paapaa125 2005-11-16 15:02:25 UTC
(In reply to comment #1)
> Bad idea for upgrading between anything else then revisions of the same kernel
> version, and even then you should use make oldconfig, not just load the old
> kernel config in menuconfig.

The problem here is that it does it automatically! It doesn't ask if user wants
to reuse old settings but just does that. If you have a backup of old .config in
/boot/, "make menuconfig" will reuse that. So either we should:

1. Update the docs.
2. Alter the functionality.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2005-11-16 15:08:08 UTC
(In reply to comment #2)
> The problem here is that it does it automatically! It doesn't ask if user wants
> to reuse old settings but just does that. If you have a backup of old .config in
> /boot/, "make menuconfig" will reuse that. So either we should:

> 1. Update the docs.
> 2. Alter the functionality.

Eh? What about

3/ Don't copy old config to /usr/src/linux or /boot or wherever

?
Comment 4 paapaa125 2005-11-16 15:15:59 UTC
> Eh? What about
> 
> 3/ Don't copy old config to /usr/src/linux or /boot or wherever

Well, then the next doc should be corrected:

http://www.gentoo.org/doc/en/handbook/index.xml

It says: "It is also wise to copy over your kernel configuration file to /boot,
just in case"

If a user follows that advice, he might (at least according to you) run into
troubles because this undocumented (?) functionality. And if reusing old .config
really causes problems, this is a major issue! I really don't know how this
should be handled.

I repeat: user is not asked, whether he likes to reuse the old config file, if
one is found in /boot.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2005-11-16 15:24:11 UTC
(In reply to comment #4)
> I repeat: user is not asked, whether he likes to reuse the old config file, if
> one is found in /boot.

I'm sorry, but the behaviour you are describing does not exist here... Running
make menuconfig definitely does not reuse config saved in /boot

Comment 6 Jakub Moc (RETIRED) gentoo-dev 2005-11-16 15:33:11 UTC
CCing kernel, don't know if this is some new 2.6.14 feature or what, not
reproducible here with 2.6.13 at all... 
Comment 7 paapaa125 2005-11-16 15:37:12 UTC
> I'm sorry, but the behaviour you are describing does not exist here... Running
> make menuconfig definitely does not reuse config saved in /boot

I tested a bit more. I really don't know what is the logic it is using for
selecting old config files. To test it you shouldn't have any .config in
/usr/src/linux. So remove those first (backup). Then run "make menuconfig" and
exit immediately without saving. You should now see if it is using an older
config file. Mine reads:

-------
$ sudo make menuconfig
scripts/kconfig/mconf arch/i386/Kconfig
#
# using defaults found in /boot/config-2.6.14-gentoo-r2
#


Your kernel configuration changes were NOT saved.
--------

I'm not the only one seeing this behaviour. See the relevant discussion here:

http://forums.gentoo.org/viewtopic-t-401641-highlight-.html
Comment 8 Xavier Neys (RETIRED) gentoo-dev 2005-11-17 09:04:30 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > The problem here is that it does it automatically! It doesn't ask if user wants
> > to reuse old settings but just does that. If you have a backup of old .config in
> > /boot/, "make menuconfig" will reuse that. So either we should:
> 
> > 1. Update the docs.
> > 2. Alter the functionality.
> 
> Eh? What about
> 
> 3/ Don't copy old config to /usr/src/linux or /boot or wherever

Considering chapter 10., I'd go that way, and I'd add a warning to let users
know about this behaviour.


(In reply to comment #6)
> CCing kernel, don't know if this is some new 2.6.14 feature or what, not
> reproducible here with 2.6.13 at all... 

Look at scripts/kconfig/confdata.c, the following files are considered in sequence:
  ".config",
  "/lib/modules/$UNAME_RELEASE/.config",
  "/etc/kernel-config",
  "/boot/config-$UNAME_RELEASE",
  "arch/$ARCH/defconfig";
Comment 9 Jakub Moc (RETIRED) gentoo-dev 2005-11-17 10:26:12 UTC
(In reply to comment #8)
> Look at scripts/kconfig/confdata.c, the following files are considered in
sequence:
>   ".config",
>   "/lib/modules/$UNAME_RELEASE/.config",
>   "/etc/kernel-config",
>   "/boot/config-$UNAME_RELEASE",
>   "arch/$ARCH/defconfig";

Ah well, now I am able to reproduce this (tried with /etc/kernel-config and
/boot/config-$UNAME_RELEASE)...

Hmm, we might either add a warning or advise people to copy the current config
somewhere else then to the locations quoted above in the handbook
(http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7 - code
listing 17) to avoid unexpected results. 

I've had a bad experience with 'make oldconfig' or loading the .config from
previous kernel versions in menuconfig, it's been producing strange things a
couple of times and don't consider this feature to be safe. :/

kernel herd, any ideas? 
Comment 10 Sven Vermeulen (RETIRED) gentoo-dev 2005-11-17 10:51:59 UTC
Honestly, we don't recommend the user to just accept whatever setting "make
menuconfig" presents. I believe it is easier for the user if the configuration
resembles his previous one, even though it isn't perfect.

What difference does it make that "make menuconfig" takes that configuration, or
the default kernel configuration?
Comment 11 paapaa125 2005-11-17 11:14:13 UTC
Maybe the docs should mention this functionality and describe the proper naming
scheme AND 'make menuconfig' should ask the user if he wants to use a default
configuration or a found configuration(s)? Or at least tell the user in the
config screen which one it chose: default or old config.
Comment 12 John Mylchreest (RETIRED) gentoo-dev 2005-11-17 11:26:17 UTC
I feel a combination of make oldconfig && make menuconfig should be enough for most.
I don't particularly see any problen here?
Comment 13 Jakub Moc (RETIRED) gentoo-dev 2005-11-17 12:50:08 UTC
OK, as for .config backup, I'd suggest to replace Code Listing 17 in
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7 with

[*] Kernel .config support
[*]   Enable access to .config through /proc/config.gz

1/ Solves the issue of make menuconfig automatically reusing the old kernel
configuration (possibly unwanted and not-so-safe)

2/ Makes a nice backup as well ;)

In the kernel upgrade guide, replacing Code Listing 10.1 with:

zcat /proc/config.gz > /usr/src/linux/.config && make oldconfig

Comments?
Comment 14 Jan Kundrát (RETIRED) gentoo-dev 2005-11-17 14:39:03 UTC
Well, there's no point in using /boot/config-foo files (IMHO) as 
`scripts/extract-ikconfig` from kernel directory should do the same thing with 
existing bzImage. 
Comment 15 Xavier Neys (RETIRED) gentoo-dev 2005-11-18 01:36:48 UTC
(In reply to comment #13)
> [*] Kernel .config support
> [*]   Enable access to .config through /proc/config.gz
> 
> 1/ Solves the issue of make menuconfig automatically reusing the old kernel
> configuration (possibly unwanted and not-so-safe)
> 2/ Makes a nice backup as well ;)

I do not like using kernel memory to save data that is only going to be used
once and that is already available in a file
Comment 16 Jakub Moc (RETIRED) gentoo-dev 2005-11-18 01:48:21 UTC
(In reply to comment #15)
> I do not like using kernel memory to save data that is only going to be used
> once and that is already available in a file

So don't use it, perhaps? /proc/config.gz is exactly 8155 B here, what a waste
of memory space. ;p Don't see what's wrong with using in-kernel features to
backup kernel configuration. I don't like kernel recycling this information
automatically in make menuconfig, which may cause strange results, that's what
this bug is about. 
Comment 17 Xavier Neys (RETIRED) gentoo-dev 2005-11-18 01:49:19 UTC
(In reply to comment #10)
> Honestly, we don't recommend the user to just accept whatever setting "make
> menuconfig" presents. I believe it is easier for the user if the configuration
> resembles his previous one, even though it isn't perfect.
> 
> What difference does it make that "make menuconfig" takes that configuration, or
> the default kernel configuration?

The difference is that on the first kernel upgrade, current settings are
automatically used, but not on the second upgrade, and there is nothing in the
docs that can explain this discrepancy. Consider the following scenario:

Joe wants to try Gentoo, downloads the CD, follows the handbook, ends up with a
perfect distro using kernel-2.6.23.
Joe is happy.
kernel 2.6.24 is released.
Joe follows the kernel-upgrade guide to know what to do.
Joe runs `make menuconfig`
Joe checks several config pages and he notices that all his settings have been
automatically transfered.
Joe thinks 'Cool, well done, easy'
Joe completes his upgrade by following the doc, reboots, and everything works.
Joe is a happy bunny.
Two months later, kernel 2.6.25 comes out.
Joe remembers the guide, follows it again because it's only his second upgrade
and he does not know it by heart.
Joe does remember that `make menuconfig` loads his settings automatically.
Joe completes his upgrade, reboots, and nothing works.
I shan't even mention how Joe would be pissed off had he been overconfident and
replaced his previous entry in his bootloader config instead of adding a new one.
Joe searches high & low and eventually finds out that the 2nd `make menuconfig`
used the default config instead of his current settings.
Joe is not a happy bunny anymore because the doc did not explain anything about
that.


PS: back to docs-team until we know how to eat at Joe's
Comment 18 Xavier Neys (RETIRED) gentoo-dev 2005-11-18 01:51:02 UTC
(In reply to comment #16)
> (In reply to comment #15)
> > I do not like using kernel memory to save data that is only going to be used
> > once and that is already available in a file
> 
> So don't use it, perhaps? /proc/config.gz is exactly 8155 B here, what a waste

Still a waste by your own words.

> I don't like kernel recycling this information
> automatically in make menuconfig, which may cause strange results, that's what
> this bug is about. 

Then take it to lkml, we don't control that code
Comment 19 Jakub Moc (RETIRED) gentoo-dev 2005-11-18 02:12:23 UTC
(In reply to comment #18)
> > I don't like kernel recycling this information
> > automatically in make menuconfig, which may cause strange results, that's what
> > this bug is about. 
> 
> Then take it to lkml, we don't control that code

No, but we are making unsafe recommendations in our docs wrt backing up the
kernel config, so we might perhaps fix it, instead of focusing on debate about
wasting a couple of kilobytes in memory? Saying that I don't like wasting
another 32384 B of disk space to save data that is only going to be used once
and that is already available in a file would be of about same importance and
relevance here. 

Anyway, if you don't like it that much then just drop the suggestion, I could
care less. Just don't advise people to backup the thing to
/boot/config-$UNAME_RELEASE. 
Comment 20 paapaa125 2005-11-18 02:26:30 UTC
Sven raised a good point:

Is it fundamentally more dangerous to use previous .config as a starting point
for configuration rather than using some kernel default settings? 

I think both can lead to equally unusable system in the worst case scenario when
the user doesn't go through the settings. And in the best case scenario the old
.config most likely works flawlessly without editing. 

In this light I think this functionality should just be documented properly so
the user knows what is happening. And thus there is probably no need to drop the
recommendation of "cp .config /boot/" in the Handbook. And we even save 8155
bytes of precious kernel size :)
Comment 21 Daniel Drake (RETIRED) gentoo-dev 2005-11-18 03:08:21 UTC
But the handbook doesn't say "cp .config /boot/"

It says: "cp .config /boot/config-2.6.11-gentoo-r3"

Due to the filename, this config will only be reused on a kernel which has a
version of 2.6.11-gentoo-r3 and there is no danger of reusing old settings there.
Comment 22 paapaa125 2005-11-18 03:22:08 UTC
(In reply to comment #21)
> But the handbook doesn't say "cp .config /boot/"
> 
> It says: "cp .config /boot/config-2.6.11-gentoo-r3"

Yes, I meant that. I'm a lazy typer...
 
> Due to the filename, this config will only be reused on a kernel which has a
> version of 2.6.11-gentoo-r3 and there is no danger of reusing old settings there.

I'm quite positive, that all my settings were also copied, when I upgraded from
2.6.13-r5 to 2.6.14-r2. Can't confirm that now, though.
Comment 23 Xavier Neys (RETIRED) gentoo-dev 2005-11-18 03:38:55 UTC
(In reply to comment #21)
> But the handbook doesn't say "cp .config /boot/"
> 
> It says: "cp .config /boot/config-2.6.11-gentoo-r3"
> 
> Due to the filename, this config will only be reused on a kernel which has a
> version of 2.6.11-gentoo-r3 and there is no danger of reusing old settings there.

That's where the discrepancy is:
When first upgrading to e.g. 2.6.12-gentoo-r5, settings saved in
/boot/config-2.6.11-gentoo-r3 will be reused (/boot/config-`uname -r`) but when
upgrading later to e.g. linux-2.6.13-gentoo-r5, defconfig will be used.

This behaviour is not described.
Comment 24 Jakub Moc (RETIRED) gentoo-dev 2005-11-18 03:40:24 UTC
(In reply to comment #21)
> But the handbook doesn't say "cp .config /boot/"
> 
> It says: "cp .config /boot/config-2.6.11-gentoo-r3"
> 
> Due to the filename, this config will only be reused on a kernel which has a
> version of 2.6.11-gentoo-r3 and there is no danger of reusing old settings there.

No. It will be reused if that version matches what 'uname -a' has to say about
currently running kernel version. So, if you are running 2.6.8 and want to
upgrade to 2.6.14, it will happily recycle that 2.6.8 config. Don't think this
would be even remotely safe. 
Comment 25 Daniel Drake (RETIRED) gentoo-dev 2005-11-18 04:01:20 UTC
Yeah, sorry, just noticed that myself.

I'm not convinced that its a major problem as the kernel upgrade guide asks you
to mount /boot after compiling everything, so theres no chance for reuse. (This
is also why I've never seen this behaviour before, and I imagine I'm in the same
boat as most people)

Either way the discrepency in the documentation should be solved. I suggest not
copying it to /boot, or using a different naming scheme if you'd still like to
encourage a backup procedure.
Comment 26 Xavier Neys (RETIRED) gentoo-dev 2005-11-18 04:46:26 UTC
(In reply to comment #25)
> Yeah, sorry, just noticed that myself.
> 
> I'm not convinced that its a major problem as the kernel upgrade guide asks you
> to mount /boot after compiling everything, so theres no chance for reuse.

The guide also does not mention it works only if the following conditions are
both met:
 1) You must have followed the handbook to the t and used the very same
partitioning scheme
 2) You must be using an architecture that does recommend a separate /boot partition

> Either way the discrepency in the documentation should be solved. I suggest not
> copying it to /boot, or using a different naming scheme if you'd still like to
> encourage a backup procedure.

Agreed.
Why not add `make defconfig` to make sure users do start with the default config
and refer them to ch10 if they really want to reuse their .config?
Comment 27 Carlos Silva (RETIRED) gentoo-dev 2005-11-19 03:07:51 UTC
Well, i'm with Jakub in this. Why don't use the in-kernel feature to save the
config file?! If the user really wants to use the old kernel config, he'll have
to copy it himself from /proc/config.gz, and afaik the Kconfig utils don't check
there. Besides, if this method is used, the user will always start with a
defconfig when building a new kernel. (unless he zcat /proc/config.gz >
/usr/src/linux/.config)
Comment 28 Henrik Brix Andersen 2005-11-19 04:25:35 UTC
Just FYI: `make install` in the kernel tree will also copy the .config to
/boot/config-$UNAME_RELEASE (if the user has debianutils installed) - it has
done this as far back as I can remember, and I consider it a nice feature.

Why not just alert the user to the fact that `make *config` will look for the
.config file in these places, and advice them to manually copy their previous
.config file to the new kernel source and run `make oldconfig` when upgrading a
kernel?
Comment 29 nm (RETIRED) gentoo-dev 2006-01-23 13:25:57 UTC
(In reply to comment #4)
> > Eh? What about
> > 
> > 3/ Don't copy old config to /usr/src/linux or /boot or wherever
> 
> Well, then the next doc should be corrected:
> 
> http://www.gentoo.org/doc/en/handbook/index.xml
> 
> It says: "It is also wise to copy over your kernel configuration file to /boot,
> just in case"
> 
> If a user follows that advice, he might (at least according to you) run into
> troubles because this undocumented (?) functionality. And if reusing old .config
> really causes problems, this is a major issue! I really don't know how this
> should be handled.
> 
> I repeat: user is not asked, whether he likes to reuse the old config file, if
> one is found in /boot.

This is no longer the case. See bug #118031 -- the "copy oldconfig" instructions have been removed from all the handbooks.

Is this bug still valid in light of the changes made?
Comment 30 paapaa125 2006-02-27 08:47:32 UTC
It looks like this issue doesn't exists anymore. Thank you for updating the documents!