Difference between revisions of "Upgrading FreeBSD 12.2 to 13.0"
(→Upgrade the bootloader) |
(→Upgrade the packages) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 27: | Line 27: | ||
=== Upgrade the bootloader === | === Upgrade the bootloader === | ||
− | We need to update the bootloader, otherwise the system [https://lwn.net/Articles/852586 will stop booting eventually] (but not immediately). I think this is only necessary after <code>zpool upgrade</code>, and <code>zpool upgrade</code> used to warn us about this, but apparently not anymore? (Maybe it's related to the switch to OpenZFS). | + | We need to update the bootloader, otherwise the system [https://lwn.net/Articles/852586 will stop booting eventually] (but not immediately). I think this is only necessary after <code>zpool upgrade</code>, and <code>zpool upgrade</code> used to warn us about this, but apparently not anymore? (Maybe it's related to the switch to OpenZFS — unclear.) Presumably you can do this after booting into the new system, but before <code>zpool upgrade</code>. |
==== BIOS ==== | ==== BIOS ==== | ||
Line 68: | Line 68: | ||
gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da0 | gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da0 | ||
gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da2 | gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da2 | ||
+ | |||
+ | Of course, if you already booted into the new system, these become: | ||
+ | |||
+ | gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0 | ||
+ | gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da2 | ||
==== EFI ==== | ==== EFI ==== | ||
Line 80: | Line 85: | ||
pkg -c /mnt update | pkg -c /mnt update | ||
pkg -c /mnt upgrade | pkg -c /mnt upgrade | ||
− | + | umount /mnt/dev/ | |
== Activate the new BE == | == Activate the new BE == | ||
Line 94: | Line 99: | ||
* [https://www.freebsd.org/releases/13.0R/installation/ FreeBSD 13.0-RELEASE Installation Instructions] | * [https://www.freebsd.org/releases/13.0R/installation/ FreeBSD 13.0-RELEASE Installation Instructions] | ||
* [https://vermaden.wordpress.com/2021/02/23/upgrade-freebsd-with-zfs-boot-environments/ Upgrade FreeBSD with ZFS Boot Environments] | * [https://vermaden.wordpress.com/2021/02/23/upgrade-freebsd-with-zfs-boot-environments/ Upgrade FreeBSD with ZFS Boot Environments] | ||
− | * [https://www.freebsd.org/cgi/man.cgi? | + | * [https://www.freebsd.org/cgi/man.cgi?freebsd-update(8) freebsd-update(8)] |
− | * [https://www.freebsd.org/cgi/man.cgi? | + | * [https://www.freebsd.org/cgi/man.cgi?geom(8) geom(8)] |
− | * [https://www.freebsd.org/cgi/man.cgi? | + | * [https://www.freebsd.org/cgi/man.cgi?gpart(8) gpart(8)] |
Latest revision as of 11:42, 18 May 2022
Contents
Introduction
We assume root on ZFS.
Everything on this page needs to be done as root, unless specified, so su to root.
su -
Upgrade base system
We will do the upgrade offline, in a new BE, so first, create the BE and mount it.
bectl create 13.0-RELEASE bectl mount 13.0-RELEASE /mnt
Then run freebsd-update(8)
:
freebsd-update -b /mnt -d /mnt/var/db/freebsd-update -r 13.0-RELEASE upgrade 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, you really need to run it that many times.
Upgrade the bootloader
We need to update the bootloader, otherwise the system will stop booting eventually (but not immediately). I think this is only necessary after zpool upgrade
, and zpool upgrade
used to warn us about this, but apparently not anymore? (Maybe it's related to the switch to OpenZFS — unclear.) Presumably you can do this after booting into the new system, but before zpool upgrade
.
BIOS
First, determine your boot devices.
z800:aram$ zpool status zroot pool: zroot state: ONLINE scan: scrub repaired 0B in 00:01:46 with 0 errors on Mon Feb 5 17:48:15 2018 config: NAME STATE READ WRITE CKSUM zroot ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 gpt/zfs0 ONLINE 0 0 0 gpt/zfs1 ONLINE 0 0 0 errors: No known data errors
Look for the devices in the GEOM output.
z800:aram$ geom -t ... da0 PART da0p3 da0p3 DEV da0p3 LABEL gpt/zfs0 gpt/zfs0 DEV zfs::vdev ZFS::VDEV ... da2 PART da2p3 da2p3 DEV da2p3 LABEL gpt/zfs1 gpt/zfs1 DEV zfs::vdev ZFS::VDEV ...
In our case, we need to install the new bootloader on da0
and da2
.
gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da0 gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 da2
Of course, if you already booted into the new system, these become:
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0 gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da2
EFI
TODO.
Upgrade the packages
It is unclear why we need devfs, but we need it:
mount -t devfs devfs /mnt/dev/ pkg -c /mnt update pkg -c /mnt upgrade umount /mnt/dev/
Activate the new BE
bectl umount 13.0-RELEASE bectl activate 13.0-RELEASE
And reboot. If it doesn't work, you can revert to another BE in the bootloader.