NetBSD Problem Report #55201

From tsutsui@ceres.dti.ne.jp  Thu Apr 23 17:32:39 2020
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 391851A9218
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 23 Apr 2020 17:32:39 +0000 (UTC)
Message-Id: <202004231732.03NHWXwg026353@ceres.dti.ne.jp>
Date: Fri, 24 Apr 2020 02:32:33 +0900 (JST)
From: Izumi tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: 9.0 hp300 sysinst cannot find root partition on upgrade in some case
X-Send-Pr-Version: 3.95

>Number:         55201
>Category:       install
>Synopsis:       9.0 hp300 sysinst cannot find root partition on upgrade in some case
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    martin
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 23 17:35:00 +0000 2020
>Last-Modified:  Thu May 14 18:55:01 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0
>Organization:
>Environment:
System: NetBSD 9.0 (RAMDISK) #0: Fri Feb 14 00:06:28 UTC 2020   mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/hp300/compile/RAMDISK
Architecture: m68k
Machine: hp300
>Description:
When I tried to upgrade my HP9000/382 to NetBSD/hp300 9.0,
sysinst complained "No root partition defined.  Cannot continue"
just after selecting the target disk.

Note the similar upgrade installation on my other hp300
(362, 425t, and 425e) from 8.0 there were no such error,
so there is some specific conditions.

---

 NetBSD/hp300 9.0

 This menu-driven tool is designed to help you install NetBSD to a hard disk,
 or upgrade an existing NetBSD system, with a minimum of work.
 In the following menus type the reference letter (a, b, c, ...) to select an
 item, or type CTRL+N/CTRL+P to select the next/previous item.
 The arrow keys and Page-up/Page-down may also work.
 Activate the current selection from the menu by typing the enter key.
 If your machine has 4MB or less, sysinst will not operate correctly.

 Thank you for using NetBSD!

                NetBSD-9.0 Install System                     

                a: Install NetBSD to hard disk                
               >b: Upgrade NetBSD on a hard disk              
                c: Re-install sets or install additional sets 
                d: Reboot the computer                        
                e: Utility menu                               
                f: Config menu                                
                x: Exit Install System                        


---

 Ok, let's upgrade NetBSD on your hard disk.  As always, this will change
 information on your hard disk.  You should have made a full backup before
 this procedure!  Do you really want to upgrade NetBSD?  (This is your last  
 warning before this procedure starts modifying your disks.)  






                                Yes or no?    

                                a: No         
                               >b: Yes        


---

 On which disk do you want to upgrade NetBSD?



                              Available disks                                 

                              a: current system                               
                             >b: sd0 (2.2G)                                   
                              x: Exit                                         


---

 No root partition defined.  Cannot continue 









                           >Hit enter to continue 


---

The target sd0 has the following disklabel:
---
# disklabel sd0
# /dev/rsd0:
type: unknown
disk: M2952S-512     
label: 
flags:
bytes/sector: 512
sectors/track: 164
tracks/cylinder: 5
sectors/cylinder: 820
cylinders: 5714
total sectors: 4685480
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   4422260       820     4.2BSD   2048 16384     0  # (Cyl.      1 -   5393)
 b:    262400   4423080       swap                     # (Cyl.   5394 -   5713)
 c:   4685480         0     unused      0     0        # (Cyl.      0 -   5713)
 d:       820         0       boot                     # (Cyl.      0 -      0)
# 
---

Note partition d is used to store MD bootloader.

/etc/fstab in the sd0a is:
---
# cat /mnt/etc/fstab
/dev/sd0a		/		ffs	rw,log 1 1
/dev/sd0b		none		swap	sw 0 0
swap			/tmp		mfs	rw,-s=16m 0 0
kernfs			/kern		kernfs	rw 0 0
procfs			/proc		procfs	rw 0 0
ptyfs			/dev/pts	ptyfs	rw 0 0

tmpfs	/var/shm	tmpfs	rw,-m1777,-sram%25
# 

---

dmesg is here:
---
[   1.0000000] bootinfo found at 0xfe802000
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[   1.0000000]     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[   1.0000000]     2018, 2019, 2020 The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All rights reserved.

