Subject: port-i386/25113: 2.0: fdisk(8) unusable for boot selector manipulation
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <hubert@feyrer.de>
List: netbsd-bugs
Date: 04/09/2004 15:38:50
>Number:         25113
>Category:       port-i386
>Synopsis:       2.0: fdisk(8) unusable for boot selector manipulation
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 09 13:39:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hubert Feyrer
>Release:        NetBSD 2.0_BETA
>Organization:
bla!
>Environment:
System: NetBSD miyu 2.0_BETA NetBSD 2.0_BETA (MIYU) #45: Wed Mar 31 13:28:17 MEST 2004 feyrer@miyu:/home/cvs/src-2.0/sys/arch/i386/compile/MIYU i386
Architecture: i386
Machine: i386
>Description:

	Short:
	 1) fdisk -i doesn't remove bootselector
 	 2) fdisk -B doesn't list/edit bootable partitions
	 3) fdisk -u -B leads to "Invalid partition table" when booting

	Long:

	I updated my home i386 machine by hand, booting from a
	2.0_BETA CD (made by 'build.sh release; cd etc; make iso-image').
	Having all the files prepared on a second disk, I wante to
	rebuild the root partition completely, then copy files over.
	I did a "newfs -O2", mounted it, and copied files, no problem.

	Trouble started when trying to install the bootloader.
	installboot(8) seems to have worked ok (after I found out that I had
	to copy /boot manually, which is not obvious from the information
	on the boot media!). What I ran effectively was:
	"installboot /dev/rwd0a /usr/mdev/*ffsv2"

	Upon reboot, the old mbr (which had a boot selector for Windows
	and NetBSD installed) just hung after pressing F2 for NetBSD,
	no sign of life.

	Bootint from CD again and running "fdisk -B wd0" offered me
	a list of harddisks to boot from, but did not list either
	my NetBSD nor my Windows partition. Plain "fdisk wd0" output
	showed the bootloader entries though.

===> 1)	OK, "fdisk -i wd0 && reboot" => no go, bootselector still
	installed.  It seems that this command didn't do anything at all.

	Forcing fdisk to write /usr/mdec/mbr (and not mbr_bootsel!)
	via "fdisk -c /usr/mdec/mbr" gave me a booting system, but no
	bootselector (or course).

===> 2) Going back to "fdisk -B", I got a non-working system again.
	Of course, because it didn't have any bootselector entries
	any more at all, after I overwrote them with the "normal"
	(non-bootselecting) mbr. "fdisk -B" didn't offer any partitions
	to put into the boot selector.

===> 3) I got the bootselector entries back via "fdisk -u", which also
	gave me a list of bootable partitions on "fdisk -B". Yet selecting
	my NetBSD partition on bootup gave me "Invalid partition
	table".

	I went through the "fdisk -i", "fdisk -c mbr", "fdisk -uB"
	cycle a couple of times, but always ended up with a non-working
	setup.

	Right now I'm running with the "mbr" bootloader which won't
	allow me access my Windows partition, but I can life with
	that for now.

	It's in no way acceptable for a major release though.

	I wonder what happens when one runs sysinst on a new system or one
	that had 1.6.x (using update?), but I can't test that right now.

>How-To-Repeat:
	See above.

>Fix:
	No idea. This worked fine with 1.6.x.
>Release-Note:
>Audit-Trail:
>Unformatted:
 	<Please check that the above is correct for the bug being reported,>
 	<and append source date of snapshot, if applicable (one line).>