Unix Technical Forum

Grub-question when performing Kernel-upgrade

This is a discussion on Grub-question when performing Kernel-upgrade within the Linux Operating System forums, part of the Unix Operating Systems category; --> Hi, I have a server on a remote location. I'm always scared to death for "Kernel Panics" when executing ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-18-2008, 06:44 AM
gorik_vdr@hotmail.com
 
Posts: n/a
Default Grub-question when performing Kernel-upgrade

Hi,

I have a server on a remote location.

I'm always scared to death for "Kernel Panics" when executing my
freshly compiled kernel ! When this happens I must hurry to the remote
location

I can imagine a scenario in which this can be solved quickly:

"If I could configure Grub in such a way that it starts my new Kernel
and before really starting it, reconfiguring itself to start another
(old and proven) kernel at the next boot-time ! When my machine
doesn't come up after 3 minutes, it is probably in a kernel panic.
Then I can power-cycle the machine remotely."

Can anyone tell me how I can do this or provide another solution to
avoid a long downtime from a "Panic" of a freshly compiled kernel ?

Kind regards,

Gorik

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-18-2008, 06:44 AM
mjt
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

gorik_vdr@hotmail.com wrote:

> Can anyone tell me how I can do this or provide another solution to
> avoid a long downtime from a "Panic" of a freshly compiled kernel ?



make a copy of the current kernel and initrd a nd create a
stanza for grub so that you can boot this previous kernel.
you can this answer many times over at groups.google
--
<< http://michaeljtobler.homelinux.com/ >>
Save the whales. Collect the whole set.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-18-2008, 06:44 AM
gorik_vdr@hotmail.com
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

I'm sorry I don't understand your brief explanation.

Could you be more explicit ?

Thanks,

Gorik

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-18-2008, 06:44 AM
mjt
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

gorik_vdr@hotmail.com wrote:

> I'm sorry I don't understand your brief explanation.
>
> Could you be more explicit ?



.... should i talk a bit slower?
* make a copy of the current, good kernel that resides on
the /boot partition. call it whatever you want.
* make a copy of the current, good initrd that resides on
the /boot partition. call it whatever you want.
* open an editor and create a stanza in /boot/grub/menu.lst
so that you can boot this 'just copied' kernel

newer (updated) kernel/initrds will replace the current
kernel/initrd files. you still have the copied kernel/initrd
(along with the new grub entry) to boot from

--
<< http://michaeljtobler.homelinux.com/ >>
"In order to make an apple pie from scratch, you must
first create the universe." - Carl Sagan, Cosmos
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-18-2008, 06:44 AM
gorik_vdr@hotmail.com
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

That's the speed I can read

OK, this will create 2 stanza of which you can choose at startup-time.
Let's say that I choose the newly compiled kernel to be the default
startup-kernel. What if my machine gets into a kernel panic ? Each
power-recycle will loop the machine every time into that kernel panic,
no ?

My problem is that the machine is at a remote location and I cannot
press a key at startup-time...

Gorik

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-18-2008, 06:44 AM
mjt
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

gorik_vdr@hotmail.com wrote:

> That's the speed I can read
>
> OK, this will create 2 stanza of which you can choose at startup-time.
> Let's say that I choose the newly compiled kernel to be the default
> startup-kernel. What if my machine gets into a kernel panic ? Each
> power-recycle will loop the machine every time into that kernel panic,
> no ?
>
> My problem is that the machine is at a remote location and I cannot
> press a key at startup-time...


.... okay. fair enough. the problem is how is the machine
gonna know that it cant boot up?

i'm gonna just think outloud here ...
* the kernel boots fine, the system boots up to its
required runlevel and everything is fine. you have
a runlevel script that writes a file called "good_boot"
or something along those lines that signifies that
this boot is successful.

that would be wonderful. you could then somehow check
if the current bootup doesnt work, then revert to the
other, good-booting kernel.

but we have a snag. if this newly installed kernel
panics, and worse, locks up hard, how is the system
supposed to "know" this and reset the machine? you
cant "test" a kernel unless you're using UML or some
other type of sandbox (VM, etc). or you duplicate
this machine locally and test any new kernel updates
on this local machine before you apply the updates
to the REAL machine.

--
<< http://michaeljtobler.homelinux.com/ >>
Broad-mindedness, n.: The result of flattening high-mindedness out.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-18-2008, 06:44 AM
gorik_vdr@hotmail.com
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

mjt wrote:
> but we have a snag. if this newly installed kernel
> panics, and worse, locks up hard, how is the system
> supposed to "know" this and reset the machine? you
> cant "test" a kernel unless you're using UML or some
> other type of sandbox (VM, etc). or you duplicate
> this machine locally and test any new kernel updates
> on this local machine before you apply the updates
> to the REAL machine.


The thing I was thinking off is the "default" value in grub:
- Let's say that 0 is the new kernel stanza and 1 is the old (good)
stanza
- Let's say that we put default=0 in the grub-config
- So at the first boot we would start the new kernel: if I could change
the default value to 1 before the real kernel is booted (no matter if
the kernel can boot or not), than my problem is solved.

Why ?
- if the kernel boots allright, then I can configure grub so it boots
my new (and verified) kernel
- if the kernel hangs (hard), I can recycle the power remotely and the
next time default=1 (= old kernel) and I can correct my problem and
retry over and over

Only: how can I change default right at the boot-menu (without being
able to type anything at boot-time) ?

Kind regards,

Gorik

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-18-2008, 06:44 AM
mjt
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

gorik_vdr@hotmail.com wrote:

> Why ?
> - if the kernel boots allright, then I can configure grub so it boots
> my new (and verified) kernel
> - if the kernel hangs (hard), I can recycle the power remotely



.... my question is: how do hard-power-cycle a machine remotely?
--
<< http://michaeljtobler.homelinux.com/ >>
It's a damn poor mind that can only think of one way to spell a word. - Andrew Jackson
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-18-2008, 06:44 AM
gorik_vdr@hotmail.com
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

I can do a hard-power-cycle for my machine

APC makes PDU's: these provide a web-based interface where you can put
the power (to your machine) off or on (see
http://www.apc.com/products/family/index.cfm?id=30)

Gorik

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-18-2008, 06:44 AM
mjt
 
Posts: n/a
Default Re: Grub-question when performing Kernel-upgrade

gorik_vdr@hotmail.com wrote:

> I can do a hard-power-cycle for my machine



.... interesting. i've never considered this in my 20+
years in the computer field if there is a machine
which is THAT important to be online, there are folks
that are physically avail to maintain it.


anyway, after some thought, i think i have a solution.

* the "default" setting in /boot/grub/menu.lst is
set for the known, good kernel. the one that is
copied (as a backup).

* the new kernel boots, a runlevel script runs and
checks the current kernel version to see if this
new version successfully booted.

* if this new kernel has successfully booted, then it
changes the "default" boot entry in the
/boot/grub/menu.lst file.

if this new kernel didnt boot successfully, then the
"default" entry is never changed


--
<< http://michaeljtobler.homelinux.com/ >>
One difference between a man and a machine is that
a machine is quiet when well oiled.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:01 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com