# Fail to upgrade using bectl



## patpro (Jul 10, 2022)

Hello,

I was about to upgrade my remote FreeBSD 12.x-RELEASE server to 13.1-RELEASE and decided to give bectl(8)() a try. I've followed Dru Lavigne's how-to (<https://klarasystems.com/articles/managing-boot-environments/>).

I've made 6 or 7 attempts. And finally I've made the upgrade the old fashion way 

First step would go smoothly (installing the new kernel, rebooting), but when it was time to install everything else, it failed, every single times, no matter what I've done to work around the problem:


```
bectl list
    BE      Active Mountpoint Space Created
    13      N      /          1.06G 2022-07-09 12:10
    default R      -          4.41G 2020-01-31 08:41
freebsd-update install
    src component not installed, skipped
    No updates are available to install.
    Run '/usr/sbin/freebsd-update fetch' first.
```

It probably comes from my ZFS layout, but I would have really loved bectl telling me "uh-oh, your layout won't work with me, don't lose the next 6 hours trying":


```
$ zfs list -o name,canmount,mountpoint
NAME                                        CANMOUNT  MOUNTPOINT
sas                                         on        /sas
sas/ROOT                                    on        none
sas/ROOT/default                            noauto    /
sas/backup                                  on        /sas/backup
sas/tmp                                     on        /tmp
sas/usr                                     off       /usr
sas/usr/home                                on        /usr/home
sas/usr/home/user1                          on        /usr/home/user1
sas/usr/home/user2                          on        /usr/home/user2
sas/usr/local                               on        /usr/local
sas/usr/local/www                           on        /usr/local/www
sas/usr/ports                               on        /usr/ports
sas/usr/src                                 on        /usr/src
sas/var                                     off       /var
sas/var/audit                               on        /var/audit
sas/var/cache                               on        /var/cache
sas/var/crash                               on        /var/crash
sas/var/db                                  on        /var/db
sas/var/db/freebsd-update                   on        /var/db/freebsd-update  (I've created this one during my very last work around attempt)
sas/var/db/mysql                            on        /var/db/mysql
sas/var/db/pkg                              on        /var/db/pkg
sas/var/db/redis                            on        /var/db/redis
sas/var/empty                               on        /var/empty
sas/var/log                                 on        /var/log
sas/var/mail                                on        /var/mail
sas/var/tmp                                 on        /var/tmp
```

That's a shame because I liked the idea of bectl very much.


----------



## mer (Jul 10, 2022)

I don't have any answers but a couple of questions.
What arguments did you pass to bectl create?  This is a bit important if you "man bectl and go read the Boot Environment Structures" section.  

You "handcrafted" your datasets instead of using the installer layout?  This is tied to the previous question, particularly the canmount and mountpoint options.

From the man bectl, on a 13.1-RELEASE system:

 "bectl commands that have their own -r operate on this second, “deep”
     style of boot environment, when the -r flag is set.  A future version of
     bectl may default to handling both styles and deprecate the various -r
     flags."


----------



## patpro (Jul 10, 2022)

I've started with `bectl create 13` but at some point I've tried `bectl create -r 13`. Also, my understanding of the command was limited to the man page of 12.3-RELEASE, because I was here when I've decided to upgrade to 13.1-RELEASE.

Most of my datasets are most likely handcrafted, in fact zpool history output tells me that only this part was created by the installer:


```
# zpool history sas
History for 'sas':
2020-01-31.08:41:43 zpool create -o altroot=/mnt -O compress=lz4 -O atime=off -m none -f sas raidz1 da0p3 da1p3 da2p3 da3p3
2020-01-31.08:41:43 zfs create -o mountpoint=none sas/ROOT
2020-01-31.08:41:43 zfs create -o mountpoint=/ sas/ROOT/default
2020-01-31.08:41:44 zfs create -o mountpoint=/tmp -o exec=on -o setuid=off sas/tmp
2020-01-31.08:41:44 zfs create -o mountpoint=/usr -o canmount=off sas/usr
2020-01-31.08:41:44 zfs create sas/usr/home
2020-01-31.08:41:44 zfs create -o setuid=off sas/usr/ports
2020-01-31.08:41:44 zfs create sas/usr/src
2020-01-31.08:41:45 zfs create -o mountpoint=/var -o canmount=off sas/var
2020-01-31.08:41:45 zfs create -o exec=off -o setuid=off sas/var/audit
2020-01-31.08:41:45 zfs create -o exec=off -o setuid=off sas/var/crash
2020-01-31.08:41:46 zfs create -o exec=off -o setuid=off sas/var/log
2020-01-31.08:41:46 zfs create -o atime=on sas/var/mail
2020-01-31.08:41:46 zfs create -o setuid=off sas/var/tmp
2020-01-31.08:41:46 zfs set mountpoint=/sas sas
2020-01-31.08:41:46 zpool set bootfs=sas/ROOT/default sas
2020-01-31.08:41:47 zpool set cachefile=/mnt/boot/zfs/zpool.cache sas
2020-01-31.08:41:52 zfs set canmount=noauto sas/ROOT/default
```

Everything after that I made it myself (sas/usr/local, sas/usr/home/*, sas/var/* …)


----------



## mer (Jul 10, 2022)

That's good additional info.  So you were running 12.3-RELEASE, I don't know what capability bectl had at that point.
I'm not sure how or if bectl can check and warn about dataset layout being incompatible, but understand why it would be frustrating.


----------

