Subject: bin/26708: disklabel -wr deletes the bootcode from the netbsd partition
To: None <>
From: None <>
List: netbsd-bugs
Date: 08/18/2004 22:07:34
>Number:         26708
>Category:       bin
>Synopsis:       disklabel -wr deletes the bootcode from the netbsd partition
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 18 21:07:00 UTC 2004
>Originator:     David Laight
>Release:        NetBSD 2.0
	Current as of 18 Aug 2004
Architecture: i386
Machine: i386
	disklabel is compiled with SAVEBOOTAREA, the intention of this code
	is to preserve the disk's boot code.
	However the effect is entirely different!
	The SAVEBOOTAREA code reads 8k from the sector 0, and zeros out
	the part that (is expected to) contain the label.
	The new label is then written into the space, and the entire 8k
	written to the beginning of partition 2.
	The effect is to replace the partition boot code of whichever
	partition the user said was the mbr (type 169) partition with the
	mbr boot code.

	When you try to boot that partition, the bootselect code just
	re-reads another copy of the mbr code - and redisplays the menu.
	Run sysinst and install multiple copies of netbsd.
	Simplify disklabel, and rework its logic so that the write is
	done as a 'read modify write'.
	The disklabel should also be written to all of the NetBSD mbr
	partition that exist onthe disk.
	Maybe just fix it to find the old sectors using the same rules
	as are used to write the label.