NetBSD Problem Report #7608

Received: (qmail 29948 invoked by uid 1000); 19 May 1999 05:58:06 -0000
Message-Id: <19990519055806.29947.qmail@mail.netbsd.org>
Date: 19 May 1999 05:58:06 -0000
From: cgd@netbsd.org
Reply-To: cgd@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: i386 1.4 sysinst upgrade fall down go BOOM!
X-Send-Pr-Version: 3.92

>Number:         7608
>Category:       port-i386
>Synopsis:       i386 1.4 sysinst upgrade fall down go BOOM!
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 18 23:05:00 +0000 1999
>Closed-Date:    Sat Nov 04 18:43:24 +0000 2000
>Last-Modified:  Sat Nov 04 18:43:24 +0000 2000
>Originator:     Chris G. Demetriou
>Release:        1.4
>Organization:
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
>Environment:
System: NetBSD speedy 1.4 NetBSD 1.4 (SPEEDY) #18: Tue May 18 12:17:14 PDT 1999 cgd@speedy:/a/users/cgd/proj/netbsd/src-1-4-branch/sys/arch/i386/compile/SPEEDY i386

>Description:
	[ This bug filed under port-i386 because the thing that
	actually caused the crash may well be i386-specific.  However,
	some of the things necessary to completely fix the problem are
	mostly machine-independent. ]

	I tried using NetBSD/i386 1.4 sysinst to upgrade a ppro 200 system
	which has only NetBSD/i386 installed.

	sysinst blew up (Floating Point Exception, core dump) after
	installing the installation binaries on the hard disk and running
	installboot.  I ran sysinst with logging and scripting turned
	on, and the last thing in the script was:

/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/rsd0a 

	and in the log was:

executing: /usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/rsd0a 
/usr/mdec/biosboot.sym: entry point 0x202000
proto bootblock size 41984
room for 10 filesystem blocks at 0x580
renamed /mnt/boot -> /mnt/boot.bak
Will load 67 blocks.
dblk: 4832, num: 16
dblk: 4848, num: 16
dblk: 4864, num: 16
dblk: 4880, num: 16
dblk: 4678, num: 3
BSD partition starts at sector 63
deleting /mnt/boot.bak

	Therefore, i'd guess that something it was trying to do after
	it installed the new boot block caused it to blow up.

	This had several bad side effects, aside from making upgrade
	via sysinst impossible:

	* it left the tty modes on the console tty screwed up, which was
	fixable easily enough (for someone who more or less knows the
	'right' default tty flags 8-), but worse

	* it copied the installation binaries to the hard disk, thereby
	rendering the existing filesystem unbootable.  (init would
	croak with signal 12 -- SIGSYS).

	The fdisk and disklabel information on the system's sole disk is:

24 [speedy] cgd % fdisk /dev/rsd0d
NetBSD disklabel disk geometry:
cylinders: 5172 heads: 10 sectors/track: 162 (1620 sectors/cylinder)

BIOS disk geometry:
cylinders: 522 heads: 255 sectors/track: 63 (16065 sectors/cylinder)

Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: sysid 165 (FreeBSD or 386BSD or old NetBSD)
    start 63, size 8385867 (4094 MB), flag 0x80
        beg: cylinder    0, head   1, sector  1
        end: cylinder  521, head 254, sector 63
25 [speedy] cgd % disklabel sd0
disklabel: old BSD partition ID!
# /dev/rsd0d:
type: SCSI
disk: mydisk
label: 
flags:
bytes/sector: 512
sectors/track: 162
tracks/cylinder: 10
sectors/cylinder: 1620
cylinders: 5172
total sectors: 8378640
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0 

7 partitions:
#        size   offset     fstype   [fsize bsize   cpg]
  a:   532980       63     4.2BSD     1024  8192    16   # (Cyl.    0*- 329*)
  b:   532917   533043       swap                        # (Cyl.  329*- 657)
  c:  8378577       63     unused        0     0         # (Cyl.    0*- 5171)
  d:  8378640        0     unused        0     0         # (Cyl.    0 - 5171)
  e:  3146040  1065960     4.2BSD     1024  8192    16   # (Cyl.  658 - 2599)
  f:  2083320  4212000     4.2BSD     1024  8192    16   # (Cyl. 2600 - 3885)
  g:  2083320  6295320     4.2BSD     1024  8192    16   # (Cyl. 3886 - 5171)

	I can provide additional information if it would be helpful.

