NetBSD Problem Report #53583

From tsutsui@ceres.dti.ne.jp  Fri Sep  7 16:56:24 2018
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 6C6C77A166
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  7 Sep 2018 16:56:24 +0000 (UTC)
Message-Id: <201809071648.w87GmXmG024228@ceres.dti.ne.jp>
Date: Sat, 8 Sep 2018 01:48: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: sysinst in NetBSD/sgimips 8.0 doesn't install bootloader
X-Send-Pr-Version: 3.95

>Number:         53583
>Category:       port-sgimips
>Synopsis:       sysinst in NetBSD/sgimips 8.0 doesn't install bootloader
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    tsutsui
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 07 17:00:00 +0000 2018
>Closed-Date:    Fri Nov 16 15:03:15 +0000 2018
>Last-Modified:  Fri Nov 16 15:03:15 +0000 2018
>Originator:     Izumi Tsutsui
>Release:        NetBSD 8.0
>Organization:
>Environment:
System: NetBSD sgimips 8.0 NetBSD 8.0 (GENERIC32_IP3x) #0: Tue Jul 17 14:59:51 UTC 2018 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/sgimips/compile/GENERIC32_IP3x
Architecture: mipseb
Machine: sgimips
>Description:
It looks sysinst in NetBSD/sgimips 8.0 doesn't install bootloader properly.
See the following dmesg (installed into the disk where 5.2.3 was installed):
 http://dmesgd.nycbug.org/index.cgi?do=view&id=3734

---

                         Running power-on diagnostics...



                           Starting up the system...

               To perform system maintenance instead, press <Esc>

NetBSD/sgimips 5.2.3 Bootstrap, Revision 1.5
(builds@b48.netbsd.org, Sat Nov 15 21:56:41 UTC 2014)

devopen: pci(0)scsi(0)disk(1)rdisk(0)partition(0) type scsi file /netbsd
6745328+134272 [336160+326897]=0x731c90
phys segment: 0xc000 @ 0x2000
adding 0xc000 @ 0x2000 to freelist 0
phys segment: 0xd40000 @ 0x10000
adding 0x56000 @ 0x10000 to freelist 0
adding 0x5be000 @ 0x792000 to freelist 0
phys segment: 0xec00000 @ 0x1400000
adding 0xec00000 @ 0x1400000 to freelist 0
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
    2018 The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 8.0 (GENERIC32_IP3x) #0: Tue Jul 17 14:59:51 UTC 2018
	mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/sgimips/compile/GENERIC32_IP3x

---


Probably "instsys" variable should be initialized by uname(3) earlier
than current md_init_set_status()? (in md_init()?)
 https://nxr.netbsd.org/xref/src/usr.sbin/sysinst/arch/sgimips/md.c?r=1.4#70

---
struct utsname instsys;

void
md_init(void)
{
}

void
md_init_set_status(int flags)
{
	(void)flags;

	/*
	 * Get the name of the Install Kernel we are running under and
	 * enable the installation of the corresponding GENERIC kernel.
	 */
	uname(&instsys);
	if (strstr(instsys.version, "(INSTALL32_IP3x"))
		set_kernel_set(SET_KERNEL_2);
	else if (strstr(instsys.version, "(INSTALL32_IP2x"))
		set_kernel_set(SET_KERNEL_1);
	else if (strstr(instsys.version, "(GENERIC32_IP12"))
		set_kernel_set(SET_KERNEL_3);
}

 :

int
md_post_disklabel(void)
{
	if (strstr(instsys.version, "(INSTALL32_IP3x"))
		return run_program(RUN_DISPLAY,
		    "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
		    pm->diskdev);

	if (strstr(instsys.version, "(INSTALL32_IP2x")) {
		run_program(RUN_DISPLAY,
		  "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot",
		  pm->diskdev);
		return run_program(RUN_DISPLAY,
		  "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot",
		  pm->diskdev);
	}

	/* Presumably an IP12, we add the boot code later... */
	return 0;
}

---

>How-To-Repeat:
Install NetBSD/sgimips 8.0 via sysinst.

>Fix:

