Date: Thu, 20 Jul 2023 13:31:01 -0600 From: Warner Losh <imp@bsdimp.com> To: Mike Karels <mike@karels.net> Cc: Current FreeBSD <freebsd-current@freebsd.org> Subject: Re: confusion about root partition causes panic during startup Message-ID: <CANCZdfovYAaUT-4rj-gW1du_3LiorHN_BvjZYkdjKqVB4Bz1PA@mail.gmail.com> In-Reply-To: <120E9843-2732-4D2D-A23D-CB608F199E84@karels.net> References: <120E9843-2732-4D2D-A23D-CB608F199E84@karels.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000df147a0600f03010 Content-Type: text/plain; charset="UTF-8" On Thu, Jul 20, 2023, 1:27 PM Mike Karels <mike@karels.net> 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 <div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" = class=3D"gmail_attr">On Thu, Jul 20, 2023, 1:27 PM Mike Karels <<a href= =3D"mailto:mike@karels.net">mike@karels.net</a>> wrote:<br></div><blockq= uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc = solid;padding-left:1ex">I installed an additional NVME drive on a system, a= nd then booted.=C2=A0 It turns<br> out that the new drive became nda0, renumbering the other drives.=C2=A0 The= loader<br> found the correct partition to boot (the only choice), and loaded the kerne= l<br> correctly.=C2=A0 However, /etc/fstab still had the old name (nvd1p2), which= is<br> now drive 2.=C2=A0 I expected it to drop into single user, but instead the = system<br> panicked in vfs_mountroot_shuffle trying to switch root devices (see below)= .<br> It doesn't seem that having the wrong root device in /etc/fstab should = cause<br> a panic; it makes it harder to patch the system.=C2=A0 I was unable to get = the<br> 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<br> the root device before mounting it.=C2=A0 I can easily reproduce this to te= st.<br> Probably the NDFREE_PNBUF() shouldn't happen if namei() returned an err= or.<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mike<br> <br> Trying to mount root from ufs:/dev/nvd1p2 [rw]...<br> WARNING: WITNESS option enabled, expect reduced performance.<br> mountroot: unable to remount devfs under /dev (error 2)<br> panic: Assertion _ndp->ni_cnd.cn_pnbuf !=3D NULL failed at ../../../kern= /vfs_mountroot.c:416<br> cpuid =3D 19<br> time =3D 11<br> KDB: stack backtrace:<br> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe006d3ba= c40<br> vpanic() at vpanic+0x149/frame 0xfffffe006d3bac90<br> panic() at panic+0x43/frame 0xfffffe006d3bacf0<br> vfs_mountroot() at vfs_mountroot+0x1bf7/frame 0xfffffe006d3bae60<br> start_init() at start_init+0x23/frame 0xfffffe006d3baef0<br> fork_exit() at fork_exit+0x82/frame 0xfffffe006d3baf30<br> fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe006d3baf30<br> --- trap 0x5c035c02, rip =3D 0x680c680c680c680c, rsp =3D 0x1b6b1f6b1b6b1b6b= , rbp =3D 0x4eb54eb54eb54eb5 ---<br> KDB: enter: panic<br> [ thread pid 1 tid 100002 ]<br> Stopped at=C2=A0 =C2=A0 =C2=A0 kdb_enter+0x32: movq=C2=A0 =C2=A0 $0,0xde764= 3(%rip)<br></blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D= "auto"><br></div><div dir=3D"auto">I'll have to see if I can recreate t= his. I've been running this way for a long time...</div><div dir=3D"aut= o"><br></div><div dir=3D"auto">Warner</div><div dir=3D"auto"><div class=3D"= gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b= order-left:1px #ccc solid;padding-left:1ex"> </blockquote></div></div></div> --000000000000df147a0600f03010--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfovYAaUT-4rj-gW1du_3LiorHN_BvjZYkdjKqVB4Bz1PA>