From nobody Mon Jul 01 22:36:35 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 4WCgrb5j9Tz5QL6c for ; Mon, 01 Jul 2024 22:36:47 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WCgrZ5stsz4DKR for ; Mon, 1 Jul 2024 22:36:46 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=CiWya5gO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2607:f8b0:4864:20::534 as permitted sender) smtp.mailfrom=rick.macklem@gmail.com Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-74840cb804dso986198a12.2 for ; Mon, 01 Jul 2024 15:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719873405; x=1720478205; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZWlSKihytbhJ6GQYRSdmVHKHFYDPaWKs3yanBz9jL2c=; b=CiWya5gO06rgZLIJJ0ITdAJZD+Bf5xoa1hO65DOuGYIC2y9PnNJAt9hFtSsOsCvwE+ qUX/C37fE2GUzw7aHiaRgxHiOLxYJ6nfDeNfo0ai5zh1Vv6srOGbe02+dSSZkLbMW2vn Ypyx0Cki8qdTwwzVk8+RhrRgiVZmYfMSghApKlHoRCUKNz53FpBfpZsl48GkiydrA00K gfxKj5BuPWLfvIahguwBKIBFwyqGfUd6NqflRlpmMVeJGQshNaQFKvX/edvB4Q0B99sK JCy1FCXUYlebC+sJkX64BmYLHHZxlIKVpXErlbQQUTUCtaAuPuOiJGF9DzVj681ACHOS Fsrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719873405; x=1720478205; h=content-transfer-encoding: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=ZWlSKihytbhJ6GQYRSdmVHKHFYDPaWKs3yanBz9jL2c=; b=j8eVq6LMOQ/pA4ujDAgqHSL3QjRu2SJwFu1WnQHYEaHdKIGkIVRRFlZi6mVJvsQlEa fJbdtH+7Cz2YgT9lDRVY1l8zdt4/ZWPGl+kN5PJkU56bXN9JvUyx0TpN833j0FZr8ToZ RSBw5YPh+yeqGNKvUaHT/y3GEM5jweCnDTDJm00TmUf2kSb7WdyI+3DtSilesROWW3iH NDFL54wzr7ZNYfD9cpuSjYiqh4gB9/8fLi6zfSteT2ECCB42Tm1Rqxw5ovtS6r/0bXJs eYeF0zcB/MBw95YWNrSNBR58rNA/+9n4LD9WBuCeY2xvsta25vLJ/vP1YNw2dHbb0M0o 4rEg== X-Gm-Message-State: AOJu0Yz26fJ5s4I0ylWSIJfD96UeRhpO0LRD5AVreR2et0uFeqYxDd8/ 5H6pJrFJaLkslXFgyt7Vl8mGZ+fmrUyORT3Lu7zoC0yqL7oSmWmGXpNlDV4MZNdpj+ZkhcnI7F7 BklCUwxm5waDeq4xcaWgZdH60Xw== X-Google-Smtp-Source: AGHT+IHsnjN7xxchUH2sHHwxpOfR+++OcB6rBpV4Afue0FgSAt/lM6Y89KLzxTdHDa4wIy+++XQIxQ4mhAX+ZyVD5z8= X-Received: by 2002:a17:90a:aa02:b0:2c3:cc6:636e with SMTP id 98e67ed59e1d1-2c93d6d7335mr5478345a91.2.1719873405167; Mon, 01 Jul 2024 15:36:45 -0700 (PDT) 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: <202406301523.45UFNLnX009631@gndrsh.dnsmgr.net> In-Reply-To: <202406301523.45UFNLnX009631@gndrsh.dnsmgr.net> From: Rick Macklem Date: Mon, 1 Jul 2024 15:36:35 -0700 Message-ID: Subject: Re: Booting in bhyve always sets currdev to ZFS To: "Rodney W. Grimes" Cc: FreeBSD CURRENT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.995]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[text/plain]; TO_DN_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; TAGGED_FROM(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; RCVD_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::534:from] X-Rspamd-Queue-Id: 4WCgrZ5stsz4DKR On Sun, Jun 30, 2024 at 8:23=E2=80=AFAM Rodney W. Grimes wrote: > > > On Fri, Jun 28, 2024 at 6:26?PM Rick Macklem w= rote: > > > > > > 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=3Ddisk0s1a: > > > 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 /bo= ot, > > I am not 100% sure?) that sets currdev=3Dzfs:example: since it sees the= re is ZFS > > in a partition on the drive. It is not the boot partition and doesn't h= ave > > any boot stuff in it. > > > > When I look at userboot, it appears that it always sets userboot_zfs_fo= und > > 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 v= olume > > and not just that a pool exists on the partition, maybe? > > > > Anyhow, manually setting currdev=3Ddisk0s1a: 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 ki= nda defeats the purpose of having UFS as the boot fs.) 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. --> I am wondering if sanity_check_currdev() shoud be added to userboot to handle this case? 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@freebs= d.org