From nobody Sun Nov 20 03:37:58 2022 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 4NFGSh6fDbz4hlnT for ; Sun, 20 Nov 2022 03:38:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 4NFGSg6TW0z44JQ for ; Sun, 20 Nov 2022 03:38:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=hPfyDA4E; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2a00:1450:4864:20::636) smtp.mailfrom=wlosh@bsdimp.com; dmarc=none Received: by mail-ej1-x636.google.com with SMTP id vv4so12433197ejc.2 for ; Sat, 19 Nov 2022 19:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cacDhosgfswcgvZv1/LceQO3x011BALySjeuyuQefwY=; b=hPfyDA4EITs0xVFsIrRJFNHaWuhLFvOlRkTrm7nx00Bz4nQHEThSoh4JGlp7YAxTi9 zAnAMbaNqC83QatbhJAtIvAc0xLCvNwyfTiTYipmfKoNdtP8TbKlJq0n1LlbHMfMxkio VNlVwYnSLkMYBeIx48C4A0TIYbxUzDwrYWswnDAooIXFwdp7sJUl9HTin0rLG0S1FqUE GYJZYN+qPfrsgHSCYN2uVfQ+j51qwvxfwFJIOuJcxdj1SAhQ0bC9TnhWAKVbTv4J54iI 2hZeuT8u+DPKSKnlx2PgAflrwwMhsRb19ISULrFFLpZ9rvgQZ2oP7zgEWjAOibkpKAtk WH7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=cacDhosgfswcgvZv1/LceQO3x011BALySjeuyuQefwY=; b=TEbb/AwdLziUW9c3L6J1ldYt8J31LL475WB+mrd9Azx241w5QcCr/DhNG7RlJEnF2a Q3OjC3C0GalyuZ0ca8daz38duCSWlIvyhUtvLCwGXW7ZBeEg57LZXICgOulr0ROfOPmu 1OF+lcivt+LDnvVR8nGkIBtokK3itLNeWv4xFowCTVa+ulct1ViM6nKD17lCmtGUO0zG x0Vwrasltib9uOirw463MFAdLrJpRZZG+fbjONAq3jNbc9kwM3TQ5wYZ5utaoqmdiUyu 7bZ3IcVMzvUpDzGNATAatyA/7K2513jz8kt2WX3wrQ0lLARunCN9Srfc7Q+IxR+/ePRO zKVg== X-Gm-Message-State: ANoB5pkDCzieLAG2SN+/By+8/3jpcOq/amVIe2lQ0bLspoW4TKeiHYGE SAmOTxtsFpkb2rRQeVYD+cLf++JH8dSjeUrfUW7WWcrwZS4= X-Google-Smtp-Source: AA0mqf60rsdfeSSW5wMOPLctrtsMqcY8WXzjbXmvhAv1zODXCyMR2uLsYKPvb/rxY3vx98ey/Pk8tH1hTqzpCLCjHLg= X-Received: by 2002:a17:906:b210:b0:7ae:d116:fabb with SMTP id p16-20020a170906b21000b007aed116fabbmr10888805ejz.317.1668915490445; Sat, 19 Nov 2022 19:38:10 -0800 (PST) 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: <2E58D34B-F8C5-4291-B019-9E24F56DC3DF@chlastak.cz> <20221120055845.366367f1d371ae4d6eb8d747@dec.sakura.ne.jp> <97A75B5E-6C38-4CFB-9978-7E254595D980@chlastak.cz> <20221120100046.b44741ca341c1593a72f594b@dec.sakura.ne.jp> In-Reply-To: From: Warner Losh Date: Sat, 19 Nov 2022 20:37:58 -0700 Message-ID: Subject: Re: loader.conf and rootdev option for memory disk To: Tomoaki AOKI Cc: =?UTF-8?Q?Chlast=C3=A1k_Miroslav?= , FreeBSD CURRENT Content-Type: multipart/alternative; boundary="000000000000f7f4dc05eddeaa0f" X-Spamd-Result: default: False [-2.98 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.977]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::636:from]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_SPF_NA(0.00)[no SPF record]; ARC_NA(0.00)[]; TO_DN_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DMARC_NA(0.00)[bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4NFGSg6TW0z44JQ X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N --000000000000f7f4dc05eddeaa0f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Nov 19, 2022 at 8:32 PM Warner Losh wrote: > > > On Sat, Nov 19, 2022 at 6:01 PM Tomoaki AOKI > 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 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 >> 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 > = 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>> wrote: >> > >>> >> > >>> >> > >>> >> > >>> On Fri, Nov 18, 2022 at 12:57 PM Chlast=C3=A1k Miroslav < >> 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@dec.sakura.ne.jp>> >> > >> >> >> -- >> =E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E [Tomoaki AOKI] >> >> --000000000000f7f4dc05eddeaa0f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Nov 19, 2022 at 8:32 PM Warne= r Losh <imp@bsdimp.com> wrote:<= br>


On Sat, Nov 19, 2022 at 6:01 PM Tomoaki AOKI <junchoon@dec.sak= ura.ne.jp> wrote:
But your previous post shows rootdev=3D there didn't work, a= nd 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.

=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).
=

Reading the code it's complicated.

rootdev looks like it overrides the default root... unless vfs.roo= t.mountfrom
has already been set.

It's also a name in the 'boot loader' de= vice namespace, not in the FreeBSD
device namespace, so it should= n't be 'ufs:/dev/foo' but rather 'disk1p3:'
o= r 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 compl= icated because it's not used as 'currdev' either. It's
strictly a hint for where to mount FreeBSD's root front, but it&#= 39;s not used
to find boot scripts and config files. That's a= lways 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 i= nto that.

Warner
=C2=A0

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
> ###=C2=A0 Initial memory disk settings=C2=A0 #########################= ##
> #mdroot_load=3D"YES"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 # The "mdroot" prefix is arbitrary.
> #mdroot_type=3D"md_image"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#= Create md(4) disk at boot.
> #mdroot_name=3D"/boot/root.img"=C2=A0 =C2=A0# Path to a file= containing the image.
> #rootdev=3D"ufs:/dev/md0"=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#= 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 t= he 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>> wro= te:
> >>>
> >>>
> >>>
> >>> On Fri, Nov 18, 2022 at 12:57 PM Chlast=C3=A1k Miroslav &= lt;mira@chlastak.cz <mailto:mira@ch= lastak.cz> <mailto:mira@chlastak.cz <mailto:mira@chlastak.cz>>> wrote:
> >>> Hi all,
> >>>
> >>> In the /boot/defaults/loader.conf are these options for m= emory disk settings:
> >>>
> >>> #mdroot_load=3D"YES"=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 # The "mdroot" prefix is arbitrary.
> >>> #mdroot_type=3D"md_image"=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0# Create md(4) disk at boot.
> >>> #mdroot_name=3D"/boot/root.img"=C2=A0 =C2=A0# P= ath to a file containing the image.
> >>> #rootdev=3D"ufs:/dev/md0"=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0# Set the root filesystem to md(4) device.
> >>>
> >>>
> >>> 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:
> >>>
> >>> 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=C2=A0 [Tomoaki AOKI]=C2=A0 = =C2=A0 <j= unchoon@dec.sakura.ne.jp <mailto:junchoon@dec.sakura.ne.jp>>
>


--
=E9=9D=92=E6=9C=A8 =E7=9F=A5=E6=98=8E=C2=A0 [Tomoaki AOKI]=C2=A0 =C2=A0 <= ;junchoon@de= c.sakura.ne.jp>

--000000000000f7f4dc05eddeaa0f--