>How-To-Repeat:
	Probably try to use i386 1.4 sysinst to upgrade other disks...

>Fix:
	Unknown.  However, it has the following components:

	* when sysinst gets a fatal signal, catch it, print out relevant
	debugging information, and do what can be done to reset the tty
	modes before exiting.

	* If possible, don't copy the install binaries to the hard disk.
	On the i386, this was necessary in the past to facilitate floppy
	installation and/or use of tools on multiple floppies.  However,
	we're now running from ramdisk, and I don't see why it's necessary
	any longer.

	* Kill the particular bug that caused this crash, so that sysinst
	might be usable for upgrades.
>Release-Note:
>Audit-Trail:

From: Ed Gould <ed@left.wing.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  Subject: Re: port-i386/7608: i386 1.4 sysinst upgrade fall down go BOOM! 
Date: Wed, 16 Jun 1999 13:23:51 -0700

 I tripped on this bug last night, too.  Here's a tad more information.

 >>Number:         7608
 >>Category:       port-i386
 >>Synopsis:       i386 1.4 sysinst upgrade fall down go BOOM!
 >>Confidential:   no
 >>Severity:       critical
 >>Priority:       high
 >>Responsible:    port-i386-maintainer (NetBSD/i386 Portmaster)
 >>State:          open
 >>Class:          sw-bug
 >>Submitter-Id:   net
 >>Arrival-Date:   Tue May 18 23:05:00 1999
 >>Last-Modified:
 >>Originator:     Chris G. Demetriou
 >>Organization:
 > Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
 > Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
 >>Release:        NetBSD 1.4
 >>Environment:
 > System: NetBSD speedy 1.4 NetBSD 1.4 (SPEEDY) #18: Tue May 18 12:17:14 PDT 19
 > 99 cgd@speedy:/a/users/cgd/proj/netbsd/src-1-4-branch/sys/arch/i386/compile/S
 > PEEDY i386
 > 
 >>Description:
 > 	[ This bug filed under port-i386 because the thing that
 > 	actually caused the crash may well be i386-specific.  However,
 > 	some of the things necessary to completely fix the problem are
 > 	mostly machine-independent. ]
 > 
 > 	I tried using NetBSD/i386 1.4 sysinst to upgrade a ppro 200 system
 > 	which has only NetBSD/i386 installed.
 > 
 > 	sysinst blew up (Floating Point Exception, core dump) after
 > 	installing the installation binaries on the hard disk and running
 > 	installboot.  I ran sysinst with logging and scripting turned
 > 	on, and the last thing in the script was:
 > 
 > /usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/rsd0a 
 > 
 > 	and in the log was:
 > 
 > executing: /usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/rsd0a 
 > /usr/mdec/biosboot.sym: entry point 0x202000
 > proto bootblock size 41984
 > room for 10 filesystem blocks at 0x580
 > renamed /mnt/boot -> /mnt/boot.bak
 > Will load 67 blocks.
 > dblk: 4832, num: 16
 > dblk: 4848, num: 16
 > dblk: 4864, num: 16
 > dblk: 4880, num: 16
 > dblk: 4678, num: 3
 > BSD partition starts at sector 63
 > deleting /mnt/boot.bak
 > 
 > 	Therefore, i'd guess that something it was trying to do after
 > 	it installed the new boot block caused it to blow up.

 The code in sysinst/upgrade.c calls md_update(), which does (for i386, at 
 least)

 	md_copy_filesystem();		// puts install binaries on disk
 	md_post_newfs();		// runs installboot -v
 	md_upgrade_mbrtype();		// changes to new MBR ID

 The second of these steps was at least started; I can't tell if it completed 
 or not.  Chris' notes suggest that it did, but I haven't looked at the 
 installboot code to see if it does anything after deleting boot.bak.  The MBR 
 ID on the disk did not get changed, so the third step did not complete.  The 
 code in md_upgrade_mbrtype() looks ok, so it might be either read_mbr() or 
 write_mbr() that is the culprit (if it isn't the tail end of installboot).

 > 	This had several bad side effects, aside from making upgrade
 > 	via sysinst impossible:
 > 
 > 	* it left the tty modes on the console tty screwed up, which was
 > 	fixable easily enough (for someone who more or less knows the
 > 	'right' default tty flags 8-), but worse

 "stty sane" suffices, so not much knowledge is necessary :-)

 > 	* it copied the installation binaries to the hard disk, thereby
 > 	rendering the existing filesystem unbootable.  (init would
 > 	croak with signal 12 -- SIGSYS).
 > 
 > 	The fdisk and disklabel information on the system's sole disk is:

 Elided.  My disk was IDE, not SCSI, so that isn't relevant.  The machine, 
 however, was also a PPro/200; the same base hardware as Chris used.

 >>How-To-Repeat:
 > 	Probably try to use i386 1.4 sysinst to upgrade other disks...

 Yup!

 >>Fix:
 > 	Unknown.  However, it has the following components:
 > 
 > 	* when sysinst gets a fatal signal, catch it, print out relevant
 > 	debugging information, and do what can be done to reset the tty
 > 	modes before exiting.

 This would be nice, but it's not all that hard to recover the tty modes.

 > 	* If possible, don't copy the install binaries to the hard disk.
 > 	On the i386, this was necessary in the past to facilitate floppy
 > 	installation and/or use of tools on multiple floppies.  However,
 > 	we're now running from ramdisk, and I don't see why it's necessary
 > 	any longer.

 This would have saved me *much* grief!

 > 	* Kill the particular bug that caused this crash, so that sysinst
 > 	might be usable for upgrades.

 Or at least describe the details of the upgrade process in the Install 
 document, so it can be done by hand without perusing the sysinst code.

 	--Ed



