NetBSD Problem Report #59600
From www@netbsd.org Sun Aug 17 02:43:13 2025
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)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id CB9771A923A
for <gnats-bugs@gnats.NetBSD.org>; Sun, 17 Aug 2025 02:43:13 +0000 (UTC)
Message-Id: <20250817024312.5C6A31A923C@mollari.NetBSD.org>
Date: Sun, 17 Aug 2025 02:43:12 +0000 (UTC)
From: isaki@pastel-flower.jp
Reply-To: isaki@pastel-flower.jp
To: gnats-bugs@NetBSD.org
Subject: sysinst does not correctly recognize the partition on x68k.
X-Send-Pr-Version: www-1.0
>Number: 59600
>Category: install
>Synopsis: sysinst does not correctly recognize the partition on x68k.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: install-manager
>State: pending-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Aug 17 02:45:00 +0000 2025
>Closed-Date:
>Last-Modified: Thu May 07 15:35:02 +0000 2026
>Originator: Tetsuya Isaki
>Release: NetBSD 10.1
>Organization:
NetBSD
>Environment:
Installing NetBSD/x68k-10.1
>Description:
10.1 installer does not correctly recognize x68k (Human68k?) partition.
This site https://stdkmd.net/xeij/netbsd.htm (written in Japanese)
describes try to run NetBSD/x68k 10.1 on XEiJ emulator.
On this page, in step 4, create a hard disk image by specifying a
capacity of 2000MB in the "File" menu in XEiJ. Then, XEiJ will
actually create 2000MB plus 32KB (4096064 sectors) disk image. It
also writes the Human68k boot block and partition table.
In step 5, install into the disk image.
In the 10th screenshot of this step, you can see that the number of
sectors is incorrect. sysinst seems to recognize it as 8192064 sectors
(=4000MB plus 32KB), although kernel recognizes sd0 as 4096064 sectors.
Here is a hand-copied core part from the 10th screenshot.
| Size (sec) Filesystem
| --------------------------- - -----------
| a: 1167360 (8126528) + /
| b: 65536 <swap>
| c: 0 /tmp (mfs)
| d: 0 /usr
| e: 0 /var
| --------------------------- - -----------
And here is the related part of dmesg.
sd0 at scsibus0 target 0 lun0: <...> disk fixed
sd0: fabricating a geometry
sd0: 2000 MB, 2000 cyl, 64 head, 32 sec, 512 bytes/sect x 4096064 sectors
sd0: async, 8-bit transfers
# By the way, there also seem to be some issues during the recovery
# process from here (11th and subsequent photo), but I won't go into
# detail here.
According to analysis by @est_suzume@misskey.io, only following
16 bytes affects.
00000800: 58 36 38 4B 00 00 00 20 00 1F 40 20 00 1F 40 20 |X68K... ..@ ..@ |
Human68k partition table is located at offset 0x800 from the beginning
of the disk. 'X68K' is the signaure. The first partition starts from
0x810. So totally it means "Human68k partition table exists but empty".
When this region is zero-filled, sysinst works correctly.
However, with just these 16 bytes, the above issue occurs.
>How-To-Repeat:
If you use XEiJ:
1) Install XEiJ 0.25.08.08 or later (with the latest OpenJDK).
See https://stdkmd.net/xeij/?lang=en (in English).
2) Read https://stdkmd.net/xeij/netbsd.html (in Japanese),
and follow the instruction.
or you can reproduce by using nono:
1) Install pkgsrc/emulators/nono.
2) Download sysinst[12].fs from
https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.1/x68k/installation/floppy/
3) Prepare magic'ed disk image.
% dd if=/dev/zero bs=32k count=64001 of=NetBSD-10.1.hds
% printf 'X68K\0\0\0 \0\x1f@ \0\x1f@ ' | \
dd of=NetBSD-10.1.hds bs=1 count=16 seek=2048 conv=notrunc
4) Run nono.
% cat nono.cfg
vmtype=x68030
extram-size=128
spc0-id0-image=hd,NetBSD-10.1.hds
% nono --create-sram # will create SRAM.DAT in this directory.
% nono -f --fd0 sysinst1.fs --fd1 sysinst2.fs
5) Follow the steps in sysinst:
a: Install NetBSD to hard disk
b: Yes
a: sd0 (2.0G, ...)
a: Set sizes of NetBSD partitions
>Fix:
I don't know..
>Release-Note:
>Audit-Trail:
From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: gnats-bugs@netbsd.org
Cc: install-manager@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: install/59600: sysinst does not correctly recognize the partition on x68k.
Date: Wed, 29 Apr 2026 13:15:46 +0900
Removing conditions for d_bbsize and d_sbsize in x68k's
md_disklabel_is_default() will fix this problem.
But I don't know the historical reason for this.
--- usr.sbin/sysinst/arch/x68k/md.c
+++ usr.sbin/sysinst/arch/x68k/md.c
@@ -275,9 +275,7 @@ md_disklabel_is_default(const struct disklabel *lp)
bool maybe_default =
lp->d_npartitions == RAW_PART + 1 &&
lp->d_partitions[0].p_size == lp->d_partitions[RAW_PART].p_size &&
- lp->d_partitions[0].p_fstype == FS_UNUSED &&
- lp->d_bbsize == 0 &&
- lp->d_sbsize == 0;
+ lp->d_partitions[0].p_fstype == FS_UNUSED;
return maybe_default;
}
In addition, initialization of lp->{d_bbsize,d_sbsize} in the x68k kernel
is also strange.
sys/arch/x68k/x68k/disksubr.c:
63 const char *
64 readdisklabel(dev_t dev, void (*strat)(struct buf *),
65 struct disklabel *lp, struct cpu_disklabel *osdep)
66 {
:
163 /* if BSD disklabel does not exist, fall back to Human68k partition */
164 if (msg != NULL) {
165 msg = NULL;
166 lp->d_bbsize = 8192;
167 lp->d_sbsize = 2048;
168 for (i = 0; i < NDOSPART; i++, dp++)
Here (msg != NULL) is met when there is no BSD disklabel and
Human68k partition table signature exists.
Therefore, the presence or absence of the signature affected sysinst.
But lp->d_bbsize and lp->d_sbsize should be initialized regardless of
such conditions, even though both parameters are historical.
At least, with the above patch for sysinst, it seems this problem is
resolved.
Size (sec) Filesystem
------------------------------------- - ------------
>a: 708608 (4030400) + /
b: 65536 <swap>
c: 0 /tmp (mfs)
d: 0 /usr
e: 0 /var
------------------------------------- - ------------
g: Add a user defined partition
h: Change input units (cectors/cylinders/MB/GB)
x: Go on. Free space 3321792 sec.
---
Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
To: Tetsuya Isaki <isaki@pastel-flower.jp>
Cc: gnats-bugs@netbsd.org
Subject: Re: install/59600: sysinst does not correctly recognize the
partition on x68k.
Date: Wed, 29 Apr 2026 10:12:07 +0200
On Wed, Apr 29, 2026 at 01:15:46PM +0900, Tetsuya Isaki wrote:
> Removing conditions for d_bbsize and d_sbsize in x68k's
> md_disklabel_is_default() will fix this problem.
> But I don't know the historical reason for this.
There is no good reason for this as far as I remember, it is all a hack.
Your change looks reasonable.
An alternative aproach is to teach sysinst about Human68k partition tables,
are there docs for them? I still plan to do something simmilar for apple
partition maps on Macs (but my todo list is too long).
Martin
From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: gnats-bugs@netbsd.org
Cc: install-manager@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: install/59600: sysinst does not correctly recognize the partition on x68k.
Date: Thu, 30 Apr 2026 12:07:10 +0900
At Wed, 29 Apr 2026 08:15:01 +0000 (UTC),
Martin Husemann via gnats wrote:
> There is no good reason for this as far as I remember, it is all a hack.
> Your change looks reasonable.
Thank you. I'll commit it.
> An alternative aproach is to teach sysinst about Human68k partition tables,
> are there docs for them?
I don't know good documents. For example, the only text I can tell is
https://github.com/kg68k/puni/blob/main/programmers.txt#L534
written in Japanese. But I think this is not easy to understand...
---
Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>
From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59600 CVS commit: src/usr.sbin/sysinst/arch/x68k
Date: Thu, 30 Apr 2026 04:24:10 +0000
Module Name: src
Committed By: isaki
Date: Thu Apr 30 04:24:10 UTC 2026
Modified Files:
src/usr.sbin/sysinst/arch/x68k: md.c
Log Message:
sysinst/x68k: Remove unnecessary conditions in md_disklabe_is_default().
lp->d_bbsize and lp->d_sbsize should be constants (this is probably another
bug) and should not be part of this check.
Fix PR install/59600
Should be pulled up -10 and -11.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/arch/x68k/md.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59600 CVS commit: src/sys/arch/x68k/x68k
Date: Thu, 30 Apr 2026 05:20:54 +0000
Module Name: src
Committed By: isaki
Date: Thu Apr 30 05:20:54 UTC 2026
Modified Files:
src/sys/arch/x68k/x68k: disksubr.c
Log Message:
x68k: Initialize d_bbsize and d_sbsize on the disklabel always.
These values are for (old) FFS, so it didn't make sense to initialize
only when the BSD disklabel was missing and the Human68k partition existed.
This avoids disklabel(8)'s warnings:
disklabel: boot block size 0
disklabel: super block size 0
Inspired from PR install/59600.
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x68k/x68k/disksubr.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->pending-pullups
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Fri, 01 May 2026 06:19:59 +0000
State-Changed-Why:
[pullup-11 #265]
[pullup-10 #1264]
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59600 CVS commit: [netbsd-11] src
Date: Thu, 7 May 2026 15:31:10 +0000
Module Name: src
Committed By: martin
Date: Thu May 7 15:31:10 UTC 2026
Modified Files:
src/sys/arch/x68k/x68k [netbsd-11]: disksubr.c
src/usr.sbin/sysinst/arch/x68k [netbsd-11]: md.c
Log Message:
Pull up following revision(s) (requested by isaki in ticket #265):
sys/arch/x68k/x68k/disksubr.c: revision 1.38
usr.sbin/sysinst/arch/x68k/md.c: revision 1.14
sysinst/x68k: Remove unnecessary conditions in md_disklabe_is_default().
lp->d_bbsize and lp->d_sbsize should be constants (this is probably another
bug) and should not be part of this check.
Fix PR install/59600
x68k: Initialize d_bbsize and d_sbsize on the disklabel always.
These values are for (old) FFS, so it didn't make sense to initialize
only when the BSD disklabel was missing and the Human68k partition existed.
This avoids disklabel(8)'s warnings:
disklabel: boot block size 0
disklabel: super block size 0
Inspired from PR install/59600.
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.37.4.1 src/sys/arch/x68k/x68k/disksubr.c
cvs rdiff -u -r1.13 -r1.13.6.1 src/usr.sbin/sysinst/arch/x68k/md.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/59600 CVS commit: [netbsd-10] src
Date: Thu, 7 May 2026 15:32:38 +0000
Module Name: src
Committed By: martin
Date: Thu May 7 15:32:38 UTC 2026
Modified Files:
src/sys/arch/x68k/x68k [netbsd-10]: disksubr.c
src/usr.sbin/sysinst/arch/x68k [netbsd-10]: md.c
Log Message:
Pull up following revision(s) (requested by isaki in ticket #1264):
sys/arch/x68k/x68k/disksubr.c: revision 1.38
usr.sbin/sysinst/arch/x68k/md.c: revision 1.14
sysinst/x68k: Remove unnecessary conditions in md_disklabe_is_default().
lp->d_bbsize and lp->d_sbsize should be constants (this is probably another
bug) and should not be part of this check.
Fix PR install/59600
x68k: Initialize d_bbsize and d_sbsize on the disklabel always.
These values are for (old) FFS, so it didn't make sense to initialize
only when the BSD disklabel was missing and the Human68k partition existed.
This avoids disklabel(8)'s warnings:
disklabel: boot block size 0
disklabel: super block size 0
Inspired from PR install/59600.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.20.1 src/sys/arch/x68k/x68k/disksubr.c
cvs rdiff -u -r1.13 -r1.13.2.1 src/usr.sbin/sysinst/arch/x68k/md.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.