How to restore out-of-box kernel settings if my kernel compile fails?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to restore out-of-box kernel settings if my kernel compile fails?
In the SlackBook, chapter 4, it covers compiling a new kernel, something I've never been able to do before and still be able to boot my system -- this time, I'm determined to get it right.
The first step it tells me is to backup /usr/src/linux/.config, then these steps:
1. make mrproper
2. make config
3. make dep
4. make clean
5. make bzImage
6. make modules
7. (some cp/mv commands)
8. make modules_install
My question is, if I screw up a kernel compile with these instructions, can I just restore the backed up copy of .config and then redo those steps starting at #3 to put me back where I started from, which is basically Slackware out-of-the-box?
I'm asssuming that steps 1 & 2 clear out the .config file and make a new one, so that if I skip them and restore the out-of-box copy of .config, I'll be able to proceed with #3 to restore all the modules back to the way they were? After that I'll go back to try & figure out what went wrong...
You may find this guide helpful for compiling the kernel. This is the one I followed.
Always keep at least one backup kernel in case you can't boot into the one you're compiling. This is explained in the guide in the section about editing lilo.conf. That way you can play around with kernel compiling and be sure of being able to reboot onto your backup kernel if not the new one.
dcdbutler & masonm, thanks for the advice; however, I'm not necessarily trying to upgrade, but just know how to get everything back to the way it was and I'm thinking that restoring the original .config and re-compiling from there would do it. That's basically what I'm curious about.
You can perfectly well have 2 or 3 or more kernels on your system at once. Just configure lilo to offer you a choice, as per the instructions referenced by the others who responded. That way if you try to boot into the new kernel, and it fails, you can reboot into the working kernel without needing to recompile it. It stays built as long as you do not overwrite it. If you just give it another name and then add a new entry into lilo.conf and enable the boot prompt, you can choose which kernel to boot. And save the .config file somewhere else in case you want to retweak from the original starting point. You can also always access the current configuration by running "zcat /proc/config.gz"
Either way you want a known good kernel to boot to, just in case something goes wrong. See the sticky "This is how I do it all" for details on doing this.
Hi, I just went through the same routine and I just wanted to emphasize one point that geomatt has already told you (the instructions in some place are not totally clear on this.) When you get to the step that you cp/mv arch/i386/boot/bzImage /boot/?, make sure you are naming your new kernel something different than the working kernel you want to keep in reserve. Some instructions tell you to copy to /boot/vmlinuz and if that is the name of the current working kernel, it is going to be overwritten.
There's no need to do this manually anymore, 2.6 has the kernelinstall script feature through which you can automatically add the version onto the name while installing (I use this to create a package rather than installing the kernel manually).
Also, you shouldn't really use /usr/src/linux, but rather /usr/src/linux-<version>. The source dir will be symlinked via /lib/modules/<version>/build anyway, so third party modules etc can always find the src.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.