NetBSD Problem Report #56563

From manphiz@gmail.com  Mon Dec 20 21:12:23 2021
Return-Path: <manphiz@gmail.com>
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 BFD2C1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 20 Dec 2021 21:12:23 +0000 (UTC)
Message-Id: <20211220211218.4CBE922E1AD@yeeloong-netbsd.localdomain>
Date: Mon, 20 Dec 2021 13:12:18 -0800 (PST)
From: manphiz@gmail.com
Reply-To: manphiz@gmail.com
To: gnats-bugs@NetBSD.org
Subject: NetBSD 9.x/current sysinst segfault on Loongson/evbmips
X-Send-Pr-Version: 3.95

>Number:         56563
>Category:       port-mips
>Synopsis:       NetBSD 9.x/current sysinst segfault when marking a new parition as active
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    martin
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 20 21:15:00 +0000 2021
>Last-Modified:  Tue Dec 21 07:30:05 +0000 2021
>Originator:     manphiz@gmail.com
>Release:        NetBSD 9.2
>Organization:
>Environment:
Architecture: mips64el
Machine: evbmips
>Description:

        (Originally reported to port-mips@netbsd.org[1] and was
        suggested to file a bug report so here we are.)

	When trying to install NetBSD on my Loongson2f machine (Lemote
        Yeeloong) using the 9.2 or current installer, the sysinst will
        segfault when trying to format a NetBSD partition and marking
        it active.  The exact error message looks like below:

	,----
	| [ 104.2026388] uid 0, pid 16, command sysinst, on /: file system full
	| [ 104.2397136] /: write failed, file system is full
	| [ 104.2597050] pid 16 (sysinst): user write of 139472@0x78594000 at 730572 failed: 28
	`----

	A little bit more info about my disk: I have an ext2 partition
	(~2GB) on the disk which is required by the PMON boot loader
	for the system for booting the system so it must be presented
	in the final partition scheme for this system to be able to
	boot.  The NetBSD installer was also put here.  There was also
	an OpenBSD partition taking the rest of the disk space before
	I tried to install NetBSD.  I've tried the following ways of
	repartitioning the disk but all failed when trying to mark the
	NetBSD partition active.

	* Removing the OpenBSD partition and create a new NetBSD
          partition without touching the ext2 partition.
        * Directly changing the OpenBSD partition type to NetBSD.
        * Remove all partition, recreating the ext2 partition and a
          new NetBSD partition.

        Note that the sysinst from NetBSD 8.2 installer works without
        this issue.

	Here are some of the disk information Martin suggested that
	may be helpful.  Note those information are from the
	successfully installed 8.2 system.

	* Contents of /etc/fstab:

	,----
	| yeeloong-netbsd$ cat /etc/fstab
	| # NetBSD /etc/fstab
	| # See /usr/share/examples/fstab/ for more examples.
	| /dev/wd0a               /       ffs     rw               1 1
	| /dev/wd0b               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
	`----

        * Output of "fdisk wd0":

	,----
	| yeeloong-netbsd# fdisk wd0
	| Disk: /dev/rwd0
	| NetBSD disklabel disk geometry:
	| cylinders: 310101, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
	| total sectors: 312581808, bytes/sector: 512
	| 
	| BIOS disk geometry:
	| cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
	| total sectors: 312581808
	| 
	| Partitions aligned to 2048 sector boundaries, offset 2048
	| 
	| Partition table:
	| 0: Linux native (sysid 131)
	|     start 2048, size 3903488 (1906 MB, Cyls 0-243/27/40)
	|         PBR is not bootable: All bytes are identical (0x00)
	| 1: NetBSD (sysid 169)
	|     start 4194304, size 308387504 (150580 MB, Cyls
	| 261/21/17-19457/80/63), Active
	|         PBR is not bootable: Bad magic number (0x195f)
	| 2: <UNUSED>
	| 3: <UNUSED>
	| First active partition: 1
	| Drive serial number: 1405439929 (0x53c54fb9)
	`----

	* Output of "disklabel wd0":

	,----
	| yeeloong-netbsd# disklabel wd0
	| # /dev/rwd0:
	| type: unknown
	| disk: ESDI/IDE disk
	| label:
	| flags:
	| bytes/sector: 512
	| sectors/track: 63
	| tracks/cylinder: 16
	| sectors/cylinder: 1008
	| cylinders: 310101
	| total sectors: 312581808
	| rpm: 3600
	| interleave: 1
	| trackskew: 0
	| cylinderskew: 0
	| headswitch: 0           # microseconds
	| track-to-track seek: 0  # microseconds
	| drivedata: 0
	| 
	| 16 partitions:
	| #        size    offset     fstype [fsize bsize cpg/sgs]
	|  a: 287414064   4194304     4.2BSD   4096 32768     0  # (Cyl.   4161*- 289294*)
	|  b:  20973440 291608368       swap                     # (Cyl. 289294*- 310100)
	|  c: 312581808         0     unused      0     0        # (Cyl.      0 - 310100)
	`----

	On a related note, I have also tried to upgrade from a
	successfully installed 8.2 system to 9.2/current using those
	installers.  As this doesn't require repartitioning the disk,
	it didn't trigger the sysinst segfault issue.  However, when
	trying to download the sets packages, it also failed with a
	"disk full" error.  When inspecting through shell I found that
	sysinst was trying to unpack the content to the ramfs instead
	of the disk storing the existing system which caused the "disk
	full" error.  It doesn't look like the same issue but could be
	related.

	Hope these information help with debugging the issue and I'd
	be happy to provide more info when asked.

	[1] https://mail-index.netbsd.org/port-mips/2021/12/14/msg001195.html

>How-To-Repeat:
	Using sysinst from 9.2/current installer to partition the disk
	and mark the NetBSD partition active.  Upgrading an existing
	installation also fails with "disk full" as it tries to unpack
	data onto the ramfs for the installer instead of the target disk.

>Fix:
	Unknown.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-mips-maintainer->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Tue, 21 Dec 2021 07:30:05 +0000
Responsible-Changed-Why:
Take


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