From: cgd@netbsd.org (Chris G. Demetriou)
To: netbsd-bugs@netbsd.org
Cc:  Subject: Re: port-i386/7608: i386 1.4 sysinst upgrade fall down go BOOM!
Date: 18 Jun 1999 01:06:24 -0700

 cgd@netbsd.org writes:
 > 	sysinst blew up (Floating Point Exception, core dump) after
 > 	installing the installation binaries on the hard disk and running
 > 	installboot.  I ran sysinst with logging and scripting turned
 > 	on, and the last thing in the script was:

 I investigated this some more.

 The problem is trivially reproducable (if you have a disk to nuke 8-):

 	* boot the 1.3.2 install floppy, install NetBSD.
 	  standard + x, whole disk.  have it clobber the disk.
 	  when it gets to the point of trying to install sets,
 	  reboot.

 	* boot the 1.4 install floppy, upgrade.  follow the prompts,
 	  boom.

 I dug into the problem some more, and found that when writing the
 upgraded MBR, convert_mbr_chs() was called with cyl == head == sec ==
 0.  Since these arguments' values come from globals which are
 initialized when the BIOS geometry is figured in md_bios_info(), it
 would seem that md_bios_info() should be being called but isn't.

 Unfortunately, I'm not really familiar enough with the way this should
 work to know where it should be called.  (However, this doesn't sound
 like a configuration-specific bug...  was the upgrade code _ever_
 tested by the people hacking on it?!)


 Things which I noticed which also caused me concern:

 in md_upgrade_mbrtype(), read_mbr() is called.  If an error occurs
 md_upgrade_mbrtype gives up (but doesn't signal an error -- should it
 be able to?  probably it should be _able_ to, if not for this case
 then for the case where write_mbr fails).  However, if no error occurs
 bu the MBR is not actually valid, it continues merrily along.  It's
 not clear to me that this is 'right'.

 in md_get_info(), the return value from read_mbr() is ignored
 completely, but valid_mbr() is checked...  This seems like it might be
 OK, but consistency and carefulness are better than the lack
 thereof...




 cgd
 -- 
 Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
 Disclaimer: Not speaking for NetBSD, just expressing my own opinion.

