From nobody Tue Jul 02 14:30:18 2024 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 4WD5144Yf3z5QZxc for ; Tue, 02 Jul 2024 14:30:32 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (pdx.rh.CN85.dnsmgr.net [65.75.216.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4WD5133y4Sz576x for ; Tue, 2 Jul 2024 14:30:31 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=gndrsh.dnsmgr.net; spf=pass (mx1.freebsd.org: domain of freebsd-rwg@gndrsh.dnsmgr.net designates 65.75.216.6 as permitted sender) smtp.mailfrom=freebsd-rwg@gndrsh.dnsmgr.net Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 462EUIKK017612; Tue, 2 Jul 2024 07:30:18 -0700 (PDT) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 462EUI7s017611; Tue, 2 Jul 2024 07:30:18 -0700 (PDT) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <202407021430.462EUI7s017611@gndrsh.dnsmgr.net> Subject: Re: Booting in bhyve always sets currdev to ZFS In-Reply-To: To: Rick Macklem Date: Tue, 2 Jul 2024 07:30:18 -0700 (PDT) CC: "Rodney W. Grimes" , FreeBSD CURRENT X-Mailer: ELM [version 2.4ME+ PL121h (25)] 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.77 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-0.99)[-0.994]; NEURAL_HAM_SHORT(-0.98)[-0.976]; DMARC_POLICY_ALLOW(-0.50)[gndrsh.dnsmgr.net,none]; R_SPF_ALLOW(-0.20)[+ip4:65.75.216.0/23]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_TO(0.00)[gmail.com]; ARC_NA(0.00)[]; ASN(0.00)[asn:10494, ipnet:65.75.216.0/23, country:US]; TAGGED_RCPT(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@FreeBSD.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_THREE(0.00)[3] X-Rspamd-Queue-Id: 4WD5133y4Sz576x > On Sun, Jun 30, 2024 at 8:23?AM Rodney W. Grimes > wrote: > > > > > On Fri, Jun 28, 2024 at 6:26?PM Rick Macklem wrote: > > > > > > > > Hi, > > > > > > > > I've installed FreeBSD current in a bhvye instance. Everything > > > > went ok, with UFS as a root partition. > > > > Then I created a zpool in another partition... > > > > - Now, every time I boot it I have to > > > > OK set currdev=disk0s1a: > > > > to get it to boot. > > > > > > > > What is the trick to keep ZFS from messing up the boot variables? > > > I've been poking around, but haven't learned much. > > > I think it is userboot (although there are so many boot programs in /boot, > > > I am not 100% sure?) that sets currdev=zfs:example: since it sees there is ZFS > > > in a partition on the drive. It is not the boot partition and doesn't have > > > any boot stuff in it. > > > > > > When I look at userboot, it appears that it always sets userboot_zfs_found > > > to 1 whenever userboot_zfs_probe() is called, given that there is a ZFS > > > partition with a pool on it. This makes extract_currdev get set to the > > > ZFS stuff, > > > assuming I am reading the code correctly. > > > What I do not understand is why I have not seen this before? > > > (Was the a change to building it with USERBOOT_ZFS_SUPPORT done?) > > > > > > It seems that userboot_zfs_probe() should check for boot files on the volume > > > and not just that a pool exists on the partition, maybe? > > > > > > Anyhow, manually setting currdev=disk0s1a: gets around the problem. > > > > You should be able to set that in your ufs partition /boot/loader.conf > > file and at least then your not having to drop to the OK prompt and > > manually entering this. > Doesn't help, because it is not reading files from the boot ufs file system. > (I could copy all the boot stuff over into the ZFS file system, but that kinda > defeats the purpose of having UFS as the boot fs.) It had to of loaded userboot from the ufs, right? What type of disk is this? gpt or mbr? Can you show the output of gpart show and gpart list? > > For example, it always fails with: > ERROR: cannot open /boot/lua/loader.lua: no such file or directory. > > When I look in stand/efi/loader/main.c, there is a function that checks > for boot files called sanity_check_currdev(). However, userboot does not > have a similar function and just seems to assume that the ZFS partition > in the bootable one, if it finds one. That sounds like a wrong assumption by the code. > --> I am wondering if sanity_check_currdev() shoud be added to userboot > to handle this case? Warner?? > rick > > > > > There is much magic in boot code that bites, and not just in FreeBSD. > > Often assumptions are made that "this" boot code, and "this" OS are > > the only things on the disk(s). > > > > The fact that Linux uses a "apple-zfs" uuid, and FreeBSD a "FreeBSD-zfs" > > drove me nuts for 2 days until I found this little tid bit. > > > > Zpool import doesnt care, but the boot code does! > > > > -- > > Rod Grimes rgrimes@freebsd.org -- Rod Grimes rgrimes@freebsd.org