Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel compilation on remote server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Leachim
n00b
n00b


Joined: 25 Feb 2007
Posts: 66

PostPosted: Thu May 29, 2008 11:27 pm    Post subject: Kernel compilation on remote server Reply with quote

Hi all,

I have one problem. I need to compile my new kernel on remote server. I can't go to the housing center, so I need to compile 100% working kernel. If it will not boot at startup, it can be a big problem.

Is any way, how to compile kernel, reboot the machine and when kernel will not works, it will auto reboot the pc and use the old kernel?

I hope that you understand what I need.

Ty for reply
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Thu May 29, 2008 11:45 pm    Post subject: Reply with quote

Look into the following things:
program "grub-set-default" used within linux (after /boot is mounted) to set the default entry.
default command in grub.conf
fallback command in grub.conf
savedefault command in grub.conf

Use it like:
grub-set-default 0
to set the first entry to be booted

Then: make sure the "default" line in your grub.conf reads as "default saved" instead of using a number. Add a "fallback 1" line so that the backup kernel is loaded if the first kernel can't be loaded.

Next, in your first boot entry (the test kernel), put "savedefault 1" at the end of that entry such that it boots using the old kernel next time (make sure your 2nd entry is the old kernel)

Now, here's the problem. All this work ensures that the 2nd boot will start the old kernel, however we have no way of making the system reboot if it locks up or fails to start the network. You may wish to set a cron job or similar to automatically reboot the machine assuming the kernel comes up. But, if the machine locks up or something, it will need to be manually rebooted (although no intervention will be needed at the menu, which is good for a headless server).

If the kernel panics, there is a way to make it reboot automatically - add the kernel parameter "panic=1" to make it reboot after 1 second if a kernel panic occurs.

If your server has a management module that can automatically reboot the system after some delay, you should use it.

Hopefully the upgrade goes without problems - check the output of "uname -a" to find what kernel you're running. If it works fine, you'll want to alter your grub.conf to set the default to 0 and remove the savedefault line (leaving the fallback at 1 is smart in case the file becomes corrupted).

Good luck


Last edited by BradN on Fri May 30, 2008 4:50 am; edited 1 time in total
Back to top
View user's profile Send private message
electronvolt
Tux's lil' helper
Tux's lil' helper


Joined: 16 May 2007
Posts: 83

PostPosted: Fri May 30, 2008 4:03 am    Post subject: Reply with quote

Hi,
BradN, one slight mistake in your 'mini-HOWTO'......the command to save the default boot option in grub.conf is savedefault not setdefault

regards
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Fri May 30, 2008 4:48 am    Post subject: Reply with quote

Oops, right you are... I'll edit my previous post :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum