From nobody Tue Sep 20 23:17:13 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 4MXHWQ3szxz4cb6l for ; Tue, 20 Sep 2022 23:17:22 +0000 (UTC) (envelope-from paul@gromit.dlib.vt.edu) Received: from gromit.dlib.vt.edu (gromit.dlib.vt.edu [128.173.126.123]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4MXHWP31pkz3crk; Tue, 20 Sep 2022 23:17:21 +0000 (UTC) (envelope-from paul@gromit.dlib.vt.edu) Received: from smtpclient.apple (unknown [IPv6:2001:470:e15b:23::5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gromit.dlib.vt.edu (Postfix) with ESMTPSA id 81F806B4A1; Tue, 20 Sep 2022 19:17:14 -0400 (EDT) Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: Good practices with bectl From: Paul Mather In-Reply-To: Date: Tue, 20 Sep 2022 19:17:13 -0400 Cc: Nuno Teixeira , FreeBSD CURRENT Content-Transfer-Encoding: quoted-printable Message-Id: <780F7E98-661B-49B5-BF0C-1E5A7EB7F1EE@gromit.dlib.vt.edu> References: To: Alan Somers X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Rspamd-Queue-Id: 4MXHWP31pkz3crk X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=vt.edu (policy=none); spf=none (mx1.freebsd.org: domain of paul@gromit.dlib.vt.edu has no SPF policy when checking 128.173.126.123) smtp.mailfrom=paul@gromit.dlib.vt.edu X-Spamd-Result: default: False [-2.49 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_HAM_SHORT(-0.99)[-0.989]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[vt.edu : No valid SPF, No valid DKIM,none]; MIME_TRACE(0.00)[0:+]; TO_DN_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; RCVD_COUNT_TWO(0.00)[2]; R_SPF_NA(0.00)[no SPF record]; R_DKIM_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FREEFALL_USER(0.00)[paul]; ASN(0.00)[asn:1312, ipnet:128.173.0.0/16, country:US]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sep 20, 2022, at 6:19 PM, Alan Somers wrote: > On Tue, Sep 20, 2022 at 4:14 PM Nuno Teixeira = wrote: >>=20 >> Hello to all, >>=20 >> I will use becl for the first time for current upgrades. >> Just to check that I'm thinking correctly: >>=20 >> Create a test environment for upgrade: >>> bectl create -r test (should I use '-r'?) >> Activate test: >>> bectl activate test >>> reboot >> ... >>> upgrade OS on test >>> reboot >> ... >> if a problem happens, reboot default from BE loader >> --- >> if everything fine destroy default and rename test to default >>> bectl destroy -o default >>> bectl rename test default >> repeat on next upgrade >>=20 >> Don't know if a faster way exists with chroot or bectl jail... >>=20 >> Any hints appreciated. >>=20 >> Thanks, >> -- >> Nuno Teixeira >> FreeBSD Committer (ports) >=20 > I don't think you need to use "-r". Also, you're forgetting one of > the best things about boot environments: you can upgrade them even > when not booted into them. That's faster than upgrading the running > BE. Here is the procedure I use: >=20 > RELEASE=3DWhatever > sudo bectl create ${RELEASE} > sudo bectl mount ${RELEASE} > BASEDIR=3D/tmp/be_mount.XXXX # Use mount point returned by bectl = mount > sudo freebsd-update -b ${BASEDIR} -d ${BASEDIR}/var/db/freebsd-update > upgrade -r ${RELEASE} > sudo freebsd-update -b ${BASEDIR} -d ${BASEDIR}/var/db/freebsd-update = install > # Ignore admonitions to reboot, since we're using a boot environment > sudo freebsd-update -b ${BASEDIR} -d ${BASEDIR}/var/db/freebsd-update = install > sudo bectl activate ${RELEASE} > sudo reboot >=20 > This general procedure works just as well if you're upgrading from = source, too. >=20 > sudo make DESTDIR=3D${BASEDIR} installworld > sudo mergemaster -m $PWD -D $BASEDIR -U There's even a handy tool in /usr/src/tools/build that can be used as a = wrapper to install a SRC build into a new boot environment. It's = /usr/src/tools/build/beinstall.sh (see man beinstall(8) for details). = It will create a new boot environment from a source build, run etcupdate = and so forth, and even mark the new boot environment as the one to be = active on reboot. All you need to do is reboot. I've been using it for = source upgrades for a while now without problems. The best thing, for = me, is it cuts out all that time doing "make installworld" and etcupdate = in single user mode, thus minimising downtime. Cheers, Paul.