bectl freebsd-update -r 15.0

Hey ,

it is the first time that I am trying to update freebsd with the help of bectl.

I red the following tutorial. https://klarasystems.com/articles/managing-boot-environments/
My workflow looks like this .

Code:
rm -Rf /var/db/freebsd-update

bectl create freebsd_15
root@melmac:~ # bectl mount freebsd_15
/tmp/be_mount.gsGs


root@melmac:~ # mkdir -p /tmp/be_mount.gsGs/var/db/freebsd-update
root@melmac:~ # freebsd-update -b /tmp/be_mount.gsGs  -d /tmp/be_mount.gsGs/var/db/freebsd-update -r 15.0-RELEASE upgrade


freebsd-update -b /tmp/be_mount.gsGs  -d /tmp/be_mount.gsGs/var/db/freebsd-update -r 15.0-RELEASE install

src component not installed, skipped
Installing updates...
Kernel updates have been installed.  Please reboot and run
'freebsd-update [options] install' again to finish installing updates.

root@melmac:~ # bectl activate -t freebsd_15
Successfully activated boot environment freebsd_15
for next boot
root@melmac:~ # shutdown -r now

root@melmac:~ # freebsd-update install
src component not installed, skipped
No updates are available to install.
Run 'freebsd-update [options] fetch' first.
root@melmac:~ # freebsd-update install
root@melmac:~ # uname -u
uname: illegal option -- u
usage: uname [-abiKmnoprsUv]
root@melmac:~ # uname -K
1500068
root@melmac:~ # uname -U
1403000

As you can see the freebsd-update command does not recognise that my userland is not upgraded. Let me know what I am doing wrong ! Thank you
 
As you can see the freebsd-update command does not recognise that my userland is not upgraded.
The second freebsd-update install didn't install anything, because it couldn't find the files. So it never updated the userland.
Code:
root@melmac:~ # freebsd-update install
src component not installed, skipped
No updates are available to install.                                         <------- did nothing.
Run 'freebsd-update [options] fetch' first.
 
I honest don't bother creating a BE myself. With every freebsd-update install a 'snapshot' of the BE is automatically created.

The command does nothing , but my seqence should be fine right ?
It looks fine. As far as I can tell you followed the article correctly. I need to test it out myself, because in theory it should work. So I'm wondering why it couldn't find the update files on that second freebsd-update install after the first reboot. So I'm definitely interested to know what you messed up, in order to understand why it broke.
 
Is it because no fetch was done? See last line in the block below.

Code:
root@melmac:~ # freebsd-update install
src component not installed, skipped
No updates are available to install.
Run 'freebsd-update [options] fetch' first.

If you look at the klara systems page, it says:

"Run the freebsd-update utility and specify the BE mount point as the basedir (-b) and the BE’s database as the workdir (-d). First, fetch the updates:"

Code:
freebsd-update -b /tmp/be_mount.7pMM -d /tmp/be_mount.7pMM/var/db/freebsd-update fetch
<output snipped>
 
Here's how I've been doing it for a while. Going across releases I prefer manually creating the new BE and doing "everything" to it. Minor updates (14.2 to 14.3, patches) I let freebsd-update create them.
I like this method because it means I should have a coherent BE representing the new version, complete with packages and you only need to reboot once.
This is probably similar to what the klarasystems article says
# Create new BE and mount it
bectl create 15.0-RELEASE-p0
bectl mount 15.0-RELEASE-p0 /mnt

# do update into the new BE
freebsd-update upgrade -b /mnt -d /mnt/var/db/freebsd-update -r 15.0-RELEASE
freebsd-update -b /mnt -d /mnt/var/db/freebsd-update install
freebsd-update -b /mnt -d /mnt/var/db/freebsd-update install
freebsd-update -b /mnt -d /mnt/var/db/freebsd-update install # yes run three times

# now take care of packages
# need to mount the devfs in the chroot
mount -t devfs devfs /mnt/dev # pkg needs devfs mounted
# force update all the packages in the chroot
pkg-static -c /mnt upgrade -f

# You can verify your packages are in the new BE
pkg-static -c /mnt info

# unmount the devfs in the chroot
umount /mnt/dev

# at this point you may want/need to update boot code.

# while the BE is mounted, you may want to double check things in loader.conf and rc.conf if you added lines for kmods.

# unmount the BE
bectl umount 15.0-RELEASE-p0

#activate and reboot. You can play with different boot flags so if there is a problem in the new BE you can reboot into the working one
bectl activate 15.0-RELEASE-p0
shutdown -r now
 
I tried this command but it is not available. There is no fetch in the update process. I think fetch is done automatically when you do the upgrade.
Perhaps, you've seen this:
Code:
[1-0] # freebsd-update fetch
freebsd-update is incompatible with the use of packaged base.  Please see
https://wiki.freebsd.org/PkgBase for more information.
[2->1<] #
This signals that you are using a packaged base on 15.0-RELEASE. In that case updates of the base OS by means of freebsd-update(8) do not apply. Instead you must use pkg upgrade(8), just as you would for packages from the ports tree collection.

Note that upgrades of base packages do not create a Boot Environment (BE), you must do that manually.

The Klara Systems article you mentioned was written at a time when base packages did not yet exist.
 
Note that upgrades of base packages do not create a Boot Environment (BE), you must do that manually.
pkg is still experimental and for this update I will stick to freebsd-update . Not sure when I want to go the pkg route, but thanks.

mer thanks , I will give it a try !
 
mer thank you very much !

Got time to move forward.

It was the first time that I need to deal with a manual boot code update and I did it wrong and need to recover it from a live cd ^^

What was wrong ? I did not use gptzfsboot I used gptboot . Lessons learned

# Boot into Live CD
# attach the live disk to your vm
# choose 1 and than live system


#run zpool import to get name of zpool (probably zroot)
zpool import
#create a mountpoint for zpool:
mkdir -p /tmp/zroot
#import zpool:
zpool import -fR /tmp/zroot zroot
#create a mountpoint for zfs /:
mkdir /tmp/root
#mount /: 15.0-RELEASE is my bectl environment
mount -t zfs zroot/ROOT/15.0-RELEASE /tmp/root

# check your disk names ! gpart show
# Install ZFS-aware bootloader on first disk
gpart bootcode -b /tmp/root/boot/pmbr -p /tmp/root/boot/gptzfsboot -i 1 vtbd0

# Install ZFS-aware bootloader on second disk
gpart bootcode -b /tmp/root/boot/pmbr -p /tmp/root/boot/gptzfsboot -i 1 vtbd1


zpool export zroot
 
Back
Top