[   1.0000000] NetBSD 9.0 (RAMDISK) #0: Fri Feb 14 00:06:28 UTC 2020
[   1.0000000]  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/hp300/compile/RAMDISK
[   1.0000000] HP 9000/382 (25MHz MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches)
[   1.0000000] total memory = 24564 KB
[   1.0000000] avail memory = 19456 KB
[   1.0000000] timecounter: Timecounters tick every 10.000 msec
[   1.0000000] mainbus0 (root)
[   1.0000000] intio0 at mainbus0
[   1.0000000] rtc0 at intio0 addr 0x420000
[   1.0000000] frodo0 at intio0 addr 0x41c000 ipl 5
[   1.0000000] dnkbd at frodo0 offset 0x0 not configured
[   1.0000000] com0 at frodo0 offset 0x40: ns8250 or ns16450, no fifo
[   1.0000000] com1 at frodo0 offset 0x60: ns8250 or ns16450, no fifo
[   1.0000000] hil0 at intio0 addr 0x428000 ipl 1
[   1.0000000] hpib at intio0 not configured
[   1.0000000] dma0 at intio0 addr 0x500000 ipl 1: 98620C, 2 channels, 32-bit DMA
[   1.0000000] dio0 at mainbus0
[   1.0000000] com2 at dio0 scode 9 ipl 5: ns16550a, working fifo
[   1.0000000] com2: console
[   1.0000000] device id = 0x6 secid = 0x0 at dio0 scode 12 ipl 3 not configured
[   1.0000000] dcm0 at dio0 scode 13 ipl 3
[   1.0000000] spc0 at dio0 scode 14 ipl 4: 98265A SCSI, 32-bit DMA, SCSI ID 7
[   1.0000000] scsibus0 at spc0: 8 targets, 8 luns per target
[   1.0000000] le0 at dio0 scode 21 ipl 5: address 08:00:09:18:d8:d2
[   1.0000000] le0: 8 receive buffers, 2 transmit buffers
[   1.0000000] gendiofb0 at dio0 scode 132 ipl 3: 1024x768x8 frame buffer
[   1.0000000] wsdisplay0 at gendiofb0 kbdmux 1
[   1.0000000] wsmux1: connecting to wsdisplay0
[   1.0000000] wsdisplay0: screen 0 added (std, vt100 emulation)
[   1.0000000] timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
[   1.0000110] timecounter: Timecounter "mc6840" frequency 250000 Hz quality 100
[   1.0091310] scsibus0: waiting 2 seconds for devices to settle...
[   2.0486350] hil0: no devices
[   3.0882430] sd0 at scsibus0 target 0 lun 0: <FUJITSU, M2952S-512, 0147> disk fixed
[   3.1182270] sd0: 2291 MB, 5714 cyl, 5 head, 164 sec, 512 bytes/sect x 4693462 sectors
[   3.1482030] sd0: async, 8-bit transfers
[   3.1682190] sd1 at scsibus0 target 1 lun 0: <TEAC, FC-1     HF   07, RV A> disk removable
[   3.2181790] sd1(spc0:0:1:0): not ready, data = 00 00 00 00 04 00 00 00
[   3.2790110] sd1: drive offline
[   3.3081470] sd1: async, 8-bit transfers
[   3.5380390] boot device: le0
[   3.5500510] md0: internal 1800 KB image area
[   3.5500510] root on md0a dumps on md0b
[   3.5780390] root file system type: ffs
[   3.5955270] kern.module.path=/stand/hp300/9.0/modules
[   3.6280030] WARNING: clock gained 71 days

---

Note sd1 is a SCSI floppy drive and it's empty.

On hp425t (i.e. no error during upgrade), the disklabel is:
---
 disklabel sd0
# /dev/rsd0:
type: unknown
disk: sd
label: fictious
flags:
bytes/sector: 512
sectors/track: 705
tracks/cylinder: 2
sectors/cylinder: 1410
cylinders: 50824
total sectors: 71687372
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:  70610429      1410     4.2BSD      0     0     0  # (Cyl.      1 -  50079*)
 b:   1048576  70611840       swap                     # (Cyl.  50079*-  50822*)
 c:  71687372         0     unused      0     0        # (Cyl.      0 -  50842*)
 d:      1410         0       boot                     # (Cyl.      0 -      0)
# 

---


