Date: Sat, 19 Nov 2022 20:37:58 -0700 From: Warner Losh <imp@bsdimp.com> To: Tomoaki AOKI <junchoon@dec.sakura.ne.jp> Cc: =?UTF-8?Q?Chlast=C3=A1k_Miroslav?= <mira@chlastak.cz>, FreeBSD CURRENT <freebsd-current@freebsd.org> Subject: Re: loader.conf and rootdev option for memory disk Message-ID: <CANCZdfrYVXb1L_dud6p0=p623ey4uEVvGcm=rJNT1-XWrzbB5A@mail.gmail.com> In-Reply-To: <CANCZdfpNtRnqoirja30q_7gotE=Z9w2MG-XhjFETwNQU=XzgLQ@mail.gmail.com> References: <2E58D34B-F8C5-4291-B019-9E24F56DC3DF@chlastak.cz> <CANCZdfqGhHXCJtUOctpoB-sAuxSdzJZERSBritTazp_uragZ=Q@mail.gmail.com> <F3702494-1433-4324-B972-52FBD84EFFD8@chlastak.cz> <20221120055845.366367f1d371ae4d6eb8d747@dec.sakura.ne.jp> <97A75B5E-6C38-4CFB-9978-7E254595D980@chlastak.cz> <20221120100046.b44741ca341c1593a72f594b@dec.sakura.ne.jp> <CANCZdfpNtRnqoirja30q_7gotE=Z9w2MG-XhjFETwNQU=XzgLQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000f7f4dc05eddeaa0f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Nov 19, 2022 at 8:32 PM Warner Losh <imp@bsdimp.com> wrote: > > > On Sat, Nov 19, 2022 at 6:01 PM Tomoaki AOKI <junchoon@dec.sakura.ne.jp> > wrote: > >> But your previous post shows rootdev=3D there didn't work, and needed >> setting vfs.root.mountfrom=3D. >> >> OTOH, rootdev=3D is reported to work in efi/boot/freebsd/loader.env (wit= h >> efi loader) on freebsd-users-jp ML (as it's Japanese ML, in Japanese) >> this year. >> >> So /boot/defaults/loader.conf (/usr/src/stand/defaults/loader.conf) >> should be fixed, and what should be set in loader.env should be >> documented. >> >> *Dedicated brand-new manpage or in boot.8 (or in loader.8 describing >> rootdev, or loader.conf.8 in contrast with itself). >> > > Reading the code it's complicated. > > rootdev looks like it overrides the default root... unless > vfs.root.mountfrom > has already been set. > It's also a name in the 'boot loader' device namespace, not in the FreeBSD device namespace, so it shouldn't be 'ufs:/dev/foo' but rather 'disk1p3:' or similar. It's only when it's 'zfs:' that the boot loader device name space and the FreeBSD device name space overlap (also zfs: is special cased). It's also a bit complicated because it's not used as 'currdev' either. It's strictly a hint for where to mount FreeBSD's root front, but it's not used to find boot scripts and config files. That's always done with 'currdev' if no device is specified. It's also a little more complex with OpenFirmware is involved, but that's rare these days, so I'll not go into that. Warner > >> On Sat, 19 Nov 2022 22:31:42 +0100 >> Chlast=C3=A1k Miroslav <mira@chlastak.cz> wrote: >> >> > Look at the file /boot/defaults/loader.conf: >> > >> > =E2=80=A6 >> > ### Initial memory disk settings ########################### >> > #mdroot_load=3D"YES" # The "mdroot" prefix is arbitrary. >> > #mdroot_type=3D"md_image" # Create md(4) disk at boot. >> > #mdroot_name=3D"/boot/root.img" # Path to a file containing the imag= e. >> > #rootdev=3D"ufs:/dev/md0" # Set the root filesystem to md(4) >> device. >> > =E2=80=A6 >> > >> > =E2=80=94 >> > Mira >> > >> > > On 19 Nov 2022, at 21:58, Tomoaki AOKI <junchoon@dec.sakura.ne.jp> >> wrote: >> > > >> > > IIUC, rootdev should be set in loader.env, if needed. >> > > `man 5 loader.conf` has nothing about rootdev variable. >> > > >> > > (It's undocumented, IIRC.) >> > > >> > > >> > > On Sat, 19 Nov 2022 19:57:47 +0100 >> > > Chlast=C3=A1k Miroslav <mira@chlastak.cz <mailto:mira@chlastak.cz>> = wrote: >> > > >> > >> I have my device working for now - but the question is - Is the >> documentation and example for =E2=80=9Crootdev=E2=80=9D right or not? >> > >> >> > >> =E2=80=94 >> > >> Mira >> > >> >> > >>> On 18 Nov 2022, at 21:13, Warner Losh <imp@bsdimp.com <mailto: >> imp@bsdimp.com>> wrote: >> > >>> >> > >>> >> > >>> >> > >>> On Fri, Nov 18, 2022 at 12:57 PM Chlast=C3=A1k Miroslav < >> mira@chlastak.cz <mailto:mira@chlastak.cz> <mailto:mira@chlastak.cz >> <mailto:mira@chlastak.cz>>> wrote: >> > >>> Hi all, >> > >>> >> > >>> In the /boot/defaults/loader.conf are these options for memory dis= k >> settings: >> > >>> >> > >>> #mdroot_load=3D"YES" # The "mdroot" prefix is arbitra= ry. >> > >>> #mdroot_type=3D"md_image" # Create md(4) disk at boot. >> > >>> #mdroot_name=3D"/boot/root.img" # Path to a file containing the >> image. >> > >>> #rootdev=3D"ufs:/dev/md0" # Set the root filesystem to md(= 4) >> device. >> > >>> >> > >>> >> > >>> But - is this example for rootdev option still right? Because >> =E2=80=9Cufs:/dev/md0=E2=80=9D works fine on freebsd 12.1, but on freebs= d 12.3 this does >> not work and generates error message: >> > >>> >> > >>> Can=E2=80=99t determine root device >> > >>> >> > >>> >> > >>> When I use this option with value =E2=80=9C/dev/md0=E2=80=9D or = =E2=80=9Cmd0=E2=80=9D (even with >> this option commented out), so the machine boots correctly without any >> error. >> > >>> >> > >>> I think you want vfs.root.mountfrom=3D instead of rootdev=3D here. >> > >>> >> > >>> Warner >> > >>> >> > >>> =E2=80=94 >> > >>> Mira >> > >> >> > > >> > > >> > > -- >> > > =E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E [Tomoaki AOKI] <junchoon@d= ec.sakura.ne.jp <mailto: >> junchoon@dec.sakura.ne.jp>> >> > >> >> >> -- >> =E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E [Tomoaki AOKI] <junchoon@dec.s= akura.ne.jp> >> >> --000000000000f7f4dc05eddeaa0f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Sat, Nov 19, 2022 at 8:32 PM Warne= r Losh <<a href=3D"mailto:imp@bsdimp.com">imp@bsdimp.com</a>> wrote:<= br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e= x;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"= ><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr"= class=3D"gmail_attr">On Sat, Nov 19, 2022 at 6:01 PM Tomoaki AOKI <<a h= ref=3D"mailto:junchoon@dec.sakura.ne.jp" target=3D"_blank">junchoon@dec.sak= ura.ne.jp</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex">But your previous post shows rootdev=3D there didn't work, a= nd needed<br> setting vfs.root.mountfrom=3D.<br> <br> OTOH, rootdev=3D is reported to work in efi/boot/freebsd/loader.env (with<b= r> efi loader) on freebsd-users-jp ML (as it's Japanese ML, in Japanese)<b= r> this year.<br> <br> So /boot/defaults/loader.conf (/usr/src/stand/defaults/loader.conf)<br> should be fixed, and what should be set in loader.env should be<br> documented.<br> <br> =C2=A0*Dedicated brand-new manpage or in boot.8 (or in loader.8 describing<= br> =C2=A0 rootdev, or loader.conf.8 in contrast with itself).<br></blockquote>= <div><br></div><div>Reading the code it's complicated.</div><div><br></= div><div>rootdev looks like it overrides the default root... unless vfs.roo= t.mountfrom</div><div>has already been set.<br></div></div></div></blockquo= te><div><br></div><div>It's also a name in the 'boot loader' de= vice namespace, not in the FreeBSD</div><div>device namespace, so it should= n't be 'ufs:/dev/foo' but rather 'disk1p3:'</div><div>o= r similar. It's only when it's 'zfs:' that the boot loader = device name space</div><div>and the FreeBSD device name space overlap (also= zfs: is special cased).</div><div><br></div><div>It's also a bit compl= icated because it's not used as 'currdev' either. It's</div= ><div>strictly a hint for where to mount FreeBSD's root front, but it&#= 39;s not used</div><div>to find boot scripts and config files. That's a= lways done with 'currdev'</div><div>if no device is specified.</div= ><div><br></div><div>It's also a little more complex with OpenFirmware = is involved, but</div><div>that's rare these days, so I'll not go i= nto that.<br></div><div><br></div><div>Warner<br></div><div>=C2=A0</div><bl= ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef= t:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div class= =3D"gmail_quote"><div></div><blockquote class=3D"gmail_quote" style=3D"marg= in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e= x"> <br> On Sat, 19 Nov 2022 22:31:42 +0100<br> Chlast=C3=A1k Miroslav <<a href=3D"mailto:mira@chlastak.cz" target=3D"_b= lank">mira@chlastak.cz</a>> wrote:<br> <br> > Look at the file /boot/defaults/loader.conf:<br> > <br> > =E2=80=A6<br> > ###=C2=A0 Initial memory disk settings=C2=A0 #########################= ##<br> > #mdroot_load=3D"YES"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 # The "mdroot" prefix is arbitrary.<br> > #mdroot_type=3D"md_image"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#= Create md(4) disk at boot.<br> > #mdroot_name=3D"/boot/root.img"=C2=A0 =C2=A0# Path to a file= containing the image.<br> > #rootdev=3D"ufs:/dev/md0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#= Set the root filesystem to md(4) device.<br> > =E2=80=A6<br> > <br> > =E2=80=94<br> > Mira<br> > <br> > > On 19 Nov 2022, at 21:58, Tomoaki AOKI <<a href=3D"mailto:junc= hoon@dec.sakura.ne.jp" target=3D"_blank">junchoon@dec.sakura.ne.jp</a>> = wrote:<br> > > <br> > > IIUC, rootdev should be set in loader.env, if needed.<br> > > `man 5 loader.conf` has nothing about rootdev variable.<br> > > <br> > > (It's undocumented, IIRC.)<br> > > <br> > > <br> > > On Sat, 19 Nov 2022 19:57:47 +0100<br> > > Chlast=C3=A1k Miroslav <<a href=3D"mailto:mira@chlastak.cz" ta= rget=3D"_blank">mira@chlastak.cz</a> <mailto:<a href=3D"mailto:mira@chla= stak.cz" target=3D"_blank">mira@chlastak.cz</a>>> wrote:<br> > > <br> > >> I have my device working for now - but the question is - Is t= he documentation and example for =E2=80=9Crootdev=E2=80=9D right or not?<br= > > >> <br> > >> =E2=80=94<br> > >> Mira<br> > >> <br> > >>> On 18 Nov 2022, at 21:13, Warner Losh <<a href=3D"mail= to:imp@bsdimp.com" target=3D"_blank">imp@bsdimp.com</a> <mailto:<a href= =3D"mailto:imp@bsdimp.com" target=3D"_blank">imp@bsdimp.com</a>>> wro= te:<br> > >>> <br> > >>> <br> > >>> <br> > >>> On Fri, Nov 18, 2022 at 12:57 PM Chlast=C3=A1k Miroslav &= lt;<a href=3D"mailto:mira@chlastak.cz" target=3D"_blank">mira@chlastak.cz</= a> <mailto:<a href=3D"mailto:mira@chlastak.cz" target=3D"_blank">mira@ch= lastak.cz</a>> <mailto:<a href=3D"mailto:mira@chlastak.cz" target=3D"= _blank">mira@chlastak.cz</a> <mailto:<a href=3D"mailto:mira@chlastak.cz"= target=3D"_blank">mira@chlastak.cz</a>>>> wrote:<br> > >>> Hi all,<br> > >>> <br> > >>> In the /boot/defaults/loader.conf are these options for m= emory disk settings:<br> > >>> <br> > >>> #mdroot_load=3D"YES"=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 # The "mdroot" prefix is arbitrary.<br> > >>> #mdroot_type=3D"md_image"=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0# Create md(4) disk at boot.<br> > >>> #mdroot_name=3D"/boot/root.img"=C2=A0 =C2=A0# P= ath to a file containing the image.<br> > >>> #rootdev=3D"ufs:/dev/md0"=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0# Set the root filesystem to md(4) device.<br> > >>> <br> > >>> <br> > >>> But - is this example for rootdev option still right? Bec= ause =E2=80=9Cufs:/dev/md0=E2=80=9D works fine on freebsd 12.1, but on free= bsd 12.3 this does not work and generates error message:<br> > >>> <br> > >>> Can=E2=80=99t determine root device<br> > >>> <br> > >>> <br> > >>> When I use this option with value =E2=80=9C/dev/md0=E2=80= =9D or =E2=80=9Cmd0=E2=80=9D (even with this option commented out), so the = machine boots correctly without any error.<br> > >>> <br> > >>> I think you want vfs.root.mountfrom=3D instead of rootdev= =3D here.<br> > >>> <br> > >>> Warner<br> > >>> <br> > >>> =E2=80=94<br> > >>> Mira<br> > >> <br> > > <br> > > <br> > > -- <br> > > =E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E=C2=A0 [Tomoaki AOKI]=C2=A0 = =C2=A0 <<a href=3D"mailto:junchoon@dec.sakura.ne.jp" target=3D"_blank">j= unchoon@dec.sakura.ne.jp</a> <mailto:<a href=3D"mailto:junchoon@dec.saku= ra.ne.jp" target=3D"_blank">junchoon@dec.sakura.ne.jp</a>>><br> > <br> <br> <br> -- <br> =E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E=C2=A0 [Tomoaki AOKI]=C2=A0 =C2=A0 <= ;<a href=3D"mailto:junchoon@dec.sakura.ne.jp" target=3D"_blank">junchoon@de= c.sakura.ne.jp</a>><br> <br> </blockquote></div></div> </blockquote></div></div> --000000000000f7f4dc05eddeaa0f--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrYVXb1L_dud6p0=p623ey4uEVvGcm=rJNT1-XWrzbB5A>