Solved Which commands should I use to update FreeBSD?

So should I go with this?

sudo freebsd-update fetch && freebsd-update fetch install && pkg upgrade
 
That command line would only run that first freebsd-update fetch through sudo(8). The rest of the command line would be executed on your user account, which then fails for obvious reasons.

How about doing this: sudo freebsd-update fetch install? Once that's finished (and perhaps you needed to reboot), upgrade your packages with sudo pkg upgrade.

Sign up for the freebsd-announce mailing list. Keep an eye on that. If there are security or errata patches they will get announced there. Until there is a patch available it's pointless to run freebsd-update(8).
 
How about doing this: sudo freebsd-update fetch install? Once that's finished (and perhaps you needed to reboot), upgrade your packages with sudo pkg upgrade.
do pkg first and then freebsd-update, reboot after the latter if necessary or checkrestart
 
pkg upgrade -n also tells you if anything is available to upgrade and will also do the hidden pkg update for you.
By default pkg upgrade will also ask if you want to continue: one can always say "no", again not having to do the pkg update.
 
The pkg part of my routine is something like this:

Code:
root@mowa219-gjp4-8570p-freebsd:~ # pkg lock -l
Currently locked packages:
drm-devel-kmod-5.7.19.g20220202
root@mowa219-gjp4-8570p-freebsd:~ # pkg unlock drm-devel-kmod
drm-devel-kmod-5.7.19.g20220202: unlock this package? [y/N]: y
Unlocking drm-devel-kmod-5.7.19.g20220202
root@mowa219-gjp4-8570p-freebsd:~ # bectl list -c creation
BE                    Active Mountpoint Space Created
n250511-5f73b3338ee-d -      -          4.94G 2021-11-13 15:43
n252381-75d20a5e386-b -      -          6.80G 2022-01-12 23:23
n252450-5efa7281a79-a -      -          6.49G 2022-01-14 19:27
n252483-c8f8299a230-b -      -          4.84G 2022-01-17 14:24
n252505-cc68614da82-a -      -          4.90G 2022-01-18 14:26
n252531-0ce7909cd0b-h -      -          5.71G 2022-02-06 12:24
n252997-b6724f7004c-c -      -          1.33G 2022-02-11 23:07
n253116-39a36707bd3-b -      -          225M  2022-02-12 18:33
n253116-39a36707bd3-c NR     /          129G  2022-02-15 17:27
root@mowa219-gjp4-8570p-freebsd:~ # bectl create n253116-39a36707bd3-d
root@mowa219-gjp4-8570p-freebsd:~ # bectl mount n253116-39a36707bd3-d /tmp/up
Successfully mounted n253116-39a36707bd3-d at /tmp/up
root@mowa219-gjp4-8570p-freebsd:~ # chroot /tmp/up
root@mowa219-gjp4-8570p-freebsd:/ # sysrc sddm_enable="NO"
sddm_enable: YES -> NO
root@mowa219-gjp4-8570p-freebsd:/ # pkg upgrade --fetch-only -r FreeBSD -y
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (1 candidates): 100%
Processing candidates (1 candidates): 100%
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
        drm-devel-kmod-5.7.19.g20220202 [FreeBSD] (options changed)

Number of packages to be reinstalled: 1

2 MiB to be downloaded.
[1/1] Fetching drm-devel-kmod-5.7.19.g20220202.pkg: 100%    2 MiB   2.5MB/s    00:01  
Checking integrity... done (0 conflicting)
root@mowa219-gjp4-8570p-freebsd:/ # exit
exit
root@mowa219-gjp4-8570p-freebsd:~ # bectl umount n253116-39a36707bd3-d
root@mowa219-gjp4-8570p-freebsd:~ # bectl activate n253116-39a36707bd3-d
Successfully activated boot environment n253116-39a36707bd3-d
root@mowa219-gjp4-8570p-freebsd:~ # exit
logout
root@mowa219-gjp4-8570p-freebsd:~ # exit

– or this:

