feature request: fallback boot image

2010-04-02 Thread Toni Mueller
Hi,

it would be great to be able to specify a fallback kernel in case
booting a new kernel fails - esp. if one needs to work on a remote
site w/o hands-on support.

TIA!


Kind regards,
--Toni++



Re: feature request: fallback boot image

2010-04-02 Thread Chris Bennett

Toni Mueller wrote:

Hi,

it would be great to be able to specify a fallback kernel in case
booting a new kernel fails - esp. if one needs to work on a remote
site w/o hands-on support.

TIA!


Kind regards,
--Toni++


  
If you are talking about a new install over an old one and get an ERR M, 
then no kernels are accessible. Different type of fix.


If you are talking about an upgrade then
cp bsd bsd.backup before install should do it.
Then use boot boot /bsd.backup after a failed upgrade.

If you are using altroot, then you already have an old copy of / anyway.

--
A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects.
  -- Robert Heinlein



Re: feature request: fallback boot image

2010-04-02 Thread Toni Mueller
Hi,

On Fri, 02.04.2010 at 06:50:00 -0500, Chris Bennett 
ch...@bennettconstruction.biz wrote:
 If you are talking about an upgrade then
 cp bsd bsd.backup before install should do it.
 Then use boot boot /bsd.backup after a failed upgrade.

I thought about the case where the new kernel won't boot and I don't
have a console and power switch to reboot the machine and/or select a
different kernel. It would be nice if I could say something like (in
grub) fallback /bsd.backup.

As I said, this is only relevant if I'm working remotely.


Kind regards,
--Toni++



Re: feature request: fallback boot image

2010-04-02 Thread Chris Bennett

Toni Mueller wrote:

Hi,

On Fri, 02.04.2010 at 06:50:00 -0500, Chris Bennett 
ch...@bennettconstruction.biz wrote:
  

If you are talking about an upgrade then
cp bsd bsd.backup before install should do it.
Then use boot boot /bsd.backup after a failed upgrade.



I thought about the case where the new kernel won't boot and I don't
have a console and power switch to reboot the machine and/or select a
different kernel. It would be nice if I could say something like (in
grub) fallback /bsd.backup.

As I said, this is only relevant if I'm working remotely.


Kind regards,
--Toni++


  
If you don't have access to a console remotely, then exactly how would 
you type fallback /bsd.backup?

I haven't used GRUB myself. Does it support remote access?
I occasionally use GAG, but that is very small and written in assembly.

Perhaps you should get an ISP with technicians or remote IP-KVM access.
I have had problems with new installs and IP-KVM just makes it vaguely 
annoying.

My ISP also has remote access power switches.

Someone else may know of a better solution that will reboot a machine 
that fails to boot.



--
A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects.
  -- Robert Heinlein



Re: feature request: fallback boot image

2010-04-02 Thread Paul de Weerd
On Fri, Apr 02, 2010 at 03:21:30PM +0200, Toni Mueller wrote:
| Hi,
| 
| On Fri, 02.04.2010 at 06:50:00 -0500, Chris Bennett 
ch...@bennettconstruction.biz wrote:
|  If you are talking about an upgrade then
|  cp bsd bsd.backup before install should do it.
|  Then use boot boot /bsd.backup after a failed upgrade.
| 
| I thought about the case where the new kernel won't boot and I don't
| have a console and power switch to reboot the machine and/or select a
| different kernel. It would be nice if I could say something like (in
| grub) fallback /bsd.backup.
| 
| As I said, this is only relevant if I'm working remotely.

What do you mean the new kernel won't boot ?

If the kernel image is there, it will be loaded by the bootloader. If
it's garbage, then that's what you get: garbage. If the kernel is not
there, the bootloader will automagically try /bsd. So if you have 'set
image mybsd' in your /etc/boot.conf (which is frowned upon, mind you;
certain things assume that your kernel is always /bsd) and /mybsd is
not found, the bootloader will boot /bsd next. If that's not found
either, the bootloader will cancel the timeout and wait for your input
on the console.

I'm thinking your talking about the first case, your new kernel won't
boot means that the kernel image (/bsd) exists but it panics /
crashes / calls your mom / does other fun stuff.

How would the fallback solution work ? I can only think of a solution
where the bootloader and userland interact somehow. The bootloader
sets a flag on the kernel it tries to boot which is cleared by
userland after a succesful boot. If the bootloader starts again and
sees the flag set, it knows the previous boot failed and the fallback
kernel should be loaded.

May seem like a nice idea at first, but it doesn't sound very portable
to me. The boot.conf stuff is platform specific - a workaround for
broken bioses. sparc64 machines, for example, just read the kernel
image name from their boot configuration and load that, no boot.conf
needed at all.

Cheers,

Paul 'WEiRD' de Weerd

-- 
[++-]+++.+++[---].+++[+
+++-].++[-]+.--.[-]
 http://www.weirdnet.nl/ 



Re: feature request: fallback boot image

2010-04-02 Thread Toni Mueller
On Fri, 02.04.2010 at 08:44:56 -0500, Chris Bennett 
ch...@bennettconstruction.biz wrote:
 If you don't have access to a console remotely, then exactly how
 would you type fallback /bsd.backup?

I would like to see a configuration option in /etc/boot.conf that I
could use to specify a fallback kernel before I reboot to a new kernel.
As said, eg. Grub supports such a mechanism, although I don't know for
sure how powerful it really is.

 I haven't used GRUB myself. Does it support remote access?

Afaik, yes, but that's not the point. According to the documentation,
grub detects if a kernel does not boot correctly, and then proceeds to
automatically boot up to two different kernels after resetting the
machine (ie, finally fails after three unsuccessful attempts).

 Perhaps you should get an ISP with technicians or remote IP-KVM access.

Remote does not have to mean ISP or Hosting, it could also mean
some remote site where you do something which requires a computer, but
has nothing to do with Internet. Eg. I once saw a company that produces
remote sensoring and data acquisition equipment and collects data over
the Internet. These machines need to be serviced remotely, too, and in
that case, often no personell whatsoever was within reach of at least a
day of travelling of the affected sites.


Kind regards,
--Toni++



Re: feature request: fallback boot image

2010-04-02 Thread Toni Mueller
Hi,

On Fri, 02.04.2010 at 15:50:36 +0200, Paul de Weerd we...@weirdnet.nl wrote:
 What do you mean the new kernel won't boot ?

I mean that, for whatever reason, the kernel does not reach full
multi-user capabilities within some timeout (say, 5 minutes).

 there, the bootloader will automagically try /bsd. So if you have 'set
 image mybsd' in your /etc/boot.conf (which is frowned upon, mind you;
 certain things assume that your kernel is always /bsd) and /mybsd is

A _bad_ assumption, imho, but see below. I'll probably try to figure
out why this is deemed to be a good idea. No need to repeat last year's
discussion about it, which I didn't follow close enough to fully
understand the issue.

 May seem like a nice idea at first, but it doesn't sound very portable
 to me.

Ok... then I should probably try to figure out how to boot OpenBSD by
non-BSD-supplied boot loaders (eg. grub).

 The boot.conf stuff is platform specific - a workaround for
 broken bioses. sparc64 machines, for example, just read the kernel
 image name from their boot configuration and load that, no boot.conf
 needed at all.

Understood. Thanks for the summary.



Kind regards,
--Toni++



Re: feature request: fallback boot image

2010-04-02 Thread Paul de Weerd
On Fri, Apr 02, 2010 at 04:50:32PM +0200, Toni Mueller wrote:
| Hi,
| 
| On Fri, 02.04.2010 at 15:50:36 +0200, Paul de Weerd we...@weirdnet.nl wrote:
|  What do you mean the new kernel won't boot ?
| 
| I mean that, for whatever reason, the kernel does not reach full
| multi-user capabilities within some timeout (say, 5 minutes).

Your timeout idea is interesting. The bootloader loads the kernel
image and then starts executing it. After this, the bootloader is no
longer active, who will do this timing out ? The kernel (or the
garbage that was loaded in its place) is the only code running at this
point.

