NetBSD Problem Report #57100

From www@netbsd.org  Sat Dec 10 12:53:36 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_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 943811A921F
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 10 Dec 2022 12:53:36 +0000 (UTC)
Message-Id: <20221210125334.F00D91A923A@mollari.NetBSD.org>
Date: Sat, 10 Dec 2022 12:53:34 +0000 (UTC)
From: cryintothebluesky@googlemail.com
Reply-To: cryintothebluesky@googlemail.com
To: gnats-bugs@NetBSD.org
Subject: NetBSD sysint seems to be riddled with bugs and memory corruption
X-Send-Pr-Version: www-1.0

>Number:         57100
>Category:       install
>Synopsis:       NetBSD sysint seems to be riddled with bugs and memory corruption
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 10 12:55:01 +0000 2022
>Closed-Date:    Thu Dec 15 15:35:45 +0000 2022
>Last-Modified:  Thu Dec 15 20:35:01 +0000 2022
>Originator:     Sad Clouds
>Release:        9.99.108
>Organization:
>Environment:
>Description:
A lot of sysinst bugs seems to be in GPT partition workflow - selected options are not saved, screen partition layout menu corruption and random segfaults. The quality of of the code seems to be somewhat poor and not tested very well.
>How-To-Repeat:
Run sysint on NetBSD-current and follow these menu options:

NetBSD-9.99.108 Install System
a: Install NetBSD to hard disk

Shall we continue?
b: Yes

Available disks
a: wd0

The disk seems not to have been partitioned...
a: Guid Partition Table (GPT)

This disk matches the following BIOS disk
a: This is the correct geomety

What would you like to do
a: Set sizes of NetBSD partitions

You can now change the sizes...
x: Go on. Free space XXX MB

In the GPT partition layout select each partition and delete it, until all partitions are gone.

Now add new partitions in this order:

1. Type MSDOS, Start 1MB, Size 1MB, Newfs Yes, Mount No
2. Type FFSv2, Start 2MB, Size 1MB, Install Yes, Newfs Yes, Mount point /
3. Type FFSv2, Start 3MB, Size 1MB, Install Yes, Newfs Yes, Mount point /opt

Bug No.1 - Install and Newfs options are not saved and not displayed in flags on the menu.

Now go to partition 2, edit its property and set Install and Newfs to Yes again and select x: OK.

Now go to partition 3, edit its property and set Install and Newfs to Yes again and select x: OK.

Add another partition

4. Type FFSv2, Start 4MB, Size 1MB, Install Yes, Newfs Yes, Mount point /opt2

Bug No.2 - Partitions 2 and 3 on the layout menu have been corrupted and now display MSDOS partition.
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sat, 10 Dec 2022 13:05:04 +0000
Responsible-Changed-Why:
I'll deal with it


From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/57100: NetBSD sysint seems to be riddled with bugs and
 memory corruption
Date: Sat, 10 Dec 2022 14:04:08 +0100

 On Sat, Dec 10, 2022 at 12:55:02PM +0000, cryintothebluesky@googlemail.com wrote:
 > Now add new partitions in this order:
 > 
 > 1. Type MSDOS, Start 1MB, Size 1MB, Newfs Yes, Mount No
 > 2. Type FFSv2, Start 2MB, Size 1MB, Install Yes, Newfs Yes, Mount point /
 > 3. Type FFSv2, Start 3MB, Size 1MB, Install Yes, Newfs Yes, Mount point /opt

 You left out important information - how big the disk you are installing
 on?

 Martin

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/57100: NetBSD sysint seems to be riddled with bugs and
 memory corruption
Date: Sat, 10 Dec 2022 14:32:39 +0100

 Btw.: you are abusing the system:

 > What would you like to do
 > a: Set sizes of NetBSD partitions
 > 
 > You can now change the sizes...
 > x: Go on. Free space XXX MB

 You are supposed to not go on here but set up all the partition sizes
 you are going to create.

 It should still deal with what you did in the second partitioning stage
 (where you can edit the file system details), but this is not the typical
 usage and probably totaly untested.

 > Bug No.1 - Install and Newfs options are not saved and not displayed in flags on the menu.

 Because they contradict information stored in the first stage - and the
 special case of "deleting all partitions" in the second stage, which
 should reset this information, is not caught.

 There can only be one "Install" mark anyway, it points at the root
 partition (with GPT disks at least, it can point at the NetBSD MBR
 partition in mbr/disklabel setups).

 Martin