Code:
root@mowa219-gjp4-8570p-freebsd:~ # pkg version -vRL=
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
7-zip-21.07                        <   needs updating (remote has 21.07_1)
FreeBSD-clibs-14.snap20210513182414 ?   orphaned: base
anydesk-6.0.1_1                    ?   orphaned: deskutils/anydesk
apache-openoffice-devel-4.2.1633255994,4 ?   orphaned: editors/openoffice-devel
cdrtools-2021.09.18                <   needs updating (remote has 2021.09.18_1)
citrix_ica-13.10.0                 ?   orphaned: net/citrix_ica
festlex-oald-1.4.1_1               ?   orphaned: audio/festlex-oald
gnome3-3.36_4                      ?   orphaned: x11/gnome3
gnuit-4.9.5_5                      ?   orphaned: misc/gnuit
kdepim-runtime-21.12.2             <   needs updating (remote has 21.12.2_1)
libreoffice-7.2.5.2                ?   orphaned: editors/libreoffice
linux-wps-office-11.1.0.10161      ?   orphaned: editors/linux-wps-office
linux_libusb-13.0r358841_4         ?   orphaned: devel/linux_libusb
openzfs-2021121500_1               <   needs updating (remote has 2022021400_1)
openzfs-kmod-2021121500            <   needs updating (remote has 2022021400)
pango-1.50.3                       <   needs updating (remote has 1.50.4)
py38-libzfs-1.1.2021100100         <   needs updating (remote has 1.1.2022021400)
schilybase-2021.09.18              <   needs updating (remote has 2021.09.18_1)
thunderbird-91.6.0                 <   needs updating (remote has 91.6.1)
toybox-0.8.5                       <   needs updating (remote has 0.8.6)
xfce4-notifyd-0.6.2_2              <   needs updating (remote has 0.6.3)
root@mowa219-gjp4-8570p-freebsd:~ # pkg clean -a
Nothing to do.
root@mowa219-gjp4-8570p-freebsd:~ # bectl list
BE                             Active Mountpoint Space Created
14.0-CURRENT_2022-02-19_141545 -      -          4.14M 2022-02-19 14:15
14.0-CURRENT_2022-02-20_013343 -      -          2.70M 2022-02-20 01:33
n250511-5f73b3338ee-d          -      -          4.94G 2021-11-13 15:43
n252381-75d20a5e386-b          -      -          6.80G 2022-01-12 23:23
n252450-5efa7281a79-a          -      -          6.49G 2022-01-14 19:27
n252483-c8f8299a230-b          -      -          4.84G 2022-01-17 14:24
n252505-cc68614da82-a          -      -          4.90G 2022-01-18 14:26
n252531-0ce7909cd0b-h          -      -          5.71G 2022-02-06 12:24
n252997-b6724f7004c-c          -      -          1.33G 2022-02-11 23:07
n253116-39a36707bd3-b          -      -          314M  2022-02-12 18:33
n253116-39a36707bd3-c          -      -          14.9M 2022-02-15 17:27
n253116-39a36707bd3-d          NR     /          130G  2022-02-18 21:14
root@mowa219-gjp4-8570p-freebsd:~ # bectl create n253116-39a36707bd3-e
root@mowa219-gjp4-8570p-freebsd:~ # bectl mount n253116-39a36707bd3-e /tmp/up
Successfully mounted n253116-39a36707bd3-e at /tmp/up
root@mowa219-gjp4-8570p-freebsd:~ # chroot /tmp/up
root@mowa219-gjp4-8570p-freebsd:/ # sysrc sddm_enable="NO"
sddm_enable: YES -> NO
root@mowa219-gjp4-8570p-freebsd:/ # pkg upgrade --fetch-only -r FreeBSD --quiet --yes
root@mowa219-gjp4-8570p-freebsd:/ # exit
exit
root@mowa219-gjp4-8570p-freebsd:~ # bectl umount n253116-39a36707bd3-e
root@mowa219-gjp4-8570p-freebsd:~ # bectl activate n253116-39a36707bd3-e
Successfully activated boot environment n253116-39a36707bd3-e
root@mowa219-gjp4-8570p-freebsd:~ # exit
logout
% exit