From: cgd@netbsd.org (Chris G. Demetriou)
To: netbsd-bugs@netbsd.org
Cc:  
Subject: Re: port-i386/7608: i386 1.4 sysinst upgrade fall down go BOOM!
Date: 18 Jun 1999 01:06:24 -0700

 cgd@netbsd.org writes:
 > 	sysinst blew up (Floating Point Exception, core dump) after
 > 	installing the installation binaries on the hard disk and running
 > 	installboot.  I ran sysinst with logging and scripting turned
 > 	on, and the last thing in the script was:

 I investigated this some more.

 The problem is trivially reproducable (if you have a disk to nuke 8-):

 	* boot the 1.3.2 install floppy, install NetBSD.
 	  standard + x, whole disk.  have it clobber the disk.
 	  when it gets to the point of trying to install sets,
 	  reboot.

 	* boot the 1.4 install floppy, upgrade.  follow the prompts,
 	  boom.

 I dug into the problem some more, and found that when writing the
 upgraded MBR, convert_mbr_chs() was called with cyl == head == sec ==
 0.  Since these arguments' values come from globals which are
 initialized when the BIOS geometry is figured in md_bios_info(), it
 would seem that md_bios_info() should be being called but isn't.

 Unfortunately, I'm not really familiar enough with the way this should
 work to know where it should be called.  (However, this doesn't sound
 like a configuration-specific bug...  was the upgrade code _ever_
 tested by the people hacking on it?!)


 Things which I noticed which also caused me concern:

 in md_upgrade_mbrtype(), read_mbr() is called.  If an error occurs
 md_upgrade_mbrtype gives up (but doesn't signal an error -- should it
 be able to?  probably it should be _able_ to, if not for this case
 then for the case where write_mbr fails).  However, if no error occurs
 bu the MBR is not actually valid, it continues merrily along.  It's
 not clear to me that this is 'right'.

 in md_get_info(), the return value from read_mbr() is ignored
 completely, but valid_mbr() is checked...  This seems like it might be
 OK, but consistency and carefulness are better than the lack
 thereof...




 cgd
 -- 
 Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
 Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
State-Changed-From-To: open->feedback 
State-Changed-By: tv 
State-Changed-When: Fri Nov 3 11:02:26 PST 2000 
State-Changed-Why:  
The only thing not addressed is the non-robustness of sysinst in a signal 
catch condition, which is not really the purpose of this PR.  OK to close, 
possibly pending a separate PR on this issue? 

From: cgd@netbsd.org (Chris G. Demetriou)
To: tv@netbsd.org
Cc: port-i386-maintainer@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: port-i386/7608
Date: 03 Nov 2000 16:45:20 -0800

 tv@netbsd.org writes:
 > The only thing not addressed is the non-robustness of sysinst in a signal
 > catch condition, which is not really the purpose of this PR.  OK to close,
 > possibly pending a separate PR on this issue?

 Sure.  It _would_ be good if the signal-catching issue were handled in
 some sane way, though...


 cgd
 -- 
 Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
 Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
State-Changed-From-To: feedback->closed 
State-Changed-By: tv 
State-Changed-When: Sat Nov 4 10:43:06 PST 2000 
State-Changed-Why:  
Close authorized by author. 
>Unformatted:

 Status as of 19990618:

 >	* when sysinst gets a fatal signal, catch it, print out relevant
 >	debugging information, and do what can be done to reset the tty
 >	modes before exiting.

 Not yet addressed.

 >	* If possible, don't copy the install binaries to the hard disk.
 >	On the i386, this was necessary in the past to facilitate floppy
 >	installation and/or use of tools on multiple floppies.  However,
 >	we're now running from ramdisk, and I don't see why it's necessary
 >	any longer.

 This has been fixed (for i386 and alpha) in -current and pullup requests
 have been submitted for 1.4.1.

 >	* Kill the particular bug that caused this crash, so that sysinst
 >	might be usable for upgrades.

 This chunk has been analyzed.  See the anaylsis above.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.