Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Feb 2015 17:54:52 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 197326] boot0cfg -s does not work unless kern.geom.debugflags=0x10
Message-ID:  <bug-197326-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197326

            Bug ID: 197326
           Summary: boot0cfg -s does not work unless
                    kern.geom.debugflags=0x10
           Product: Base System
           Version: 9.2-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: marcnarc@xiplink.com

I've found a bit of back-and-forth on this online, and indeed r227553 says that
boot0cfg should not require the debugflags hack.  However, I can confirm that
it does (this on a recent STABLE 9 build):

/root # boot0cfg -v da0
#   flag     start chs   type       end chs       offset         size
1   0x80      0:  2: 1   0xa5     20:254:63          126       337239
2   0x00     21:173: 1   0xa5     42:254:63       348264       342531
3   0x00     43: 89: 1   0xa5     64:254:63       696402       347823

version=2.0  drive=0x80  mask=0xf  ticks=182  bell=# (0x23)
options=packet,update,nosetdrv
volume serial ID 9090-9090
default_selection=F1 (Slice 1)
/root # boot0cfg -s 2 da0
/root # boot0cfg -v da0
#   flag     start chs   type       end chs       offset         size
1   0x80      0:  2: 1   0xa5     20:254:63          126       337239
2   0x00     21:173: 1   0xa5     42:254:63       348264       342531
3   0x00     43: 89: 1   0xa5     64:254:63       696402       347823

version=2.0  drive=0x80  mask=0xf  ticks=182  bell=# (0x23)
options=packet,update,nosetdrv
volume serial ID 9090-9090
default_selection=F2 (Slice 2)
/root #

Note that flag 0x80 is still on partition 1.  Even though the default menu
selection is partition 2, rebooting at this point will boot partition 1.

However, with kern.geom.debugflags=0x10 the active flag moves to partition 2:

/root # sysctl kern.geom.debugflags=0x10
kern.geom.debugflags: 0 -> 16
/root # boot0cfg -s 2 da0
/root # boot0cfg -v da0
#   flag     start chs   type       end chs       offset         size
1   0x00      0:  2: 1   0xa5     20:254:63          126       337239
2   0x80     21:173: 1   0xa5     42:254:63       348264       342531
3   0x00     43: 89: 1   0xa5     64:254:63       696402       347823

version=2.0  drive=0x80  mask=0xf  ticks=182  bell=# (0x23)
options=packet,update,nosetdrv
volume serial ID 9090-9090
default_selection=F2 (Slice 2)
/root #

Some debugging shows that inside boot0cfg's write_mbr() function, the
open(O_WRONLY) call returns -1 unless kern.geom.debugflags=0x10.

At the very least, boot0cfg should report an error when it fails to update the
mbr.  Also, r227553 was wrong.

IMHO, boot0cfg should be able to update the mbr regardless of the
kern.geom.debugflags setting.  I understand that others feel differently. 
Perhaps a compile-time option could be added to let boot0cfg tweak the
kern.geom.debugflags automatically?

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-197326-8>