– then restart (boot the new environment), pkg upgrade, pkg autoremove, sysrc sddm_enable="YES", restart.
 
Last edited:
The pkg part of my routine, with a display manager in the mix, is something like this:

Code:
root@mowa219-gjp4-8570p-freebsd:~ # pkg lock -l
Currently locked packages:
drm-devel-kmod-5.7.19.g20220202
root@mowa219-gjp4-8570p-freebsd:~ # pkg unlock drm-devel-kmod
drm-devel-kmod-5.7.19.g20220202: unlock this package? [y/N]: y
Unlocking drm-devel-kmod-5.7.19.g20220202
root@mowa219-gjp4-8570p-freebsd:~ # bectl list -c creation
BE                    Active Mountpoint Space Created
n250511-5f73b3338ee-d -      -          4.94G 2021-11-13 15:43
n252381-75d20a5e386-b -      -          6.80G 2022-01-12 23:23
n252450-5efa7281a79-a -      -          6.49G 2022-01-14 19:27
n252483-c8f8299a230-b -      -          4.84G 2022-01-17 14:24
n252505-cc68614da82-a -      -          4.90G 2022-01-18 14:26
n252531-0ce7909cd0b-h -      -          5.71G 2022-02-06 12:24
n252997-b6724f7004c-c -      -          1.33G 2022-02-11 23:07
n253116-39a36707bd3-b -      -          225M  2022-02-12 18:33
n253116-39a36707bd3-c NR     /          129G  2022-02-15 17:27
root@mowa219-gjp4-8570p-freebsd:~ # bectl create n253116-39a36707bd3-d
root@mowa219-gjp4-8570p-freebsd:~ # bectl mount n253116-39a36707bd3-d /tmp/up
Successfully mounted n253116-39a36707bd3-d at /tmp/up
root@mowa219-gjp4-8570p-freebsd:~ # chroot /tmp/up
root@mowa219-gjp4-8570p-freebsd:/ # sysrc sddm_enable="NO"
sddm_enable: YES -> NO
root@mowa219-gjp4-8570p-freebsd:/ # pkg upgrade --fetch-only -r FreeBSD -y
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (1 candidates): 100%
Processing candidates (1 candidates): 100%
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
        drm-devel-kmod-5.7.19.g20220202 [FreeBSD] (options changed)

Number of packages to be reinstalled: 1

2 MiB to be downloaded.
[1/1] Fetching drm-devel-kmod-5.7.19.g20220202.pkg: 100%    2 MiB   2.5MB/s    00:01
Checking integrity... done (0 conflicting)
root@mowa219-gjp4-8570p-freebsd:/ # exit
exit
root@mowa219-gjp4-8570p-freebsd:~ # bectl umount n253116-39a36707bd3-d
root@mowa219-gjp4-8570p-freebsd:~ # bectl activate n253116-39a36707bd3-d
Successfully activated boot environment n253116-39a36707bd3-d
root@mowa219-gjp4-8570p-freebsd:~ # exit
logout
root@mowa219-gjp4-8570p-freebsd:~ # exit

– then restart, pkg upgrade, sysrc sddm_enable="YES", restart.
Hi grahamperrin, I think you want to lock drm-devel-kmod after upgrading it, before bectl unmount

I'm not a proficient ZFS user, if you don't like the new boot environment what does the tooling present for "revert" or whatever?
 
If you stop in the loader, you can select the previous one, restart then bectl destroy the one you don't like.
If the new boots but you decide you don't want it, you can bectl activate the previous one, reboot, wait until it reboots completely then bectl destroy the one you don't want.
bectl destroy you may want to add the "-o" option to also destroy the origin snapshot.
 
may be the way it is but I'm unix old school, traditional mode is what I value:cool:
 
Back
Top