>How-To-Repeat:
See above.

>Fix:
No idea.
(it's a bit hard for me to parse find_disks() in sysinst/disks.c)

---
Izumi Tsutsui

>Release-Note:

>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: install/55201: 9.0 hp300 sysinst cannot find root partition on
	 upgrade in some case
Date: Fri, 24 Apr 2020 03:14:32 +0900

 I wrote:

 > The target sd0 has the following disklabel:
 > ---
  :
 > 8 partitions:
 > #        size    offset     fstype [fsize bsize cpg/sgs]
 >  a:   4422260       820     4.2BSD   2048 16384     0  # (Cyl.      1 -   5393)
 >  b:    262400   4423080       swap                     # (Cyl.   5394 -   5713)
 >  c:   4685480         0     unused      0     0        # (Cyl.      0 -   5713)
 >  d:       820         0       boot                     # (Cyl.      0 -      0)
 > # 

 I've edited the disklabel on the target disk and
 change "8 partitons:" to "4 partitions:" then
 sysinst upgrade proceeds properly.

 Maybe sysinst(8) should accept "N partitions" larger than
 existing entries?
 (at least disklabel(8) command doesn't complain for it
  and it is a bit useful for users for future additions)

 ---
 Izumi Tsutsui

Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Thu, 23 Apr 2020 18:46:09 +0000
Responsible-Changed-Why:
take


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: install/55201: 9.0 hp300 sysinst cannot find root partition onupgrade
	 in some case
Date: Fri, 15 May 2020 03:54:05 +0900

 > I've edited the disklabel on the target disk and
 > change "8 partitons:" to "4 partitions:" then
 > sysinst upgrade proceeds properly.
 > 
 > Maybe sysinst(8) should accept "N partitions" larger than
 > existing entries?
 > (at least disklabel(8) command doesn't complain for it
 >  and it is a bit useful for users for future additions)

 It turns out this analysis was not correct.
 I cannot reproduce this even after change it to "4 partitions:".

 The "No root partition defined." error is triggered by
 mount_disks() ins src/usr.sbin/sysinst/disks.c:
  https://nxr.netbsd.org/xref/src/usr.sbin/sysinst/disks.c?r=1.67#1843
 ---
    1843 	/* First the root device. */
    1844 	if (target_already_root()) {
    1845 		/* avoid needing to call target_already_root() again */
    1846 		targetroot_mnt[0] = 0;
    1847 	} else if (pm->no_part) {
    1848 		snprintf(devdev, sizeof devdev, _PATH_DEV "%s", pm->diskdev);
    1849 		error = mount_root(devdev, true, false, install);
    1850 		if (error != 0 && error != EBUSY)
    1851 			return -1;
    1852 	} else {
    1853 		for (i = 0; i < install->num; i++) {
    1854 			if (is_root_part_mount(install->infos[i].mount))
    1855 				break;
    1856 		}
    1857 
    1858 		if (i >= install->num) {
 -> 1859 			hit_enter_to_continue(MSG_noroot, NULL);
    1860 			return -1;
    1861 		}

 ---

 Actually is_root_part_mount() in src/usr.sbin/sysinst/target.c fails
 in my case:
  https://nxr.netbsd.org/xref/src/usr.sbin/sysinst/target.c?r=1.13#208
 ---
     208 /*
     209  * Could something with this "last mounted on" information be a potential
     210  * root partition?
     211  */
     212 bool
     213 is_root_part_mount(const char *last_mounted)
     214 {
     215 	if (last_mounted == NULL)
     216 		return false;
     217 
     218 	return strcmp(last_mounted, "/") == 0 ||
     219 	    strcmp(last_mounted, "/targetroot") == 0 ||
     220 	    strcmp(last_mounted, "/altroot") == 0;
     221 }
 ---

 The sd0 disk on my HP382 was last mounted on "/mnt" because
 I netbooted it to put netbsd-RAMDISK kernel into sd0a root.
 (I know this is not standard procedure, though)

 I've confirmed it works if it's last mounted on "/" or "/targetroot"
 but fails with the "No root partition defined." message if it's "/mnt".

 Maybe it's better to note this features and ask users with proper
 confirmation messages.

 Thanks,

 ---
 Izumi Tsutsui

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.