From: Sad Clouds <cryintothebluesky@gmail.com>
To: gnats-bugs@netbsd.org
Cc: Martin Husemann <martin@duskware.de>, martin@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
 cryintothebluesky@googlemail.com
Subject: Re: install/57100: NetBSD sysint seems to be riddled with bugs and
 memory corruption
Date: Sat, 10 Dec 2022 13:43:30 +0000

 On Sat, 10 Dec 2022 13:20:02 +0000 (UTC)
 Martin Husemann <martin@duskware.de> wrote:

 >  You left out important information - how big the disk you are installing
 >  on?
 >  
 >  Martin
 >  

 The issues occurred on two different platforms:
 VirtualBox with 16G disk
 Raspberry Pi 4 with 128G disk

From: Sad Clouds <cryintothebluesky@gmail.com>
To: gnats-bugs@netbsd.org
Cc: Martin Husemann <martin@duskware.de>, martin@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
 cryintothebluesky@googlemail.com
Subject: Re: install/57100: NetBSD sysint seems to be riddled with bugs and
 memory corruption
Date: Sat, 10 Dec 2022 17:24:40 +0000

 On Sat, 10 Dec 2022 13:35:02 +0000 (UTC)
 Martin Husemann <martin@duskware.de> wrote:

 >  Btw.: you are abusing the system:

 Why? I simply follow the workflow presented by sysint.

 The first screen it presents, contains a list of NetBSD disklabel style
 partitions. The only option is to set the size of the partitions. This
 is bad design and makes little sense, because why would I set
 only partition sizes, without knowing start/end sectors, file system
 type, etc. The only way to get past this screen is to select
 "x: Go on" option.

 The second screen is now a proper partitioning workflow and I can
 create different partition types, file system types, etc. So what I
 want to do here, is remove all incorrectly auto-generated partitions and
 create everything manually by hand. This is where issues happen.

 So I would suggest this - maybe get rid of the first screen and have a
 single screen with a single workflow, where partitions can be removed,
 added, and modified correctly and free of bugs. This is how it is done
 on other operating systems. Then it needs to perform correct checks and
 notify if something is missing, like / or /boot partition, or swap. I
 think the workflow needs complete redesign.

From: Martin Husemann <martin@duskware.de>
To: Sad Clouds <cryintothebluesky@gmail.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/57100: NetBSD sysint seems to be riddled with bugs and
 memory corruption
Date: Sat, 10 Dec 2022 18:40:52 +0100

 On Sat, Dec 10, 2022 at 05:24:40PM +0000, Sad Clouds wrote:
 > The first screen it presents, contains a list of NetBSD disklabel style
 > partitions. The only option is to set the size of the partitions. This
 > is bad design and makes little sense, because why would I set
 > only partition sizes, without knowing start/end sectors, file system
 > type, etc. The only way to get past this screen is to select
 > "x: Go on" option.

 Why would you care about start and end sectors, or file system types?
 This is the "broad overview" and you only select how much of your disk
 you offer to NetBSD - or something like that. On the second stage you
 typically just accept whatever the first stage created ;-)

 But as this is NetBSD we offer all the rope, and the rope we offer should
 work - so the real bugs you pointed out need to be fixed.

 Martin

From: Sad Clouds <cryintothebluesky@gmail.com>
To: Martin Husemann <martin@duskware.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/57100: NetBSD sysint seems to be riddled with bugs and
 memory corruption
Date: Sat, 10 Dec 2022 18:13:47 +0000

 On Sat, 10 Dec 2022 18:40:52 +0100
 Martin Husemann <martin@duskware.de> wrote:

 > Why would you care about start and end sectors, or file system types?
 > This is the "broad overview" and you only select how much of your disk
 > you offer to NetBSD - or something like that. On the second stage you
 > typically just accept whatever the first stage created ;-)

 Because it is a strange workflow. My understanding is that GPT is
 different from the old disklabel, where you had one NetBSD partition,
 which was subdivided into a, b, c, d, etc sub-partitions. So with GPT
 people can have different layouts.

 You need to know start/end sectors, so that you can check partition
 alignment. So with 4k drives you could have misaligned partitions and
 end up with poor performance.

 Essentially, it would be good to have "advanced partition" workflow,
 where you can manually create, delete, modify whichever partition
 layouts you want and not have sysint get in the way.

From: Martin Husemann <martin@duskware.de>
To: Sad Clouds <cryintothebluesky@gmail.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/57100: NetBSD sysint seems to be riddled with bugs and
 memory corruption
