Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Nov 2022 20:32:52 -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:  <CANCZdfpNtRnqoirja30q_7gotE=Z9w2MG-XhjFETwNQU=XzgLQ@mail.gmail.com>
In-Reply-To: <20221120100046.b44741ca341c1593a72f594b@dec.sakura.ne.jp>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000b4161705edde9863
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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 (with
> 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.


>
> 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 image=
.
> > #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>> w=
rote:
> > >
> > >> 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@chlas=
tak.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 disk
> settings:
> > >>>
> > >>> #mdroot_load=3D"YES"              # The "mdroot" prefix is arbitrar=
y.
> > >>> #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 freebsd=
 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@de=
c.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.sa=
kura.ne.jp>
>
>

--000000000000b4161705edde9863
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 6:01 PM Tomoa=
ki AOKI &lt;<a href=3D"mailto:junchoon@dec.sakura.ne.jp">junchoon@dec.sakur=
a.ne.jp</a>&gt; 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-lef=
t:1ex">But your previous post shows rootdev=3D there didn&#39;t work, and n=
eeded<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&#39;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&#39;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>=C2=A0</div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex">
<br>
On Sat, 19 Nov 2022 22:31:42 +0100<br>
Chlast=C3=A1k Miroslav &lt;<a href=3D"mailto:mira@chlastak.cz" target=3D"_b=
lank">mira@chlastak.cz</a>&gt; wrote:<br>
<br>
&gt; Look at the file /boot/defaults/loader.conf:<br>
&gt; <br>
&gt; =E2=80=A6<br>
&gt; ###=C2=A0 Initial memory disk settings=C2=A0 #########################=
##<br>
&gt; #mdroot_load=3D&quot;YES&quot;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 # The &quot;mdroot&quot; prefix is arbitrary.<br>
&gt; #mdroot_type=3D&quot;md_image&quot;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=
 Create md(4) disk at boot.<br>
&gt; #mdroot_name=3D&quot;/boot/root.img&quot;=C2=A0 =C2=A0# Path to a file=
 containing the image.<br>
&gt; #rootdev=3D&quot;ufs:/dev/md0&quot;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=
 Set the root filesystem to md(4) device.<br>
&gt; =E2=80=A6<br>
&gt; <br>
&gt; =E2=80=94<br>
&gt; Mira<br>
&gt; <br>
&gt; &gt; On 19 Nov 2022, at 21:58, Tomoaki AOKI &lt;<a href=3D"mailto:junc=
hoon@dec.sakura.ne.jp" target=3D"_blank">junchoon@dec.sakura.ne.jp</a>&gt; =
wrote:<br>
&gt; &gt; <br>
&gt; &gt; IIUC, rootdev should be set in loader.env, if needed.<br>
&gt; &gt; `man 5 loader.conf` has nothing about rootdev variable.<br>
&gt; &gt; <br>
&gt; &gt; (It&#39;s undocumented, IIRC.)<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; On Sat, 19 Nov 2022 19:57:47 +0100<br>
&gt; &gt; Chlast=C3=A1k Miroslav &lt;<a href=3D"mailto:mira@chlastak.cz" ta=
rget=3D"_blank">mira@chlastak.cz</a> &lt;mailto:<a href=3D"mailto:mira@chla=
stak.cz" target=3D"_blank">mira@chlastak.cz</a>&gt;&gt; wrote:<br>
&gt; &gt; <br>
&gt; &gt;&gt; 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=
>
&gt; &gt;&gt; <br>
&gt; &gt;&gt; =E2=80=94<br>
&gt; &gt;&gt; Mira<br>
&gt; &gt;&gt; <br>
&gt; &gt;&gt;&gt; On 18 Nov 2022, at 21:13, Warner Losh &lt;<a href=3D"mail=
to:imp@bsdimp.com" target=3D"_blank">imp@bsdimp.com</a> &lt;mailto:<a href=
=3D"mailto:imp@bsdimp.com" target=3D"_blank">imp@bsdimp.com</a>&gt;&gt; wro=
te:<br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; 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> &lt;mailto:<a href=3D"mailto:mira@chlastak.cz" target=3D"_blank">mira@ch=
lastak.cz</a>&gt; &lt;mailto:<a href=3D"mailto:mira@chlastak.cz" target=3D"=
_blank">mira@chlastak.cz</a> &lt;mailto:<a href=3D"mailto:mira@chlastak.cz"=
 target=3D"_blank">mira@chlastak.cz</a>&gt;&gt;&gt; wrote:<br>
&gt; &gt;&gt;&gt; Hi all,<br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; In the /boot/defaults/loader.conf are these options for m=
emory disk settings:<br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; #mdroot_load=3D&quot;YES&quot;=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 # The &quot;mdroot&quot; prefix is arbitrary.<br>
&gt; &gt;&gt;&gt; #mdroot_type=3D&quot;md_image&quot;=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0# Create md(4) disk at boot.<br>
&gt; &gt;&gt;&gt; #mdroot_name=3D&quot;/boot/root.img&quot;=C2=A0 =C2=A0# P=
ath to a file containing the image.<br>
&gt; &gt;&gt;&gt; #rootdev=3D&quot;ufs:/dev/md0&quot;=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0# Set the root filesystem to md(4) device.<br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; 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>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; Can=E2=80=99t determine root device<br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; 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>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; I think you want vfs.root.mountfrom=3D instead of rootdev=
=3D here.<br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; Warner<br>
&gt; &gt;&gt;&gt; <br>
&gt; &gt;&gt;&gt; =E2=80=94<br>
&gt; &gt;&gt;&gt; Mira<br>
&gt; &gt;&gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; -- <br>
&gt; &gt; =E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E=C2=A0 [Tomoaki AOKI]=C2=A0 =
=C2=A0 &lt;<a href=3D"mailto:junchoon@dec.sakura.ne.jp" target=3D"_blank">j=
unchoon@dec.sakura.ne.jp</a> &lt;mailto:<a href=3D"mailto:junchoon@dec.saku=
ra.ne.jp" target=3D"_blank">junchoon@dec.sakura.ne.jp</a>&gt;&gt;<br>
&gt; <br>
<br>
<br>
-- <br>
=E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E=C2=A0 [Tomoaki AOKI]=C2=A0 =C2=A0 &lt=
;<a href=3D"mailto:junchoon@dec.sakura.ne.jp" target=3D"_blank">junchoon@de=
c.sakura.ne.jp</a>&gt;<br>
<br>
</blockquote></div></div>

--000000000000b4161705edde9863--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpNtRnqoirja30q_7gotE=Z9w2MG-XhjFETwNQU=XzgLQ>