From nobody Thu Jul 20 19:31:01 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R6N8h0mTcz4nd9R for ; Thu, 20 Jul 2023 19:31:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R6N8g5xSNz4GG5 for ; Thu, 20 Jul 2023 19:31:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-51cff235226so2593830a12.0 for ; Thu, 20 Jul 2023 12:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20221208.gappssmtp.com; s=20221208; t=1689881472; x=1690486272; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=E+vPetezX70RF5FqZsa/x67igaYoTKxPS7Pw7yoGnSs=; b=fEI0ZiGRqK3BXcmd696+9czT7Fp2BHMVuAoiO0D3rncTzClZlKa2/P8+1MhroLA0hm UPrq8OIUSxc3kKxrCDPq7Wg2E0MUbn0Q330yTR2wLc1Dor/uW7Op+CYSU6fVBIWRpEiL mO1jAy/6UMl4jlrhCrtAAZwWHdl0PKp/ke6F3lIhfVo3RpQPvSRwxe+yu506p4/ibC+K gp3qe1TNfXwXO+77we3oQc4RcHBpO/1Qti2riDMKGHyBHKBpmhxve9Hd2y16nrvc2zrn HSGJ3MTmfzrrpCv1OK5rm63eeCZY19oIFezIBWHU3iJwIQnpUDpGjL3vPC2zULgDeE9x dxxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689881472; x=1690486272; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E+vPetezX70RF5FqZsa/x67igaYoTKxPS7Pw7yoGnSs=; b=MBL6Fcrhcv7EGWWsLMAvwct1PUsOS7aMJhRz10WkG7zIGXhnmcj4TWoGiXaY1Kvnr3 X7ZTWPVjWq3RVbzsUzgXoiicLTQGBe1UXYGcxuYZHNyEbaYGdfGVeG9xNuS2Im2PZKx6 1Jz9I+MoxaJ8cAgWDWW2I+/bjpHvLvgQT5vwlJ57LPltY876RvpkAFsY5OjKfSzXplpP AooY54kUH2ut+NXSUDX1As1YKZImtBwk1ttd92GIW62EleHIc8DLiXwTwFZ46xPiXcSc WJfXoydqQeFYW3GP5lriMBRHMKiVYM87ErwqmacAywlyA3algxL1j9DlPlfOc0Z2GHQX ZZ7w== X-Gm-Message-State: ABy/qLagjjt8apKeWN86RlcvTACdVTu/GtB5tq6rwLmcGapiIWXyb/GO bNB3JOoMLV2qXu3sjSp91H9AQ66XFVNjsInQbPT9Kw== X-Google-Smtp-Source: APBJJlEGdDEy54i+P4xqfyCBjnq2wAnOb1QCOiGvAb53om+fiH5zTQABl4w6+nc0gSdBjs3GBQzX7u+ADWlLLhimu24= X-Received: by 2002:aa7:dac4:0:b0:51e:da3:1585 with SMTP id x4-20020aa7dac4000000b0051e0da31585mr7323210eds.9.1689881472334; Thu, 20 Jul 2023 12:31:12 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 References: <120E9843-2732-4D2D-A23D-CB608F199E84@karels.net> In-Reply-To: <120E9843-2732-4D2D-A23D-CB608F199E84@karels.net> From: Warner Losh Date: Thu, 20 Jul 2023 13:31:01 -0600 Message-ID: Subject: Re: confusion about root partition causes panic during startup To: Mike Karels Cc: Current FreeBSD Content-Type: multipart/alternative; boundary="000000000000df147a0600f03010" X-Rspamd-Queue-Id: 4R6N8g5xSNz4GG5 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated --000000000000df147a0600f03010 Content-Type: text/plain; charset="UTF-8" On Thu, Jul 20, 2023, 1:27 PM Mike Karels wrote: > I installed an additional NVME drive on a system, and then booted. It > turns > out that the new drive became nda0, renumbering the other drives. The > loader > found the correct partition to boot (the only choice), and loaded the > kernel > correctly. However, /etc/fstab still had the old name (nvd1p2), which is > now drive 2. I expected it to drop into single user, but instead the > system > panicked in vfs_mountroot_shuffle trying to switch root devices (see > below). > It doesn't seem that having the wrong root device in /etc/fstab should > cause > a panic; it makes it harder to patch the system. I was unable to get the > system to boot using boot-to-single-user or setting currdev, but I managed > to remember doing "boot -a" from a loader prompt to get the system to ask > the root device before mounting it. I can easily reproduce this to test. > Probably the NDFREE_PNBUF() shouldn't happen if namei() returned an error. > > Mike > > Trying to mount root from ufs:/dev/nvd1p2 [rw]... > WARNING: WITNESS option enabled, expect reduced performance. > mountroot: unable to remount devfs under /dev (error 2) > panic: Assertion _ndp->ni_cnd.cn_pnbuf != NULL failed at > ../../../kern/vfs_mountroot.c:416 > cpuid = 19 > time = 11 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > 0xfffffe006d3bac40 > vpanic() at vpanic+0x149/frame 0xfffffe006d3bac90 > panic() at panic+0x43/frame 0xfffffe006d3bacf0 > vfs_mountroot() at vfs_mountroot+0x1bf7/frame 0xfffffe006d3bae60 > start_init() at start_init+0x23/frame 0xfffffe006d3baef0 > fork_exit() at fork_exit+0x82/frame 0xfffffe006d3baf30 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe006d3baf30 > --- trap 0x5c035c02, rip = 0x680c680c680c680c, rsp = 0x1b6b1f6b1b6b1b6b, > rbp = 0x4eb54eb54eb54eb5 --- > KDB: enter: panic > [ thread pid 1 tid 100002 ] > Stopped at kdb_enter+0x32: movq $0,0xde7643(%rip) > I'll have to see if I can recreate this. I've been running this way for a long time... Warner > --000000000000df147a0600f03010 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Jul 20, 2023, 1:27 PM Mike Karels <mike@karels.net> wrote:
I installed an additional NVME drive on a system, a= nd then booted.=C2=A0 It turns
out that the new drive became nda0, renumbering the other drives.=C2=A0 The= loader
found the correct partition to boot (the only choice), and loaded the kerne= l
correctly.=C2=A0 However, /etc/fstab still had the old name (nvd1p2), which= is
now drive 2.=C2=A0 I expected it to drop into single user, but instead the = system
panicked in vfs_mountroot_shuffle trying to switch root devices (see below)= .
It doesn't seem that having the wrong root device in /etc/fstab should = cause
a panic; it makes it harder to patch the system.=C2=A0 I was unable to get = the
system to boot using boot-to-single-user or setting currdev, but I managed<= br> to remember doing "boot -a" from a loader prompt to get the syste= m to ask
the root device before mounting it.=C2=A0 I can easily reproduce this to te= st.
Probably the NDFREE_PNBUF() shouldn't happen if namei() returned an err= or.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mike

