Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 04-17-2006, 08:40 PM   #1
Registered: Apr 2006
Distribution: Slackware 14
Posts: 46

Rep: Reputation: 15
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...

Old 04-17-2006, 09:10 PM   #2
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Rep: Reputation: 30
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.

Good luck

Last edited by dcdbutler; 04-17-2006 at 09:11 PM.
Old 04-17-2006, 09:13 PM   #3
Senior Member
Registered: Mar 2003
Location: Following the white rabbit
Distribution: Slackware64 13.37 Android 4.0
Posts: 2,248

Rep: Reputation: 46
Always keep a backup copy of your working kernel. If the new one fails you can boot to the working one.
Old 04-17-2006, 09:30 PM   #4
Registered: Apr 2006
Distribution: Slackware 14
Posts: 46

Original Poster
Rep: Reputation: 15
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.
Old 04-17-2006, 09:49 PM   #5
Registered: Mar 2004
Location: PA
Distribution: Slackware 12.0
Posts: 315

Rep: Reputation: 30
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"


Last edited by geomatt; 04-17-2006 at 09:52 PM.
Old 04-18-2006, 12:14 AM   #6
Registered: May 2004
Location: Southwestern USA
Distribution: CentOS
Posts: 279

Rep: Reputation: 30
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.

Old 04-18-2006, 02:15 AM   #7
Senior Member
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,477

Rep: Reputation: 51
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.

Hope that helps,

Old 04-18-2006, 07:01 AM   #8
Senior Member
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
brgr88, yes, you are right, except if you compile 2.6 kernel, you shouldn't run make dep.
Old 04-18-2006, 07:51 AM   #9
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 30
cp/mv arch/i386/boot/bzImage /boot/?
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel compile fails with make-kpkg, not with make cspos Debian 37 11-09-2005 10:11 AM
10.1 install kernel and kernel-source different - build fails Feebles Mandriva 2 06-10-2005 07:58 PM
kernel compile on x86_64 fails acidjuice Linux - Software 1 05-06-2005 05:30 PM
Mandrake 10 off. 2.6.3 kernel fails to compile... why???? Samppa72 Mandriva 1 07-23-2004 09:55 PM
New Debian kernel fails to compile rickenbacherus Linux - Software 1 07-19-2003 09:56 AM

All times are GMT -5. The time now is 09:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration