NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: installboot fails - (un)safe to reboot?



Jan Danielsson <jan.m.danielsson%gmail.com@localhost> writes:

>    I'm trying to remotely upgrade a NetBSD system, and I've encountered
> a problem.
>
>    I've built userland and kernel, and I've copied the new kernel in
> place, I copied the new usr/mdec/boot to /boot, and I was going to
> update the updated bootstrap code using:
>
>    # installboot /dev/rsd0a /..buildpath../usr/mdec/bootxx_ffsv1
>
>    But this fails with:
>    installboot: Opening file system `/dev/rsd0a' read-write: Operation
> not permitted
>
>    Obviously I'd like to know why installboot fails, but more
> importantly I'd like to know if it's safe to reboot in this state (/boot
> updated, but installboot hasn't run)?

Presumably you are talking i386 or amd64.  Booting is quite platform
specific.  I will assume i386/amd64, MBR (not GPT) for the rest of this
message.

You also need to be careful about whether your root is UFS1 vs UFS2.

Two things:

  The old primary bootblocks are probably ok.  <fuzzy>A long time ago,
  (between NetBSD 3 and 4??) there was a change, at least on sparc,
  where the old primary bootblocks couldn't boot he new secondary.</>
  But if your primary bootblocks are from NetBSD 4 or newer, they are
  almost certainly ok.

  You are running afoul of the check that you can't write to a raw
  partition on which there is a mounted filesystem.  However, you can
  write to the d partition which overlays the a partition, or you can
  create an extra matching partition and then write that one.

The tricky part about this, where I keep forgetting and have to figure
it out, is how the beginning of disk relates to the partition.
Specifically, does the primary bootstrap go at the beginning of the disk
vs the beginning of the NetBSD fdisk partition.  So take the following
with a grain of salt.

Block 0 of the disk has the MBR boot code and the MBR table.  It's job
is to select a partition and read the primary boot code from that
partition.  The primary boot code lives in sectors 2-15 of the fdisk
partition (because 0 is for the MBR, and there was some reason not to
use sector 1).

On a system without securelevel being set, one can run the installboot
command like you did.


Attachment: pgpRTU_JkH3lj.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index