Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Sep 2022 16:19:49 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        Nuno Teixeira <eduardo@freebsd.org>
Cc:        FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: Good practices with bectl
Message-ID:  <CAOtMX2gdoh2XxF0ofohyBA3DY-tgB5wAWb6%2BQmMb5tZRjieEvw@mail.gmail.com>
In-Reply-To: <CAFDf7UL42z-m9P-gp6eY-orwcPz_UdJpiAM3ab-z4XLbY0LOdg@mail.gmail.com>
References:  <CAFDf7UL42z-m9P-gp6eY-orwcPz_UdJpiAM3ab-z4XLbY0LOdg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 20, 2022 at 4:14 PM Nuno Teixeira <eduardo@freebsd.org> wrote:
>
> Hello to all,
>
> I will use becl for the first time for current upgrades.
> Just to check that I'm thinking correctly:
>
> 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
>
> Don't know if a faster way exists with chroot or bectl jail...
>
> Any hints appreciated.
>
> Thanks,
> --
> Nuno Teixeira
> FreeBSD Committer (ports)

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:

RELEASE=Whatever
sudo bectl create ${RELEASE}
sudo bectl mount ${RELEASE}
BASEDIR=/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

This general procedure works just as well if you're upgrading from source, too.

sudo make DESTDIR=${BASEDIR} installworld
sudo mergemaster -m $PWD -D $BASEDIR -U

-Alan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2gdoh2XxF0ofohyBA3DY-tgB5wAWb6%2BQmMb5tZRjieEvw>