From nobody@FreeBSD.org  Wed Jul 27 06:22:12 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC09C1065676
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Jul 2011 06:22:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B9448FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Jul 2011 06:22:12 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p6R6MCO8086775
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Jul 2011 06:22:12 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p6R6MCae086774;
	Wed, 27 Jul 2011 06:22:12 GMT
	(envelope-from nobody)
Message-Id: <201107270622.p6R6MCae086774@red.freebsd.org>
Date: Wed, 27 Jul 2011 06:22:12 GMT
From: tim newsham <tim.newsham+fbsd@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: unusual behavior writing boot0 from single user mode
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         159222
>Category:       kern
>Synopsis:       [boot0] unusual behavior writing boot0 from single user mode
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 27 06:30:08 UTC 2011
>Closed-Date:    
>Last-Modified:  Sat Jul 30 08:10:09 UTC 2011
>Originator:     tim newsham
>Release:        8.2
>Organization:
>Environment:
FreeBSD hpsux.x0d99.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
I boot single user, then I run "df" to see which disk is root.  Then I run:

   # fdisk -B -b /boot/boot0 /dev/da0

when its done it says "/boot/boot0: Device not configured" (error varies)
and then afterwards most commands I type (like "ls") elicit:
"vnode_pager_getpages: I/O read error" from the kernel.

I get the same behavior on my real machine as well as in vmware.  The
vmware has a clean 8.2 release installed off of DVD (8.2 release disk)
and then updated with "freebsd-update".

>How-To-Repeat:
Install 8.2 release for amd64.
Update with freebsd-update (I don't know if this matters).
Boot single user.
Run "fdisk -B -b /boot/boot0 /dev/da0" (or whatever the root disk drive is).
Run "ls" after it completes.
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-amd64->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Jul 27 23:46:14 UTC 2011 
Responsible-Changed-Why:  
reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=159222 

From: Andriy Gapon <avg@FreeBSD.org>
To: bug-followup@FreeBSD.org, tim.newsham+fbsd@gmail.com
Cc:  
Subject: Re: kern/159222: [boot0] unusual behavior writing boot0 from single
 user mode
Date: Thu, 28 Jul 2011 18:27:53 +0300

 I've noticed that you report a problem with performing some disk-related
 operations, but you haven't provided any information about your disk partitioning
 and filesystem layout.
 Also you emphasized that the problem occurs in the single user mode, but it is not
 immediately clear if you tested the same operations in the multi-user mode.
 
 -- 
 Andriy Gapon

From: Tim Newsham <tim.newsham@gmail.com>
To: Andriy Gapon <avg@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: kern/159222: [boot0] unusual behavior writing boot0 from single
 user mode
Date: Thu, 28 Jul 2011 06:59:12 -1000

 On Thu, Jul 28, 2011 at 5:27 AM, Andriy Gapon <avg@freebsd.org> wrote:
 > I've noticed that you report a problem with performing some disk-related
 > operations, but you haven't provided any information about your disk partitioning
 > and filesystem layout.
 > Also you emphasized that the problem occurs in the single user mode, but it is not
 > immediately clear if you tested the same operations in the multi-user mode.
 
 I believe I got a permission denied error when trying in multi
 user mode.  I assumed it was due to secure level.  I just tried it
 again now and it asked me twice for confirmation and when I
 did reported:
   fdisk: Class not found
   fdisk: Failed to write sector zero
 
 at this point none of the issues I reported in the bug occur.
 
 As for disks, I have tried on two separate systems.  One system was
 created just for this test in vmware and used the .iso installer
 and accepted the default partitioning and slicing offered by the installer.
 I assume there's nothing special about it:
 
 ******* Working on device /dev/da0 *******
 parameters extracted from in-core disklabel are:
 cylinders=1044 heads=255 sectors/track=63 (16065 blks/cyl)
 
 Figures below won't work with BIOS for partitions not in cyl 1
 parameters to be used for BIOS calculations are:
 cylinders=1044 heads=255 sectors/track=63 (16065 blks/cyl)
 
 Media sector size is 512
 Warning: BIOS sector numbering starts with sector 1
 Information from DOS bootblock is:
 The data for partition 1 is:
 sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 63, size 16771797 (8189 Meg), flag 80 (active)
         beg: cyl 0/ head 1/ sector 1;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 2 is:
 <UNUSED>
 The data for partition 3 is:
 <UNUSED>
 The data for partition 4 is:
 <UNUSED>
 
 
 > Andriy Gapon
 
 -- 
 Tim Newsham | www.thenewsh.com/~newsham | thenewsh.blogspot.com

From: Andriy Gapon <avg@FreeBSD.org>
To: Tim Newsham <tim.newsham@gmail.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/159222: [boot0] unusual behavior writing boot0 from single
 user mode
Date: Sat, 30 Jul 2011 11:03:04 +0300

 on 28/07/2011 19:59 Tim Newsham said the following:
 > On Thu, Jul 28, 2011 at 5:27 AM, Andriy Gapon <avg@freebsd.org> wrote:
 >> I've noticed that you report a problem with performing some disk-related
 >> operations, but you haven't provided any information about your disk partitioning
 >> and filesystem layout.
 >> Also you emphasized that the problem occurs in the single user mode, but it is not
 >> immediately clear if you tested the same operations in the multi-user mode.
 > 
 > I believe I got a permission denied error when trying in multi
 > user mode.  I assumed it was due to secure level.  I just tried it
 > again now and it asked me twice for confirmation and when I
 > did reported:
 >   fdisk: Class not found
 >   fdisk: Failed to write sector zero
 > 
 > at this point none of the issues I reported in the bug occur.
 
 Can you also try to perform a supposedly equivalent operation using gpart?
 /sbin/gpart bootcode -b /boot/boot0 da0
 Both in multi-user and single-user modes?
 
 > As for disks, I have tried on two separate systems.  One system was
 > created just for this test in vmware and used the .iso installer
 > and accepted the default partitioning and slicing offered by the installer.
 > I assume there's nothing special about it:
 > 
 > ******* Working on device /dev/da0 *******
 > parameters extracted from in-core disklabel are:
 > cylinders=1044 heads=255 sectors/track=63 (16065 blks/cyl)
 > 
 > Figures below won't work with BIOS for partitions not in cyl 1
 > parameters to be used for BIOS calculations are:
 > cylinders=1044 heads=255 sectors/track=63 (16065 blks/cyl)
 > 
 > Media sector size is 512
 > Warning: BIOS sector numbering starts with sector 1
 > Information from DOS bootblock is:
 > The data for partition 1 is:
 > sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
 >     start 63, size 16771797 (8189 Meg), flag 80 (active)
 >         beg: cyl 0/ head 1/ sector 1;
 >         end: cyl 1023/ head 254/ sector 63
 > The data for partition 2 is:
 > <UNUSED>
 > The data for partition 3 is:
 > <UNUSED>
 > The data for partition 4 is:
 > <UNUSED>
 
 Can you pls also provide gpart show and gpart list outputs?
 
 -- 
 Andriy Gapon
>Unformatted:
