NetBSD Problem Report #54745

From gson@gson.org  Sat Dec  7 15:18:14 2019
Return-Path: <gson@gson.org>
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 3A9A67A164
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  7 Dec 2019 15:18:14 +0000 (UTC)
Message-Id: <20191207151808.A414F253FE6@guava.gson.org>
Date: Sat,  7 Dec 2019 17:18:08 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: Sysinst generates strange i386 partition table
X-Send-Pr-Version: 3.95

>Number:         54745
>Category:       install
>Synopsis:       Sysinst generates strange i386 partition table
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 07 15:20:00 +0000 2019
>Closed-Date:    Wed Apr 22 06:54:14 +0000 2020
>Last-Modified:  Wed Apr 22 06:54:14 +0000 2020
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date 2019.11.30.04.06.22
>Organization:
>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:

When I try to install a week-old NetBSD-current/i386 on an unused
MBR partition of a laptop with an existing Linux installation,
I end up with the following sysinst screen.  It's confusing me
because there is no swap partition, the NetBSD portion of the
disk is called "b" rather than "c", and the whole disk is called
"c" rather than "d":

   We now have your disklabel partitions for wd1 below.  This is your last 
   chance to change them. 

   Flags: (N)ewfs.  Total size: 75G, free: 128M

        Start (MB)     End (MB)    Size (MB)  FS type Flag Filesystem
      ------------ ------------ ------------ -------- ---- ----------------
   a:        76294       152459        76166    FFSv2 N    /
   b:        76294       152587        76294 NetBSD partition
   c:            0       238474       238475 Whole disk
      ------------ ------------ ------------ -------- ---- ----------------
   e: Add a partition
   f: Change input units (sectors/cylinders/MB/GB)
   g: Edit name of the disk
   h: Clone external partition(s)
   i: Cancel
  >x: Partition sizes ok

>How-To-Repeat:

Build a NetBSD-current/i386 install image using "build.sh
install-image" and uncompress it into NetBSD-9.99.18-i386-install.img.

Save the following uuencoded copy of the actual MBR from the laptop as
"mbr.uu":