1) move a call of uname(&instsys) into md_init()
  -> note there is no ports that have valid ops in md_init()

2) use local auto variables for uname(3) instead of a current
   static instsys and call uname(3) in each function
   (md_init_set_status() and md_post_disklabe() so that
    we don't have to order of initialization)

Note hpcarm, sandpoint, and zaurus use sysctl(2) to get kernel name
to choose a proper kernel set.

---
Izumi Tsutsui

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-sgimips/53583: sysinst in NetBSD/sgimips 8.0 doesn't
 install bootloader
Date: Sat, 8 Sep 2018 16:09:08 +0200

 Did you do a new installation or an update?

 Martin

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: port-sgimips/53583: sysinst in NetBSD/sgimips 8.0 doesn'tinstall
	 bootloader
Date: Sat, 8 Sep 2018 23:42:43 +0900

 >  Did you do a new installation or an update?

 Both. (new on IP32, update on IP22)

 The dmesg is a new installation to disk which has 5.2.3 installation
 with the same partition. (actually sgivol is not called after disklabel)

 ---
 Izumi Tsutsui

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: port-sgimips/53583: sysinst in NetBSD/sgimips 8.0 doesn'tinstall
 bootloader
Date: Sat, 8 Sep 2018 20:07:14 +0200

 On Sat, Sep 08, 2018 at 02:45:01PM +0000, Izumi Tsutsui wrote:
 >  The dmesg is a new installation to disk which has 5.2.3 installation
 >  with the same partition. (actually sgivol is not called after disklabel)

 Hmm, the sgimips machdep code fetches the name of the booted kernel
 in md_init_set_status:

         /*
          * Get the name of the Install Kernel we are running under and
          * enable the installation of the corresponding GENERIC kernel.
          */
         uname(&instsys);
         if (strstr(instsys.version, "(INSTALL32_IP3x"))
                 set_kernel_set(SET_KERNEL_2);
         else if (strstr(instsys.version, "(INSTALL32_IP2x"))
                 set_kernel_set(SET_KERNEL_1);
         else if (strstr(instsys.version, "(GENERIC32_IP12"))
                 set_kernel_set(SET_KERNEL_3);

 and also use that post-disklabel:

 int
 md_post_disklabel(void)
 {  
     if (strstr(instsys.version, "(INSTALL32_IP3x"))
                 return run_program(RUN_DISPLAY,
                     "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
                     pm->diskdev);
 ..


 but does not get the kernel name here itself. So we get all zeros and don't
 match the name, as md_init_set_status is called much later (after the
 user selected which type of installation they will do, Full, Minimal,
 with X, ...).

 Can you test -current? I'll commit a fix in a minute.

 Martin

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53583 CVS commit: src/usr.sbin/sysinst/arch/sgimips
Date: Sat, 8 Sep 2018 18:10:35 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Sep  8 18:10:35 UTC 2018

 Modified Files:
 	src/usr.sbin/sysinst/arch/sgimips: md.c

 Log Message:
 PR port-sgimips/53583: fetch kernel name always before using it.
 Make the struct utsname local to avoid future similar issues.


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/arch/sgimips/md.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: martin@duskware.de, tsutsui@ceres.dti.ne.jp
Subject: Re: port-sgimips/53583: sysinst in NetBSD/sgimips 8.0 doesn'tinstallbootloader
Date: Sun, 9 Sep 2018 11:48:40 +0900

 >  Can you test -current? I'll commit a fix in a minute.

 Ah, upgrade has another (existing) problem.
 md_update() should not call md_post_newfs() (that is empty)
 but md_post_disklabel() (calls sgivol(8) tool):

 Index: md.c
 ===================================================================
 RCS file: /cvsroot/src/usr.sbin/sysinst/arch/sgimips/md.c,v
 retrieving revision 1.5
 diff -u -p -d -r1.5 md.c
 --- md.c	8 Sep 2018 18:10:35 -0000	1.5
 +++ md.c	9 Sep 2018 02:42:56 -0000
 @@ -220,7 +220,7 @@ md_pre_update(void)
  int
  md_update(void)
  {
 -	md_post_newfs();
 +	md_post_disklabel();
  	return 1;
  }


From: Martin Husemann <martin@duskware.de>
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-sgimips/53583: sysinst in NetBSD/sgimips 8.0
 doesn'tinstallbootloader
Date: Sun, 9 Sep 2018 09:28:44 +0200

 On Sun, Sep 09, 2018 at 11:48:40AM +0900, Izumi Tsutsui wrote:
 > Ah, upgrade has another (existing) problem.
 > md_update() should not call md_post_newfs() (that is empty)
 > but md_post_disklabel() (calls sgivol(8) tool):

 Yes, or make md_post_newfs() call md_post_disklabel(). Most architectures
 use that hook to copy usr/mdec/boot* to /boot.

 Martin

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: martin@duskware.de
Cc: gnats-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: port-sgimips/53583: sysinst in NetBSD/sgimips 8.0doesn'tinstallbootloader
Date: Tue, 18 Sep 2018 00:11:42 +0900

 > > Ah, upgrade has another (existing) problem.
 > > md_update() should not call md_post_newfs() (that is empty)
 > > but md_post_disklabel() (calls sgivol(8) tool):
 > 
 > Yes, or make md_post_newfs() call md_post_disklabel(). Most architectures
 > use that hook to copy usr/mdec/boot* to /boot.

 For now I'll commit the original patch (calling md_post_disklabel()
 from md_update() as a simple and tested change.

 Copying bootloader via sgivol(8) doesn't require newfs,
 but I won't bother to confirm why it's done there..
 ---
 Izumi Tsutsui

Responsible-Changed-From-To: port-sgimips-maintainer->tsutsui
Responsible-Changed-By: tsutsui@NetBSD.org
Responsible-Changed-When: Mon, 17 Sep 2018 15:27:31 +0000
Responsible-Changed-Why:
I committed the second part.
http://mail-index.netbsd.org/source-changes/2018/09/17/msg099231.html


State-Changed-From-To: open->needs-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Mon, 17 Sep 2018 15:27:31 +0000
State-Changed-Why:
netbsd-7 and netbsd-8 are affected.


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sat, 22 Sep 2018 08:11:49 +0000
State-Changed-Why:
[pullup-8 #1032] [pullup-7 #1640]


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53583 CVS commit: [netbsd-8] src/usr.sbin/sysinst/arch/sgimips
Date: Sun, 23 Sep 2018 17:49:12 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Sep 23 17:49:12 UTC 2018

 Modified Files:
 	src/usr.sbin/sysinst/arch/sgimips [netbsd-8]: md.c

 Log Message:
 Pull up following revision(s) (requested by tsutsui in ticket #1032):

 	usr.sbin/sysinst/arch/sgimips/md.c: revision 1.5
 	usr.sbin/sysinst/arch/sgimips/md.c: revision 1.6

 PR port-sgimips/53583: fetch kernel name always before using it.

 Make the struct utsname local to avoid future similar issues.
 Make sure to install a bootloader even on upgrade installation.

  -

 Fixes another part of port-sgimips/53583.
 Should be pulled up (with rev 1.5) to netbsd-7 and netbsd-8.


 To generate a diff of this commit:
 cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/usr.sbin/sysinst/arch/sgimips/md.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Stephen Borrill" <sborrill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53583 CVS commit: [netbsd-7] src/usr.sbin/sysinst/arch/sgimips
Date: Tue, 30 Oct 2018 10:14:21 +0000

 Module Name:	src
 Committed By:	sborrill
 Date:		Tue Oct 30 10:14:21 UTC 2018

 Modified Files:
 	src/usr.sbin/sysinst/arch/sgimips [netbsd-7]: md.c

 Log Message:
 Pull up the following revisions(s) (requested by tsutsui in ticket #1640):
 	usr.sbin/sysinst/arch/sgimips/md.c:	revision 1.5-1.6

 PR port-sgimips/53583: fetch kernel name always before using it.
 Make the struct utsname local to avoid future similar issues.
 Make sure to install a bootloader even on upgrade installation.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/usr.sbin/sysinst/arch/sgimips/md.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Fri, 16 Nov 2018 15:03:15 +0000
State-Changed-Why:
Pullups complete.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.