Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Sep 2022 19:17:13 -0400
From:      Paul Mather <paul@gromit.dlib.vt.edu>
To:        Alan Somers <asomers@freebsd.org>
Cc:        Nuno Teixeira <eduardo@freebsd.org>, FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: Good practices with bectl
Message-ID:  <780F7E98-661B-49B5-BF0C-1E5A7EB7F1EE@gromit.dlib.vt.edu>
In-Reply-To: <CAOtMX2gdoh2XxF0ofohyBA3DY-tgB5wAWb6%2BQmMb5tZRjieEvw@mail.gmail.com>
References:  <CAFDf7UL42z-m9P-gp6eY-orwcPz_UdJpiAM3ab-z4XLbY0LOdg@mail.gmail.com> <CAOtMX2gdoh2XxF0ofohyBA3DY-tgB5wAWb6%2BQmMb5tZRjieEvw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sep 20, 2022, at 6:19 PM, Alan Somers <asomers@freebsd.org> wrote:

> On Tue, Sep 20, 2022 at 4:14 PM Nuno Teixeira <eduardo@freebsd.org> =
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?780F7E98-661B-49B5-BF0C-1E5A7EB7F1EE>