Re: [NanoBSD] Can't use boot0cfg for changing the booting slice

From: Paul Schenkeveld <fb-embedded_at_psconsult.nl>
Date: Fri, 7 Aug 2009 22:58:17 +0200
On Fri, Aug 07, 2009 at 10:44:14AM -0600, M. Warner Losh wrote:
> In message: <19068.18919.843159.936827_at_gromit.timing.com>
>             John Hein <jhein_at_timing.com> writes:
> : Olivier Cochard-Labbé wrote at 17:09 +0200 on Aug  7, 2009:
> :  > I meet a problem under FreeBSD 7.2 and 8.0-current (nanoBSD) using
> :  > boot0cfg: I can't use boot0cfg for changing the booting slice.
> :  > Here is my problem:
> :  > I'm using the FreeBSD Boot manager on a system with MBR partitions.
> :  > The active slice is the partition 1, but I want to boot from the slice 2.
> :  > 
> :  > Then I use boot0cfg like that:
> :  > 
> :  > sysctl kern.geom.debugflags=16
> :  > boot0cfg -s 2 -v /dev/ad0
> :  > sysctl kern.geom.debugflags=0
> :  > 
> :  > But, after the reboot my system still reboot from the slice 1 (but the
> :  > boot loader show correctly that the default choice is now the 2)!
> :  > Where is my problem ?
> : 
> : Are you sure you're booting from slice 1?
> : Is fstab on slice 2 pointing to slice 1?
> 
> Also, boot0cfg won't mark the slice as ACTIVE, just remember that was
> the last slice you booted from...  To mark it active, you must use
> fdisk.  If by 'active' you mean 'what mount reports root as' then I
> think John's suggestion is right on the money...

[I cc'ed freebsd-current as I feel this is a regression that really needs
 fixing before 8.0 comes out]

Pre-7.2 world:

    boot0cfg changes the default slice to boot from by altering block0
    byte at offset 0x1b9.  Allowed values are 0-3 to boot from slice
    1 thru 4 or 4 to boot from the next drive.

    Boot0 ignores the active flag in the MBR and only looks at the byte
    described above.

7.2-and-up world:

    boot0cfg still changes the same byte at 0x1b9 in block0 but boot0
    seems to completely ignore this byte and boots from the slice
    marked active in the MBR.

NanoBSD relies on the working of boot0cfg when upgrading, since 7.2 this
just does not work any more.

It seems that the original implementation of boot0 introduced the new
way of storing the default slice to boot from to allow for other defaults
than just slice 1 thru 4 which the active flag(s) in MBR allow.

My personal opinion is that boot0 should either look at the byte at
0x1b9 or at the active flags.  Since the active flags can only specify a
default of 1 thru 4 and the design of MBR and the active flags is broken
by design [1] I'd *really* like to see boot0 revert to the pre-7.2
behaviour.

Hope this gets fixed before 8.0 comes out, leaving it the way it is
renders boot0cfg and NanoBSD (which relies on boot0cfg) crippled and
too difficult to use for all users not intimately acquainted with the
way boot0cfg, the MBR record and boot0 interact.

Unfortunately I'm not enough x86 assembly literate to understand the
diffs between boot0.s in 7.1 and 7.2 to be able to produce a useful
patch.

[1] I have had installs of 8.0 snapshots that left MBR with more than
    one MBR slice marked active, BIOS subsequently completely rejected
    the disk and the only remedy was to manually fdisk -a from fixit
    mode using a live CD/DVD.  This has happened with several recent
    Intel desktop boards like DG965RY and DP35DP.

> Warner

Regards,

Paul Schenkeveld
Received on Fri Aug 07 2009 - 19:37:11 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:53 UTC