Date: Sat, 10 Dec 2022 19:16:14 +0100

 On Sat, Dec 10, 2022 at 06:13:47PM +0000, Sad Clouds wrote:
 > You need to know start/end sectors, so that you can check partition
 > alignment. So with 4k drives you could have misaligned partitions and
 > end up with poor performance.

 In the default workflow the installer takes care of that for you and
 enforces alignment.

 Martin

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57100 CVS commit: src/usr.sbin/sysinst
Date: Thu, 15 Dec 2022 14:54:27 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Dec 15 14:54:27 UTC 2022

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

 Log Message:
 PR 57100: fix install flag handling for newly added GPT partitions,
 fix multiple install flags when updating existing partitions.


 To generate a diff of this commit:
 cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/sysinst/gpt.c

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57100 CVS commit: src/usr.sbin/sysinst
Date: Thu, 15 Dec 2022 15:29:51 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Dec 15 15:29:51 UTC 2022

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

 Log Message:
 PR 57100: when adding a new partition, update current flags after
 the backend has added the partion, so the re-sorting later can
 match the new data properly.


 To generate a diff of this commit:
 cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/sysinst/label.c

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

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Thu, 15 Dec 2022 15:35:45 +0000
State-Changed-Why:
The original bugs described here should be fixed now.
For general / workflow discussion a mailing list would be better.
Other bugs (segfaults?) should get their own PR (with reproducible path
how to trigger them)


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57100 CVS commit: src/usr.sbin/sysinst
Date: Thu, 15 Dec 2022 15:32:04 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Dec 15 15:32:04 UTC 2022

 Modified Files:
 	src/usr.sbin/sysinst: bsddisklabel.c defs.h msg.mi.de msg.mi.en
 	    msg.mi.es msg.mi.fr msg.mi.pl util.c

 Log Message:
 Add an (expert) option to manually edit partitions, inspired by PR 57100.


 To generate a diff of this commit:
 cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/sysinst/bsddisklabel.c
 cvs rdiff -u -r1.87 -r1.88 src/usr.sbin/sysinst/defs.h
 cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/msg.mi.de
 cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/sysinst/msg.mi.en
 cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/msg.mi.es
 cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/sysinst/msg.mi.fr
 cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/sysinst/msg.mi.pl
 cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/sysinst/util.c

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

From: Sad Clouds <cryintothebluesky@gmail.com>
To: gnats-bugs@netbsd.org
Cc: "Martin Husemann" <martin@netbsd.org>, gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org, cryintothebluesky@googlemail.com
Subject: Re: PR/57100 CVS commit: src/usr.sbin/sysinst
Date: Thu, 15 Dec 2022 18:16:06 +0000

 I'm still noticing various issues:

 First start with empty disk and destroy all previous GPT structures

 1. Utility menu -> Run /bin/sh -> and run "gpt destroy wd0"

 Exit shell and now back to main install menu

 2. Install NetBSD... -> GPT -> Manually define partitions.

 3. Add a partition with the following options
 type: FFSv2
 start: 1M
 size: 2G
 install: Yes
 newfs: Yes (already set)
 mount: Yes
 mount point: /

 Add this partition

 Now go back to this partition and check previously set options

 Bug #1 - size is shown as 2047M, which is 1M less than 2G
 Bug #2 - newfs option has magically reverted to No

 Now if we continue with these options and select

 Partitions sizes ok -> Shall we continue? -> Yes

 It fails with the following errors (presumably due to Bug #2):
 Command failed... fsck_ffs... can't find superblock...

 After this continue as follows:

 It appears that /dev/XXX is not a ffs... Yes or no? -> No

 This brings back to main install menu. Now select

 Install NetBSD to hard disk -> Yes -> wd0 -> This is the correct
 geometry -> Manually define partitions

 Bug #3 - BOOM! Segmentation fault.

 Whatever previous install process did, caused memory corruption and
 restarting install again resulted in segfault.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57100 CVS commit: src/usr.sbin/sysinst
Date: Thu, 15 Dec 2022 20:21:17 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Dec 15 20:21:16 UTC 2022

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

 Log Message:
 PR 57100: check if we can newfs the proper fstype when adding a new
 partition and accepting the default FS type.


 To generate a diff of this commit:
 cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/sysinst/label.c

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57100 CVS commit: src/usr.sbin/sysinst
Date: Thu, 15 Dec 2022 20:34:46 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Dec 15 20:34:46 UTC 2022

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

 Log Message:
 PR 57100: in manual mode, we can not ignore existing partitions
 completley, as that causes inconsistent internal state.


 To generate a diff of this commit:
 cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/sysinst/util.c

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2022 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.