begin 644 mbr
MZV.0$([0O`"PN```CMB.P/N^`'R_``:Y``+SI.HA!@``OKX'.`1U"X/&$('^
M_@=U\^L6M`*P`;L`?+*`BG0!BTP"S1/J`'P``.O^````````````````````
M`(`!`````````/_ZD)#VPH!T!?;"<'0"LH#J>7P``#'`CMB.T+P`(/N@9'P\
M_W0"B,)2OH!]Z!<!O@5\M$&[JE7-$UI2<CV!^U6J=3>#X0%T,C'`B40$0(A$
M_XE$`L<$$`!FBQY<?&:)7`AFBQY@?&:)7`S'1`8`<+1"S1-R!;L`<.MVM`C-
M$W,-]L*`#X38`+Z+?>F"`&8/ML:(9/]`9HE$!`^VT<'B`HCHB/1`B40(#[;"
MP.@"9HD$9J%@?&8)P'5.9J%<?&8QTF;W-(C1,=)F]W0$.T0(?3?^P8C%,,#!
MZ`((P8C06HC&NP!PCL,QV[@!`LT3<AZ,PV`>N0`!CMLQ]K\`@([&_/.E'V'_
M)EI\OH9]ZP.^E7WH-`"^FGWH+@#-&.O^1U)50B``1V5O;0!(87)D($1I<VL`
M4F5A9``@17)R;W(-"@"[`0"T#LT0K#P`=?3#``````````"N;@@```"`("$`
M@_[__P`(````*%`)`/[__X/^__\`,%`)`#!0"0#^__^#_O__`&"@$@`P4`D`
1_O__@O[__P"0\!L`R"L!5:H`
`
end

Create a hard disk image of the same size as the laptop disk, as a
sparse file so that it won't take up too much acutal space:

  uudecode mbr.uu
  cp mbr hd
  dd if=/dev/zero of=hd bs=512 seek=488397167 count=1

Boot the install image in qemu:

  qemu-system-i386 -nographic -snapshot -hda NetBSD-9.99.18-i386-install.img -hdb hd

Choose your terminal type

Choose your keyboard type

Answer the other sysinst prompts as follows:

a: Install NetBSD to hard disk  
Shall we continue? b: Yes
a: wd1 (232G)
a: This is the correct geometry 
a: Edit the MBR partition table
b:         76294         76294      Linux native
a:        type : Linux native
b: NetBSD
x: Partition OK
x: Partition table OK
Do you want to install the NetBSD bootcode? a: Yes
a: Set sizes of NetBSD partitions

You will now end up at the strange partition table shown at beginning
of the PR.

>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/54745: Sysinst generates strange i386 partition table
Date: Sat, 7 Dec 2019 17:42:59 +0100

 On Sat, Dec 07, 2019 at 03:20:01PM +0000, Andreas Gustafsson wrote:
 > because there is no swap partition, the NetBSD portion of the
 > disk is called "b" rather than "c", and the whole disk is called
 > "c" rather than "d":
 > 
 >    We now have your disklabel partitions for wd1 below.  This is your last 
 >    chance to change them. 
 > 
 >    Flags: (N)ewfs.  Total size: 75G, free: 128M
 > 
 >         Start (MB)     End (MB)    Size (MB)  FS type Flag Filesystem
 >       ------------ ------------ ------------ -------- ---- ----------------
 >    a:        76294       152459        76166    FFSv2 N    /
 >    b:        76294       152587        76294 NetBSD partition
 >    c:            0       238474       238475 Whole disk
 >       ------------ ------------ ------------ -------- ---- ----------------

 The a: / b: / c: are just menu labels, they do not correlate to the disklabel
 partition names at all (besides both being ordered by start sector).

 The concept of a single letter partition name does not extend well beyound
 disklabel, so it would be a bit tricky to change this for very little gain
 (IMHO).

 Is there anything wrong with the actual created disklabel afterwards?

 Martin

From: Andreas Gustafsson <gson@gson.org>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/54745: Sysinst generates strange i386 partition table
Date: Sat, 7 Dec 2019 19:41:00 +0200

 Martin Husemann wrote:
 >  The a: / b: / c: are just menu labels, they do not correlate to the disklabel
 >  partition names at all (besides both being ordered by start sector).

 OK, I see that now, but I'm still confused by the absence of a swap
 partition in the list, because it was there on the pervious screen:

    You can now change the sizes for the system partitions.  The default is to
    allocate all the space to the root file system.  However, you may wish to
    have separate /usr (additional system files), /var (log files etc) or /home
    (users' home directories) file systems.

    Free space will be added to the partition marked with a '+'.

          Size (MB)                             Filesystem
          ----------------------------------- - --------------------
      >a: 596 (76166)                         + /
       b: 128                                   <swap>
       c: 0                                     /tmp (tmpfs)
       d: 0                                     /usr
       e: 0                                     /var
          ----------------------------------- - --------------------
       g: Add a user defined partition
       h: Clone external partition(s)
       i: Change input units (sectors/cylinders/MB/GB)
       x: Go on.  Free space 75570 MB.

 >  Is there anything wrong with the actual created disklabel afterwards?

 It's also missing the swap partition.  I repeated the installation
 without qemu "-snapshot" option so that the disk image was actually
 modified, and then booted the disk formerly known as wd1 with:

   qemu-system-i386 -nographic -hda hd

 The booted system has the following disklabel:

    # disklabel wd0
    # /dev/rwd0:
    type: unknown
    disk: wd
    label: fictious
    flags:
    bytes/sector: 512
    sectors/track: 63
    tracks/cylinder: 16
    sectors/cylinder: 1008
    cylinders: 484521
    total sectors: 488397168
    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: 155987968 156250112     4.2BSD      0     0     0  # (Cyl. 155010*- 309759)
     c: 156250112 156250112     unused      0     0        # (Cyl. 155010*- 310020*)
     d: 488397168         0     unused      0     0        # (Cyl.      0 - 484520)

 The fstab still refers to wd1, which is not surprising since I changed
 the disks around, but what is surprising is that it is swapping on the
 "d" partition (!):

    # cat /etc/fstab
    # NetBSD /etc/fstab
    # See /usr/share/examples/fstab/ for more examples.
    /dev/wd1a               /       ffs     rw               1 1
    /dev/wd1d               none    swap    sw,dp            0 0
    kernfs          /kern   kernfs  rw
    ptyfs           /dev/pts        ptyfs   rw
    procfs          /proc   procfs  rw
    /dev/cd0a               /cdrom  cd9660  ro,noauto
    tmpfs           /var/shm        tmpfs   rw,-m1777,-sram%25

 -- 
 Andreas Gustafsson, gson@gson.org

From: Andreas Gustafsson <gson@gson.org>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/54745: Sysinst generates strange i386 partition table
Date: Sat, 7 Dec 2019 19:52:54 +0200

 Sorry, I forgot one step in the replication recipe.  After
 uncompressing the install image, you need to modify its boot options
 to make it use the serial console.  I'm using this script, which takes
 the image file name as an argument:

 #!/bin/sh
 # Change the given NetBSD disk image to use a serial console
 # See tech-userlevel, 16 Apr 2017 
 img="$1"
 console="com0"
 chmod u+w $img
 export RUMP_SERVER=unix:///tmp/installboot_rumpserv
 offset=$(disklabel $img | awk '/ a:/ { print $3 }')
 size=$(disklabel $img | awk '/ a:/ { print $2 }')
 rump_server -lrumpvfs -lrumpdev -lrumpdev_disk -d key=/rdk0a,hostpath=$img,offset=${offset}b,size=${size}b,type=chr $RUMP_SERVER
 LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=path=/rump installboot -e -o console=$console /rump/rdk0a
 rump.halt

 Alternatively, you could do the installation using qemu's VGA
 emulation rather than the serial console emulation.
 -- 
 Andreas Gustafsson, gson@gson.org

Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sat, 07 Dec 2019 19:40:46 +0000
Responsible-Changed-Why:
my bug


From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org, martin@netbsd.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, gson@gson.org (Andreas Gustafsson)
Subject: re: install/54745: Sysinst generates strange i386 partition table
Date: Sun, 08 Dec 2019 08:50:18 +1100

 >  >    a:        76294       152459        76166    FFSv2 N    /
 >  >    b:        76294       152587        76294 NetBSD partition
 >  >    c:            0       238474       238475 Whole disk
 >  >       ------------ ------------ ------------ -------- ---- ----------=
 ------
 >  =

 >  The a: / b: / c: are just menu labels, they do not correlate to the dis=
 klabel
 >  partition names at all (besides both being ordered by start sector).

 this is confusing, because we're used to disklabels matching
 the menu labels.

 can we use number labels here?


 .mrg.

From: Martin Husemann <martin@duskware.de>
To: matthew green <mrg@eterna.com.au>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/54745: Sysinst generates strange i386 partition table
Date: Sun, 8 Dec 2019 09:03:49 +0100

 On Sun, Dec 08, 2019 at 08:50:18AM +1100, matthew green wrote:
 > can we use number labels here?

 Not easily (but I'll have another look if we can sync with disklabel
 names). Fixing the real issue (missing swap) first....

 Martin

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54745 CVS commit: src/usr.sbin/sysinst
Date: Sun, 8 Dec 2019 15:09:33 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Dec  8 15:09:33 UTC 2019

 Modified Files:
 	src/usr.sbin/sysinst: bsddisklabel.c

 Log Message:
 PR install/54745: fix confusion about absolut and NetBSD-partition
 relative offsets.


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/sysinst/bsddisklabel.c

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

From: Andreas Gustafsson <gson@gson.org>
To: martin@NetBSD.org
Cc: gnats-bugs@netbsd.org
Subject: Re: PR/54745 CVS commit: src/usr.sbin/sysinst
Date: Sun, 8 Dec 2019 22:32:14 +0200

 Martin Husemann wrote:
 >  cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/sysinst/bsddisklabel.c

 With this change, installation succeeds - thanks.
 Does this issue also affect -9?
 -- 
 Andreas Gustafsson, gson@gson.org

From: Martin Husemann <martin@duskware.de>
To: Andreas Gustafsson <gson@gson.org>
Cc: martin@NetBSD.org, gnats-bugs@netbsd.org
Subject: Re: PR/54745 CVS commit: src/usr.sbin/sysinst
Date: Mon, 9 Dec 2019 08:30:14 +0100

 On Sun, Dec 08, 2019 at 10:32:14PM +0200, Andreas Gustafsson wrote:
 > Martin Husemann wrote:
 > >  cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/sysinst/bsddisklabel.c
 > 
 > With this change, installation succeeds - thanks.
 > Does this issue also affect -9?

 Yes, I will request pullup.

 Martin

State-Changed-From-To: open->pending-pullups
State-Changed-By: martin@NetBSD.org
State-Changed-When: Mon, 09 Dec 2019 17:09:42 +0000
State-Changed-Why:
Waiting on [pullup-9 #538]


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54745 CVS commit: [netbsd-9] src/usr.sbin/sysinst
Date: Mon, 9 Dec 2019 19:33:26 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Mon Dec  9 19:33:26 UTC 2019

 Modified Files:
 	src/usr.sbin/sysinst [netbsd-9]: bsddisklabel.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #538):
 	usr.sbin/sysinst/bsddisklabel.c: revision 1.32
 PR install/54745: fix confusion about absolut and NetBSD-partition
 relative offsets.


 To generate a diff of this commit:
 cvs rdiff -u -r1.23.2.6 -r1.23.2.7 src/usr.sbin/sysinst/bsddisklabel.c

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

From: maya@NetBSD.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/54745 CVS commit: src/usr.sbin/sysinst
Date: Tue, 21 Apr 2020 17:15:23 +0000

 The mentioned PR got pulled up. I'm somewhat confused by
 > Waiting on [pullup-9 #538]

 Is there something you are waiting to request to pullup, or can this be
 closed?


 Thanks!

State-Changed-From-To: pending-pullups->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Wed, 22 Apr 2020 06:54:14 +0000
State-Changed-Why:
As the pullup has been processed, I believe this can be closed.


>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.