From owner-freebsd-bugs@FreeBSD.ORG Wed Feb 4 17:54:52 2015 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7458395A for ; Wed, 4 Feb 2015 17:54:52 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ABB5BF3 for ; Wed, 4 Feb 2015 17:54:52 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t14HsqXr092057 for ; Wed, 4 Feb 2015 17:54:52 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 197326] boot0cfg -s does not work unless kern.geom.debugflags=0x10 Date: Wed, 04 Feb 2015 17:54:52 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 9.2-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: marcnarc@xiplink.com X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2015 17:54:52 -0000 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.