Subject: bin/20977: /usr/sbin/installboot fails on alternative disks
To: None <>
From: None <>
List: netbsd-bugs
Date: 04/01/2003 19:51:30
>Number:         20977
>Category:       bin
>Synopsis:       /usr/sbin/installboot fails on alternative disks
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 01 18:52:01 PST 2003
>Originator:     Jim Bernard
>Release:        NetBSD 1.6I
System: NetBSD knox 1.6I NetBSD 1.6I (KNOX-$Revision: 1.20 $) #0: Sun Oct 13 19:57:00 MDT 2002 jim@roc:/wd1/var/tmp/compile/sys/arch/sparc/compile/KNOX sparc
Architecture: sparc
Machine: sparc
	I wanted to install fresher boot blocks on a second disk on a
	sparc 20, but the MI installboot refused to install them if the
	secondary boot code was anyplace but root, which of course it
	isn't if you're installing on a second disk.  I don't know for
	sure whether this would also happen on other ports with MI
	installboot, but I expect so.

	Copy the system to an alternative disk, here assumed to have its
	root partition on sd2a.  Then, in single-user mode:

	  mount /dev/sd2a /altdisk
	  cp -p /altdisk/usr/mdec/boot /altdisk/boot
	  /altdisk/usr/sbin/installboot -v -m sparc /dev/rsd2a /altdisk/usr/mdec/bootxx /altdisk/boot

	The response from installboot is:

	  File system:         /dev/rsd2a
	  File system type:    ffs (blocksize 8192, needswap 0)
	  Primary bootstrap:   /altdisk/usr/mdec/bootxx
	  Secondary bootstrap: /altdisk/boot
	  installboot: The secondary bootstrap `altdisk/boot' must be in /
	  installboot: Set bootstrap operation failed

	A workaround is to boot with -a and specify the alternative disk
	as the root device.  This might fail if the kernel and init aren't
	compatible, but I guess you can specify an alternative init, too.
	But it shouldn't have to be done this way.

	The section of the code that does the check (in ffs.c) begins with:

	  /* The secondary bootstrap must be clearly in /. */

	which is wrong, given that one frequently wants to install boot
	code on a disk other than the one that was booted (e.g., when
	first installing from a floppy).  I would recommend either simply
	deleting the check or adding a command-line option to override it.
	My vote would be for the former.  But as long as I can install boot
	blocks anywhere I want without having to stand on my head and form
	a pretzel, I'll be happy.