NetBSD Problem Report #57562

From www@netbsd.org  Fri Aug  4 10:45:28 2023
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 812C71A923A
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  4 Aug 2023 10:45:28 +0000 (UTC)
Message-Id: <20230804104526.E55251A923B@mollari.NetBSD.org>
Date: Fri,  4 Aug 2023 10:45:26 +0000 (UTC)
From: rokuyama.rk@gmail.com
Reply-To: rokuyama.rk@gmail.com
To: gnats-bugs@NetBSD.org
Subject: sun2 and sun3 live-image: unable to boot with replaced kernel
X-Send-Pr-Version: www-1.0

>Number:         57562
>Category:       misc
>Synopsis:       sun2 and sun3 live-image: unable to boot with replaced kernel
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 04 10:50:00 +0000 2023
>Originator:     Rin Okuyama
>Release:        10.99.7 (as well as old releases)
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD  10.99.7 NetBSD 10.99.7 (GENERIC) #4: Fri Aug  4 19:31:59 JST 2023  rin@latipes:/home/rin/repos/src/sys/arch/sun2/compile/obj.sun2-m68000/GENERIC sun2
>Description:
Sometimes sun[23] live-image does not boot with new kernel file,
replaced with pre-installed one:

----
...
ufsboot: netbsd: loadfile() failed.
filename? [netbsd]:
ufsboot: netbsd: loadfile() failed.
filename? [netbsd]:
...
----

This should be because firmware cannot load disk sectors beyond
1GB from its beginning, as noted in INSTALL for sun[23]:

> Note that the sun2 firmware cannot boot from a partition located
> more than 1 GB from the beginning of the disk, so the swap partition
> should be completely below the 1 GB boundary.

The default size of live-image is 2GB and a lot of files in it. As
a result, a part of newly installed kernel is highly probably located
beyond the limitation.

For sun3, we can drop some sets from SETS to fit within 1GB. However,
the REAL HAZARD is sun2; it does not support shared libraries, and
only base and etc are ~1.4GB.
>How-To-Repeat:
Try reinstalled kernels on live-images for sun[23] on TME.

Something like:

----
# vnconfig vnd0 NetBSD-10.99.7-sun2-live.img
# mount /dev/vnd0a /mnt
# cp /mnt/netbsd /mnt/netbsd2
# mv /mnt/netbsd2 /mnt/netbsd
# umount /mnt
----

is sufficient to make sun2 image unbootable.
>Fix:
For sun3, we can drop some sets to shrink live-image within 1GB.

Real fix may be to add support for multiple partitions for live-image,
e.g., sd0a for root, sd0d for usr. Then, we can safely restrict files in
root partition within 1GB from the beginning of image.

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-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.