aboutsummaryrefslogtreecommitdiff
path: root/sbin/bectl
Commit message (Collapse)AuthorAgeFilesLines
* tests: skip gracefully when the tested binary's own package isn't installedWarner Losh2026-09-111-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | pkgbase splits programs and their tests into separate packages (e.g. unifdef/yacc/indent/file2c -> toolchain, jail -> jail, etc), while their tests always land in the generic tests package. Installing just the tests package therefore leaves these suites unable to find the binary they exercise, and they fail confusingly instead of skipping. Rather than force all packages to be installed for the tests package, make the tests cope with the missing packages. Add require.progs (or, for TAP/PLAIN-style suites with no atf_set hook: TEST_METADATA required_programs) for the binary under test in: bectl, certctl, ctfconvert, dhclient, file2c, indent, ipfw, jail, lastcomm, mixer, newsyslog, nvmecontrol, pfctl, praudit, sa, syslogd, tunefs, unifdef, yacc, ztest. I skipped adding data for all the binaries in the base runtime package for simplicity. Assisted-by: Claude Code (Sonnet 5) Sponsored by: Netflix Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D58262
* manpages: Fix author e-mail address formattingRobert Clausecker2026-09-041-3/+3
| | | | | | | | | | | | - consistently use Mt request within Aq. This makes author e-mail addresses clickable in many frontends. - @freebsd.org -> @FreeBSD.org - (user@host.tld) -> Aq Mt user@host.tld Event: Berlin Hackathon 202609 MFC after: 3 days Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D59410
* bectl(8): Fix a typo in the manual pageGordon Bergling2026-06-271-1/+1
| | | | | | - s/envionments/environments/ MFC after: 3 days
* bectl: Add -E flag to create an empty boot environmentPat Maddox2026-02-053-3/+35
| | | | | | | Signed-off-by: Pat Maddox <pat@patmaddox.com> Reviewed by: kevans MFC after: 1 week Closes: https://github.com/freebsd/freebsd-src/pull/1975
* bectl: log modifying functions to zpool historyRob Norris2025-12-171-16/+57
| | | | | | | | | | | | | | Modeled directly after the method used by the zfs/zpool commands: flag commands with a "please log me" flag, and when there, reconstruct the command line. On success, call the library function to add it to the log. (Majority of the change by Rob; minor edits by kevans@) Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Co-authored-by: Kyle Evans <kevans@FreeBSD.org> Sponsored by: Modirum MDPay Sponsored by: Klara, Inc.
* Use ZFSTOP more broadlyJohn Baldwin2025-11-241-5/+5
| | | | | | Reviewed by: brooks Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D53791
* zfs: fix build after openzfs/zfs@e63d026b9Martin Matuska2025-11-171-1/+2
| | | | | Fix Makefiles Update zfs_config.h and zfs_gitrev.h
* bectl.8: Describe betterAlexander Ziaee2025-07-101-56/+65
| | | | | | | | | | | | + Concise document description for consistency and apropos results + Improve introductory paragraph, mentioning boot loader support + Explain -r in "Supported Subcommands and Flags" + Clarify the purpose of the check subcommand + Add two basic examples, creating and mounting + Fold some long lines, correct a stray capitalization. MFC after: 3 days Co-authored-by: kevans
* bectl: Print activate message in a single lineRenato Botelho2025-07-011-3/+5
| | | | | | | | | | | When -t parameter is used, bectl prints a complementary message "for next boot" on a second line. Change it to print entire message on a single line. Reviewed by: kevans MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D49439
* bectl: Use SPDX only licenseAlexander Ziaee2025-06-136-125/+10
| | | | | | | | | | | bectl.8 had a truncated license without the required disclaimer. Correct it consistently by converting all bectl licenses to SPDX form. Approved by: kevans Approved by: Kyle Kneitinger <kyle@kneit.in> Approved by: Wes Maag <wes@jwmaag.org> Approved by: mhorne (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D49066
* Update Makefile.depend filesSimon J. Gerraty2024-10-142-12/+11
| | | | | | | After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* Prepare some build fixes in advance of more _FORTIFY_SOURCEKyle Evans2024-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | ZFS' libspl needs to be made aware that we have strlcat(3) and strlcpy(3) to avoid some more complicated declaration duplication, so go ahead and define these HAVE_ macros now. libprocstat has to define `_KERNEL` and include kernel headers in order to get what it wants, but this results in sys/cdefs.h being included too late and we pick up the build breaking version of the __RENAME definition. Just explicitly include sys/cdefs.h earlier rather than disabling _FORTIFY_SOURCE. The zfs/ subdir only builds an object that holds some structures and sizes, so just disable _FORTIFY_SOURCE there entirely rather than trying to move #define _KERNEL into the file.. While we're here, make sure that we disable _FORTIFY_SOURCE in the bootloader because we don't have the symbol renaming support today to do it as cleanly as we'd like. ssp/ssp.h needs to be pulled into the libsa environment so that other bits can understand that ssp is disabled in the consistent __SSP_FORTIFY_LEVEL way that we try to do. Reviewed by: allanjude (previous version), markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45676
* bectl(8): authors: Kyle Evans: fine-tuneGraham Perrin2024-04-101-3/+3
| | | | | | | Discussed with Kyle in Discord. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/857
* bectl(8): authors: be more explicitGraham Perrin2024-04-101-2/+4
| | | | | | | | Cross-reference (name) the manual page that was written by Bryan Drewery. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/857
* bectl(8): HISTORY, AUTHORS: further attentionGraham Perrin2024-04-101-5/+2
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/857
* bectl(8): corrections, changesGraham Perrin2024-04-101-16/+24
| | | | | | | | | | | | beadm(1) no longer exists. Cross-reference beadm(8). Aim to improve the HISTORY and AUTHORS sections, including consistency with the manual pages for beadm(8) and libbe(3). Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/857
* bectl: Simplify command aliases.Dag-Erling Smørgrav2024-03-181-7/+2
| | | | | | MFC after: 3 days Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44406
* bectl: Use geopt() and drop mention of -?.Dag-Erling Smørgrav2024-03-182-27/+27
| | | | | | | MFC after: 3 days PR: 272260 Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44405
* libbe: handle destroying/renaming temporary/bootonce boot environmentsR. Christian McDonald2024-01-291-12/+90
| | | | | | | | | | | | | When a temporary/bootonce boot environment is renamed, we need to also update the bootenv nvlist on-disk to reflect the new name. Additionally, when a temporary/bootonce boot environment is destroyed, we also need to clear out the on-disk state. Reviewed by: kevans Approved by: kp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D43591
* sbin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-273-3/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sbin: Remove ancient SCCS tags.Warner Losh2023-11-271-2/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* bectl: fix some `mandoc -Tlint` complaintsKyle Evans2023-10-051-8/+7
| | | | | | | | | | The EXAMPLES mis-comments caused an obnoxious amount of blank space above SEE ALSO when rendered by mandoc to a terminal. The missing termination of .Xo meant the description of -h ran together with the subcommand synopsis. The other changes were generally ignored tags due to context that simply don't need to be there. Provoked by: grahamperrin
* bectl: make mount subcommand less verboseRobert Wing2023-08-231-1/+1
| | | | | | | | | | | | | | | | | | The mount subcommand currently produces output such as: # bectl mount <bootenv> Successfully mounted <bootenv> at <mountpoint> This commit changes it to only print the mountpoint: # bectl mount <bootenv> <mountpoint> This makes it easier to script the mount subcommand. If an error occurs while mounting, an error message is printed to stderr and bectl will exit with a non-zero value. PR: 273180 Reviewed by: kevans, asomers Differential Revision: https://reviews.freebsd.org/D41562
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-164-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-163-6/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* libbe: recursively promote deep BE datasetsR. Christian McDonald2023-07-171-7/+5
| | | | | | | | | | | | | beadm will recursively promote deep BE datasets. In order to match the beadm behavior, we need to recursively iterate over child filesystems and promote them along the way. This patch further refines the work from D40903, completing the fix for promotion. Reviewed by: kevans, rew Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D40972
* libbe: promote activated BEs all the wayKyle Evans2023-07-111-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | This matches the beadm behavior; generally, we need to keep promoting until the BE is no longer a clone from a snapshot. This fixes scenarios where the dataset associated with a BE's origin is itself a clone, activating the BE previously would promote it to a clone of the origin's origin. We could keep using be_get_dataset_props here, except for two annoyances: 1.) I couldn't find a clean way to just clear an nvlist rather than having to re-alloc it, and I didn't want to just remove the one prop we're inspecting out of it. 2.) That's a lot of overhead when all we want to do is fetch the origin anyways. Note that this is not a complete fix, but it does fix the majority of cases; deep BE subordinates are still notably broken, pending a patch from Christian. Reported by: R. Christian McDonald <rcm@rcm.sh> Reviewed by: rew Differential Revision: https://reviews.freebsd.org/D40903
* bectl(8): clarifications, expansionGraham Perrin2023-06-281-25/+43
| | | | | Reviewed-by: imp Pull-request: https://github.com/freebsd/freebsd-src/pull/728
* bectl.8: update /homeMike Karels2023-05-251-5/+6
| | | | | | | | | | | The default location for home directories is moving from /usr/home to /home, including the default zfs datasets. Update accordingly. Add zroot/usr/src as replacement example of nested datasets. While here, mark zroot/var as "canmount off" as per current setup. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40206
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-126-6/+6
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* bectl: document the -r flag to bectlKyle Evans2023-04-262-19/+50
| | | | | | | | | | | | | | | | 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
* zfs: merge openzfs/zfs@431083f75Martin Matuska2023-04-033-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notable upstream pull request merges: #12194 Fix short-lived txg caused by autotrim #13368 ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced() #13392 Implementation of block cloning for ZFS #13741 SHA2 reworking and API for iterating over multiple implementations #14282 Sync thread should avoid holding the spa config write lock when possible #14283 txg_sync should handle write errors in ZIL #14359 More adaptive ARC eviction #14469 Fix NULL pointer dereference in zio_ready() #14479 zfs redact fails when dnodesize=auto #14496 improve error message of zfs redact #14500 Skip memory allocation when compressing holes #14501 FreeBSD: don't verify recycled vnode for zfs control directory #14502 partially revert PR 14304 (eee9362a7) #14509 Fix per-jail zfs.mount_snapshot setting #14514 Fix data race between zil_commit() and zil_suspend() #14516 System-wide speculative prefetch limit #14517 Use rw_tryupgrade() in dmu_bonus_hold_by_dnode() #14519 Do not hold spa_config in ZIL while blocked on IO #14523 Move dmu_buf_rele() after dsl_dataset_sync_done() #14524 Ignore too large stack in case of dsl_deadlist_merge #14526 Use .section .rodata instead of .rodata on FreeBSD #14528 ICP: AES-GCM: Refactor gcm_clear_ctx() #14529 ICP: AES-GCM: Unify gcm_init_ctx() and gmac_init_ctx() #14532 Handle unexpected errors in zil_lwb_commit() without ASSERT() #14544 icp: Prevent compilers from optimizing away memset() in gcm_clear_ctx() #14546 Revert zfeature_active() to static #14556 Remove bad kmem_free() oversight from previous zfsdev_state_list patch #14563 Optimize the is_l2cacheable functions #14565 FreeBSD: zfs_znode_alloc: lock the vnode earlier #14566 FreeBSD: fix false assert in cache_vop_rmdir when replaying ZIL #14567 spl: Add cmn_err_once() to log a message only on the first call #14568 Fix incremental receive silently failing for recursive sends #14569 Restore ASMABI and other Unify work #14576 Fix detection of IBM Power8 machines (ISA 2.07) #14577 Better handling for future crypto parameters #14600 zcommon: Refactor FPU state handling in fletcher4 #14603 Fix prefetching of indirect blocks while destroying #14633 Fixes in persistent error log #14639 FreeBSD: Remove extra arc_reduce_target_size() call #14641 Additional limits on hole reporting #14649 Drop lying to the compiler in the fletcher4 code #14652 panic loop when removing slog device #14653 Update vdev state for spare vdev #14655 Fix cloning into already dirty dbufs #14678 Revert "Do not hold spa_config in ZIL while blocked on IO" Obtained from: OpenZFS OpenZFS commit: 431083f75bdd3efaee992bdd672625ec7240d252
* bectl: Improve error message when ZFS root is not found.Andrew Gallatin2023-03-311-1/+5
| | | | | | | | | | | | | | | | When recovering a system that is unbootable due to some problem with the active BE, it is likely you'll be booted from a rescue image running UFS. In this case, bectl needs help finding the zpool root that you want to operate on. In this case, improve the error message to suggest specifying a root, rather than just emitting a generic error message that might imply, to the naive user, that there is a ZFS compatibility issue between the rescue image and the on-disk ZFS pool. Reviewed by: imp, kevans Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D39346
* pkgbase: Put zfs utilities and lib in their own packageEmmanuel Vadot2022-10-261-1/+1
| | | | | | | | | It is useful to have zfs utilities and lib in a separate package as it allow users to create image that can support ZFS (i.e. not with WITHOUT_ZFS in src.conf set) without bloating the default image with all zfs tools (for example for jails). Differential Revision: https://reviews.freebsd.org/D36225
* bectl: push space-in-name check down into libbeKyle Evans2022-04-031-7/+2
| | | | | | | | | | | | | This check was previously in `create` only, not applying to renames. It should really be applied at the libbe level, so that we can avoid writing about this restriction over and over again. While we're here: `bectl rename` always succeeds, even when it doesn't. Start returning the error. Reported By: Christian McDonald <cmcdonald netgate com> Reviewed by: rew, jwmaag_gmail.com (earlier version) Differential Revision: https://reviews.freebsd.org/D34605
* bectl: add some discussion about boot environment layoutsKyle Evans2022-03-311-1/+91
| | | | | | | | | | | | Discuss the standard type of layout, as well as the "deep" BE layout, and some of the properties of both. Point the various -r flags at this new section, to help users understand which they're working with and what the -r flag is actually doing. Note that we may just deprecate the -r flag in future versions, but the flag will be recognized as a NOP at that point. Reviewed by: pauamma_gundo.com, rew Differential Revision: https://reviews.freebsd.org/D34538
* bectl(8): don't allow creation of boot environments with spacesRobert Wing2021-06-032-1/+12
| | | | | | | | | | | Boot environment datasets that contain spaces are not bootable. When a user attempts to create a boot environment with a space, abort the creation and print an error message. PR: 254441 Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D30194
* sbin/bectl: Skip tests if sparse files are not supportedAlex Richardson2021-02-031-0/+7
| | | | | | | | | | | | | The tests create a 1GB test file and this causes the tests to fail in the CheriBSD CI setup where we run tests with a tmpfs mount on /tmp. Tmpfs does not support sparse files and it appears that tmpfs default to creating a 1GB mount, so there is not enough space to run these tests. Instead of checking for at least 1GB of free space, this commit skips the tests on file systems that do not support sparse files. Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D28463
* bectl: remove spurious aok variableKyle Evans2021-01-161-2/+0
| | | | | | | | This rode in with the OpenZFS import. It may have been necessary at some point, but it is no longer and it breaks the WITHOUT_DYNAMICROOT build as it collides with the definition in libspl. Reported-by: Michael Dexter
* bectl: tests: use -R <mount> instead of specifying altrootKyle Evans2021-01-161-1/+1
| | | | | | | | -R is currently shorthand for cachefile=none, altroot=<mount>. This is functionally the same, but perhaps more resilient to future changes that could be necessary that may be added when -R is specified. MFC after: 1 week
* bectl(8): sync man page and help textRobert Wing2021-01-062-11/+9
| | | | | | | | | | | | | | Sync man page with behavior of bectl(8). Sync help text with man page. PR: 246697 Reported by: olgeni Submitted by: olgeni (with changes) Reviewed by: kevans, olgeni Approved by: kevans (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27482
* pkgbase: Move bectl to the runtime packageEmmanuel Vadot2021-01-041-0/+1
| | | | | | | runtime contain what is needed to boot in single user and repair a system, bectl could be handy to have in this situation. Differential Revision: https://reviews.freebsd.org/D27708
* bectl: simplify the tail end of the jail cmdKyle Evans2020-12-061-4/+2
| | | | | | | | | | | | | | This has already confused me once (and I'm pretty sure I wrote it), so let's clarify: unjailing after the command has completed will only happen if we're interactive and -U has not been specified. This just folds two conditionals together to make it obvious how -b/-U interact with each other. MFC after: 3 days Notes: svn path=/head/; revision=368388
* Fix r368197: suppress error printing for the "check" command.Gleb Smirnoff2020-12-021-2/+3
| | | | | | | Reviewed by: kevans Notes: svn path=/head/; revision=368287
* Print at least something when failing.Gleb Smirnoff2020-11-301-1/+4
| | | | Notes: svn path=/head/; revision=368197
* bectl(8): missing flag in the help messageLuca Pizzamiglio2020-10-301-1/+1
| | | | | | | | | | | | Flag -o for destroy subcommand is missing in the help message, but present in the man page. Fix it. PR: 249325 Approved by: kevans Differential Revision: https://reviews.freebsd.org/D26429 Notes: svn path=/head/; revision=367183
* loader: zfs should support bootonce an nextbootToomas Soome2020-09-214-9/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bootonce feature is temporary, one time boot, activated by "bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag. By default, the bootonce setting is reset on attempt to boot and the next boot will use previously active BE. By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will be set permanently active. bootonce dataset name is recorded in boot pool labels, bootenv area. in case of nextboot, the nextboot_enable boolean variable is recorded in freebsd:nvstore nvlist, also stored in boot pool label bootenv area. On boot, the loader will process /boot/nextboot.conf if nextboot_enable is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf processing on next boot. bootonce and nextboot features are usable in both UEFI and BIOS boot. To use bootonce/nextboot features, the boot loader needs to be updated on disk; if loader.efi is stored on ESP, then ESP needs to be updated and for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated (gpart or other tools). At this time, only lua loader is updated. Sponsored by: Netflix, Klara Inc. Differential Revision: https://reviews.freebsd.org/D25512 Notes: svn path=/head/; revision=365938