From nobody Fri Mar 22 09:15:02 2024 X-Original-To: dev-commits-src-all@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 4V1Gr62Ts4z5G8jl; Fri, 22 Mar 2024 09:15:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V1Gr61xfKz4XsY; Fri, 22 Mar 2024 09:15:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711098902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hHXV0dLfbJ/DPR/6zZef6I/6dOTLV45DfhChs4DKRZo=; b=cWZOtBBmRZxT5K3sMLbl44j7kY7HbauEbneV7COQtpzdqddhRlSVdTUN0xYNx2m+BwEdlX 0S9CCxJ3NunBWstzOnedZRsjvXnNlw4KEEKXvvmO7WWah6Kt7JRJdozvUu+O4BQJA5CjVY wai63MHY9ctq71wnUuk0831EP+aSGKHx2/cAS7W3DU+t4CIEVn8JLGFCx6tTjfB+YqVIH1 KwNw4ncKq4fP7GCAOINkFxhjckp45aFzZWNZv8zfT9b6QAwWgNFbOS0PVi/0DVMx9eqoO4 3y9Tz7BRPm8zR90YP9/gBgF1tLy5J4+LArIHNhzTPxRSBg4oo5b1Y5Rcmv84Kg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711098902; a=rsa-sha256; cv=none; b=c3oU97NIMb8hCGK92JVGVdUVnZZJb/9U0iOuB6F13uOF2rQgKvmBYj16Znj5nLZPtZ0xmW N9MGUufyJA4P4683gBUBdq9sBXIsAgb52HbX/PtD5Tc0m/19D5KJd+2DMf7KQtGB9Vkr9M Vx6cVFPrVzFnocB7km6UjZ8FrTSeRpzDpyCWcF30Y9jhD/OMurX65AHCDz5k5h8aMVMT5P 9TRb9F6AzpBv8uEFjEQXAgfnWm3enxWAfC2J53GqAmyHFnm5XWV2JXqIxLjIisDLWvhzZ8 gnXSHPjUCRIttGMur/TUc79jiHwWY1gIQU0h3RupbCqFZvQz0zvV/IFrvXBxkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711098902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hHXV0dLfbJ/DPR/6zZef6I/6dOTLV45DfhChs4DKRZo=; b=MFulN97TRQtlQL/GaxnWUwaM2Z1tq/UWR9VpcdDALn5MwUCYIzkBvok67SXnHU3IoYXPyR 6Piq5+RjhXhOw6YrUQidhdJ8FSEoHdxG4ZPB25WkCCJh5/p74NYM8BVrHB3dvlabO9legz aw1k8U+0i3qi+7HXrJnwGQXZ8IRvTfxK7hsBtziM7nNhTj6fNrp4OqUHUFzIQaFkfJ7rYl EF266TgueHqs4HJMUXorFT43lLndEB0iC6CQB2ytwXS3nEy9vsNnjZHOMEJrzprA01/GR+ PO/y1pMzG2a99UpIYknA4gHhkVkrAW/KsoeK71z4ReSloNHwrnE+dVLQPWPlgg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V1Gr61YBjz1CrR; Fri, 22 Mar 2024 09:15:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42M9F2Td061830; Fri, 22 Mar 2024 09:15:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42M9F2ad061827; Fri, 22 Mar 2024 09:15:02 GMT (envelope-from git) Date: Fri, 22 Mar 2024 09:15:02 GMT Message-Id: <202403220915.42M9F2ad061827@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: c4de745c330f - stable/13 - bectl: document the -r flag to bectl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c4de745c330f44c94c6b7e56336b266b1af69c17 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c4de745c330f44c94c6b7e56336b266b1af69c17 commit c4de745c330f44c94c6b7e56336b266b1af69c17 Author: Kyle Evans AuthorDate: 2023-04-20 04:55:07 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-03-22 08:07:34 +0000 bectl: document the -r flag to bectl Independent of all of the commands, bectl itself takes an `-r` flag that specifies the BE root to use. This was originally added to facilitate testing, but it was later discovered to be incredibly useful in other scenarios; e.g., trying to recover some boot environments in rescue media. The "BE root" described here is the parent dataset that holds boot environments, but I've no idea if that's an accepted definition for that dataset. Reviewed by: gallatin, imp, Pau Amma MFC after: 1 week Differential Review: https://reviews.freebsd.org/D39710 (cherry picked from commit 4163bae03051839c739c0133605b4ef494ee8f6a) --- sbin/bectl/bectl.8 | 39 +++++++++++++++++++++++++++++++++++---- sbin/bectl/bectl.c | 30 +++++++++++++++--------------- 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/sbin/bectl/bectl.8 b/sbin/bectl/bectl.8 index cb06ad9bcaed..2b2dd02bc8ef 100644 --- a/sbin/bectl/bectl.8 +++ b/sbin/bectl/bectl.8 @@ -15,7 +15,7 @@ .\" .\" @(#)be.1 .\" -.Dd March 31, 2022 +.Dd April 26, 2023 .Dt BECTL 8 .Os .Sh NAME @@ -23,54 +23,67 @@ .Nd Utility to manage boot environments on ZFS .Sh SYNOPSIS .Nm +.Op Fl r Ar beroot .Cm activate .Op Fl t | Fl T .Ar beName .Nm +.Op Fl r Ar beroot .Cm check .Nm +.Op Fl r Ar beroot .Cm create .Op Fl r .Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot .Ar newBeName .Nm +.Op Fl r Ar beroot .Cm create .Op Fl r .Ar beName@snapshot .Nm +.Op Fl r Ar beroot .Cm destroy .Op Fl \&Fo .Ar beName Ns Op Cm @ Ns Ar snapshot .Nm +.Op Fl r Ar beroot .Cm export .Ar sourceBe .Nm +.Op Fl r Ar beroot .Cm import .Ar targetBe .Nm +.Op Fl r Ar beroot .Cm jail .Op Fl bU .Oo Bro Fl o Ar key Ns Cm = Ns Ar value | Fl u Ar key Brc Oc Ns ... .Ar beName .Op Ar utility Op Ar argument ... .Nm +.Op Fl r Ar beroot .Cm list .Op Fl aDHs .Op Fl c Ar property .Op Fl C Ar property .Oo Bro Fl c Ar property | Fl C Ar property Brc Oc .Nm +.Op Fl r Ar beroot .Cm mount .Ar beName .Op Ar mountpoint .Nm +.Op Fl r Ar beroot .Cm rename .Ar origBeName .Ar newBeName .Nm +.Op Fl r Ar beroot .Brq Cm ujail | unjail .Brq Ar jailId | jailName | beName .Nm +.Op Fl r Ar beroot .Brq Cm umount | unmount .Op Fl f .Ar beName @@ -87,6 +100,23 @@ Boot environments allow the system to be upgraded, while preserving the old system environment in a separate ZFS dataset. .Pp +.Nm +itself accepts an +.Fl r +flag specified before the command to indicate the +.Ar beroot +that should be used as the boot environment root, or the dataset whose children +are all boot environments. +Normally this information is derived from the bootfs property of the pool that +is mounted at +.Pa / , +but it is useful when the system has not been booted into a ZFS root or a +different pool should be operated on. +For instance, booting into the recovery media and manually importing a pool from +one of the system's resident disks will require the +.Fl r +flag to work. +.Pp The following commands are supported by .Nm : .Bl -tag -width activate @@ -139,11 +169,13 @@ flag is specified, the new environment will be cloned from the given .Ar nonActiveBe or .Ar beName Ns Cm @ Ns Ar snapshot . -Otherwise, the new environment will be created from the currently booted environment. +Otherwise, the new environment will be created from the currently booted +environment. .Pp If .Nm -is creating from another boot environment, a snapshot of that boot environment will be created to clone from. +is creating from another boot environment, a snapshot of that boot environment +will be created to clone from. .It Xo .Cm create .Op Fl r @@ -274,7 +306,6 @@ is used on next boot once .Pq Em \&T ; or combination of .Pq Em \&NRT . -.Pp .Bl -tag -width indent .It Fl a Display all datasets. diff --git a/sbin/bectl/bectl.c b/sbin/bectl/bectl.c index a2b300a4bb44..f2ea8b241b14 100644 --- a/sbin/bectl/bectl.c +++ b/sbin/bectl/bectl.c @@ -67,23 +67,23 @@ usage(bool explicit) fprintf(fp, "%s", "Usage:\tbectl {-h | -? | subcommand [args...]}\n" #if SOON - "\tbectl add (path)*\n" + "\tbectl [-r beroot] add (path)*\n" #endif - "\tbectl activate [-t] beName\n" - "\tbectl activate [-T]\n" - "\tbectl check\n" - "\tbectl create [-r] [-e {nonActiveBe | beName@snapshot}] beName\n" - "\tbectl create [-r] beName@snapshot\n" - "\tbectl destroy [-Fo] {beName | beName@snapshot}\n" - "\tbectl export sourceBe\n" - "\tbectl import targetBe\n" - "\tbectl jail [-bU] [{-o key=value | -u key}]... beName\n" + "\tbectl [-r beroot] activate [-t] beName\n" + "\tbectl [-r beroot] activate [-T]\n" + "\tbectl [-r beroot] check\n" + "\tbectl [-r beroot] create [-r] [-e {nonActiveBe | beName@snapshot}] beName\n" + "\tbectl [-r beroot] create [-r] beName@snapshot\n" + "\tbectl [-r beroot] destroy [-Fo] {beName | beName@snapshot}\n" + "\tbectl [-r beroot] export sourceBe\n" + "\tbectl [-r beroot] import targetBe\n" + "\tbectl [-r beroot] jail [-bU] [{-o key=value | -u key}]... beName\n" "\t [utility [argument ...]]\n" - "\tbectl list [-aDHs] [{-c property | -C property}]\n" - "\tbectl mount beName [mountpoint]\n" - "\tbectl rename origBeName newBeName\n" - "\tbectl {ujail | unjail} {jailID | jailName | beName}\n" - "\tbectl {umount | unmount} [-f] beName\n"); + "\tbectl [-r beroot] list [-aDHs] [{-c property | -C property}]\n" + "\tbectl [-r beroot] mount beName [mountpoint]\n" + "\tbectl [-r beroot] rename origBeName newBeName\n" + "\tbectl [-r beroot] {ujail | unjail} {jailID | jailName | beName}\n" + "\tbectl [-r beroot] {umount | unmount} [-f] beName\n"); return (explicit ? 0 : EX_USAGE); }