NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: install/55201: 9.0 hp300 sysinst cannot find root partition onupgrade in some case



The following reply was made to PR install/55201; it has been noted by GNATS.

From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: tsutsui%ceres.dti.ne.jp@localhost
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
 


Home | Main Index | Thread Index | Old Index