Trying to mount root from ufs:/dev/nvd1p2 [rw]...
WARNING: WITNESS option enabled, expect reduced performance.
mountroot: unable to remount devfs under /dev (error 2)
panic: Assertion _ndp->ni_cnd.cn_pnbuf !=3D NULL failed at ../../../kern= /vfs_mountroot.c:416
cpuid =3D 19
time =3D 11
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe006d3ba= c40
vpanic() at vpanic+0x149/frame 0xfffffe006d3bac90
panic() at panic+0x43/frame 0xfffffe006d3bacf0
vfs_mountroot() at vfs_mountroot+0x1bf7/frame 0xfffffe006d3bae60
start_init() at start_init+0x23/frame 0xfffffe006d3baef0
fork_exit() at fork_exit+0x82/frame 0xfffffe006d3baf30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe006d3baf30
--- trap 0x5c035c02, rip =3D 0x680c680c680c680c, rsp =3D 0x1b6b1f6b1b6b1b6b= , rbp =3D 0x4eb54eb54eb54eb5 ---
KDB: enter: panic
[ thread pid 1 tid 100002 ]
Stopped at=C2=A0 =C2=A0 =C2=A0 kdb_enter+0x32: movq=C2=A0 =C2=A0 $0,0xde764= 3(%rip)


I'll have to see if I can recreate t= his. I've been running this way for a long time...

Warner
--000000000000df147a0600f03010--