Subject: Re: port-i386/25113: 2.0: fdisk(8) unusable for boot selector manipulation
To: None <netbsd-bugs@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 05/08/2004 19:09:12
> >Synopsis:       2.0: fdisk(8) unusable for boot selector manipulation
=20
You need to read the relevant man pages, fdisk's semantics cchanged.

> 	Short:
> 	 1) fdisk -i doesn't remove bootselector

True - it will (aka should) reinstall the correct bootcode for your setup.

>  	 2) fdisk -B doesn't list/edit bootable partitions

True - the bootmenu entries are configured with the partition details.

> 	 3) fdisk -u -B leads to "Invalid partition table" when booting

Not sure.  The only 'Invalid partition table' text I can find refers to
the ERR_INVPART ('1') error in mbr.S - which is really 'no active partition=
'.

It is possibly the fdisk lets you 'shoot yourself in the foot'...

> 	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"

It is in the documantation somewhere - and is relevant to several archs.

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

Nothing should have stopped that working - provided you new root filesystem
is still at the start of the mbr partition.

> 	Booting 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.
>=20
> =3D=3D=3D> 1)	OK, "fdisk -i wd0 && reboot" =3D> no go, bootselector still
> 	installed.  It seems that this command didn't do anything at all.
>=20
> 	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).
>=20
> =3D=3D=3D> 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.
>=20
> =3D=3D=3D> 3) I got the bootselector entries back via "fdisk -u", which a=
lso
> 	gave me a list of bootable partitions on "fdisk -B".

Ok - that is how it is expected to work.
You only need to specify -B to change the timeout and action on timeout.

>       Yet selecting my NetBSD partition on bootup gave me "Invalid partit=
ion
> 	table".

It has all worked every time I've run it.
=20
> 	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.

I believe sysinst gets install and update right (now).

It is possibly that a recent change to mbr.S (to put in the correct
magic numbers) may have fixed some of these problems.

	David

--=20
David Laight: david@l8s.co.uk