|  May seem like a nice idea at first, but it doesn't sound very portable
|  to me.
| 
| Ok... then I should probably try to figure out how to boot OpenBSD by
| non-BSD-supplied boot loaders (eg. grub).

I don't think they will offer you the option of timing out the kernel
booting.

Now you may of course be doing the time out yourself (looking at your
watch and pinging the remote host). In this case, clearing a flag from
userland like I suggested in my previous mail becomes possible. But
consider this .. after your proposed 5 minutes (or whatever time you
deem sufficient) you decide something is wonky and do a remote power
reset. What if it was a typo in your /etc/hostname.if or
/etc/pf.conf ? The system was multiuser (the proper flags were cleared
from userland) and waiting for you to log in, but you couldn't reach
it...

You seem to have a valid issue, but a proper solution does not appear
to be obvious to me. I take it you don't have two machines under your
control in these remote locations so you could exchange serial console
between the two ? (a USB to serial adapter on one machine connected to
the serial port of the other and vice versa)

Cheers,

Paul 'WEiRD' de Weerd

-- 
[++-]+++.+++[---].+++[+
+++-].++[-]+.--.[-]
 http://www.weirdnet.nl/ 



Re: feature request: fallback boot image

2010-04-02 Thread Brad Tilley
On Fri, 02 Apr 2010 17:08 +0200, Paul de Weerd we...@weirdnet.nl
wrote:

 Your timeout idea is interesting. The bootloader loads the kernel
 image and then starts executing it. After this, the bootloader is no
 longer active, who will do this timing out ? The kernel (or the
 garbage that was loaded in its place) is the only code running at
 this point.

Probably naive of me to think that the bootloader could get some sort of
return code (0 = OK). Maybe it's too late for it to do anything at that
point. I don't know the process well enough to talk intelligently about
it, just curious.

snip

 You seem to have a valid issue, but a proper solution does not appear
 to be obvious to me. I take it you don't have two machines under your
 control in these remote locations so you could exchange serial console
 between the two ? (a USB to serial adapter on one machine connected to
 the serial port of the other and vice versa)

I've done this a lot. Usually it works very well. Old, low-power
hardware can be used that no longer has mush purpose.

Brad



Re: feature request: fallback boot image

2010-04-02 Thread Henning Brauer
* Toni Mueller openbsd-m...@oeko.net [2010-04-02 12:25]:
 it would be great to be able to specify a fallback kernel in case
 booting a new kernel fails

how exactly does the bootloader notice your new kernel sitting in ddb?

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting



Re: feature request: fallback boot image

2010-04-02 Thread Toni Mueller
On Fri, 02.04.2010 at 22:20:46 +0200, Henning Brauer lists-open...@bsws.de 
wrote:
 * Toni Mueller openbsd-m...@oeko.net [2010-04-02 12:25]:
  it would be great to be able to specify a fallback kernel in case
  booting a new kernel fails
 how exactly does the bootloader notice your new kernel sitting in ddb?

Good question. I'm not familiar with the boot process, but would assume
that the boot loader could set up a timer that triggers an interrupt if
not cleared after some time. The interrupt handler, installed by the
boot loader, would do something that the boot loader recognizes to
select a different kernel at the next reboot. In PCs, there's afaik a
mandatory BIOS routine that can be used to issue a warm boot that would
preserve some parts of memory.

The kernel would clear the timer or diverting the interrupt handler
after booting successfully, or if the user asked for entering ddb.


-- 
Kind regards,
--Toni++



Re: feature request: fallback boot image

2010-04-02 Thread Theo de Raadt
 On Fri, 02.04.2010 at 22:20:46 +0200, Henning Brauer lists-open...@bsws.de 
 wrote:
  * Toni Mueller openbsd-m...@oeko.net [2010-04-02 12:25]:
   it would be great to be able to specify a fallback kernel in case
   booting a new kernel fails
  how exactly does the bootloader notice your new kernel sitting in ddb?
 
 Good question. I'm not familiar with the boot process, but would assume

And with that last word, we're done.