NetBSD Problem Report #59665
From www@netbsd.org Sun Sep 21 17:21:56 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)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id BBCDA1A9239
for <gnats-bugs@gnats.NetBSD.org>; Sun, 21 Sep 2025 17:21:56 +0000 (UTC)
Message-Id: <20250921172155.61AD91A923D@mollari.NetBSD.org>
Date: Sun, 21 Sep 2025 17:21:55 +0000 (UTC)
From: thorpej@me.com
Reply-To: thorpej@me.com
To: gnats-bugs@NetBSD.org
Subject: There should be a "boot -r" option (or similar) to boot into /rescue
X-Send-Pr-Version: www-1.0
>Number: 59665
>Category: bin
>Synopsis: There should be a "boot -r" option (or similar) to boot into /rescue
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Sep 21 17:25:00 +0000 2025
>Last-Modified: Mon Sep 22 20:10:01 +0000 2025
>Originator: Jason Thorpe
>Release: NetBSD 11.99.2
>Organization:
RISCy Business
>Environment:
(doesn't matter)
>Description:
It would be nifty to have a "boot -r" option (or similar name) that booted into /rescue. This would be useful in situations where the console cannot be used super early.
Recue boot should imply:
- Goes to single-user mode.
- Uses /rescue/init and /rescue/sh.
>How-To-Repeat:
N/A
>Fix:
Not provided.
>Audit-Trail:
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: bin/59665: There should be a "boot -r" option (or similar) to
boot into /rescue
Date: Sun, 21 Sep 2025 13:35:59 -0400
--Apple-Mail=_A911FA4B-07D5-43B6-B42D-E25EBFA4E0A2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Index: sys/boot_flag.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/sys/boot_flag.h,v
retrieving revision 1.8
diff -u -p -r1.8 boot_flag.h
--- sys/boot_flag.h 12 May 2024 10:34:56 -0000 1.8
+++ sys/boot_flag.h 21 Sep 2025 17:34:15 -0000
@@ -70,6 +70,9 @@
case 'q': /* boot quietly */ \
(retval) |=3D AB_QUIET; \
break; \
+ case 'r': /* Use /rescue/init instead of /sbin/init */ \
+ (retval) |=3D RB_RESCUE; \
+ break; \
case 's': /* boot to single user */ \
(retval) |=3D RB_SINGLE; \
break; \
Index: sys/reboot.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/sys/reboot.h,v
retrieving revision 1.26
diff -u -p -r1.26 reboot.h
--- sys/reboot.h 1 Jan 2020 22:57:17 -0000 1.26
+++ sys/reboot.h 21 Sep 2025 17:34:15 -0000
@@ -53,6 +53,7 @@
#define RB_STRING 0x00000400 /* use provided bootstr =
*/
#define RB_POWERDOWN (RB_HALT|0x800) /* turn power off (or at =
least halt) */
#define RB_USERCONF 0x00001000 /* change configured devices */
+#define RB_RESCUE 0x00002000 /* use /rescue/init */
=20
/*
* Extra autoboot flags (passed by boot prog to kernel). See also
Index: kern/init_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.552
diff -u -p -r1.552 init_main.c
--- kern/init_main.c 8 May 2025 05:31:16 -0000 1.552
+++ kern/init_main.c 21 Sep 2025 17:34:15 -0000
@@ -1016,7 +1016,7 @@ start_init(void *arg)
panic("init: couldn't allocate argument space");
p->p_vmspace->vm_maxsaddr =3D (void *)STACK_MAX(addr, =
PAGE_SIZE);
=20
- ipx =3D 0;
+ ipx =3D (boothowto & RB_RESCUE) ? 3 : 0;
while (1) {
if (boothowto & RB_ASKNAME) {
printf("init path");
--Apple-Mail=_A911FA4B-07D5-43B6-B42D-E25EBFA4E0A2
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCaNA3fwAKCRBxESqxbLM7
OldUAKCoFxLVilvTb2ZpMAWbjVGYqCgNawCg715gC7YjnT+UYxLuc6ZRYTivvZs=
=1Iwn
-----END PGP SIGNATURE-----
--Apple-Mail=_A911FA4B-07D5-43B6-B42D-E25EBFA4E0A2--
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59665: There should be a "boot -r" option (or similar) to
boot into /rescue
Date: Mon, 22 Sep 2025 12:09:12 +0300
> This would be useful in situations where the console cannot be used
> super early.
...
> Recue boot should imply:
> - Goes to single-user mode.
> - Uses /rescue/init and /rescue/sh.
How is that different from -a (modulo answering the -a questions)?
-uwe
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59665: There should be a "boot -r" option (or similar) to boot into /rescue
Date: Mon, 22 Sep 2025 15:17:18 -0000 (UTC)
gnats-admin@NetBSD.org ("Valery Ushakov via gnats") writes:
> How is that different from -a (modulo answering the -a questions)?
It works with a broken USB console.
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59665: There should be a "boot -r" option (or similar) to
boot into /rescue
Date: Mon, 22 Sep 2025 23:02:55 +0300
> It works with a broken USB console.
Ah, right. Sorry, it's so rarely that I have to deal with USB
console, I tend to forget...
-uwe
(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-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.