Howto: Updating FreeBSD x.y-CURRENT installations using respective snapshots

obsigna

Profile disabled
freebsd-update(8) is limited to RELEASE installations, and therefore updating CURRENT is not straightforward. The handbook suggests Synchronizing (the) Source and than Rebuilding (the) World. For sure this is feasible on fast hardware, however this is not a viable option on the various ARM devices.

For example compiling the devel/subversion port from source takes hours on my Beaglebone Black - I need it with SASL support. Compiling the latest lldb-5.0.0 (svn) takes more than 48 hours, and I do this only because with that one single stepping through my code on the BBB is possible. Now imagine building world on the BBB - I didn't even try it. Instead I demonstrate here a method, which I found to be much less painful.

I installed the filesystem cloning tool sysutils/clone. Version 1.0.7 is needed, and this one is currently present only in the latest binary pkg(8) repository. The quarterly repository holds still the old version, presumably until May 2017.

1. Place the following content into the file /usr/local/etc/pkg/repos/FreeBSD.conf:
Code:
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
}

2. Install sysutils/clone
# pkg install clone


3. Backing-up the working installation
Technically this is not exactly necessary, however, I learned the hard way that there is no guarantee that CURRENT snapshots do work:
https://lists.freebsd.org/pipermail/freebsd-arm/2017-February/015730.html

In my network I got a FreeBSD file server wich exports a NFSv4 share for storing backups in /backup/images. Here I create an empty image having enough space for receiving the whole content of the working UFS partition on the BBB:

On the file server:
# cd /backup/images
# dd if=/dev/zero of=bbb-2017-03-11.img bs=1m count=4096

On the BBB:
Code:
# mount_nfs -o noatime,readahead=4,intr,soft,nfsv4 server:/backup/images /mnt
# mdconfig -a -u 0 -t vnode -f /mnt/bbb-2017-03-11.img
# bsdlabel -w md0 auto
# newfs -nU /dev/md0a
# tunefs -a enable -m 0 /dev/md0a
# mount -o noatime /dev/md0a /media

# clone -c rwoff / /media

# umount /media
# mdconfig -d -u 0
# umount /mnt

4. Updating the working FreeBSD installation using the latest snapshot, which is currently:
ftp://ftp.freebsd.org/pub/FreeBSD/s...-arm-armv6-BEAGLEBONE-20170309-r314972.img.xz

I utilize the synchronization mode (-s flag) of clone(1) excluding my customizations from the cloning operation by the way of the -x flag. Anyway, /dev, /media, /mnt, /proc, /root, /tmp, /usr/local, /usr/home and /var should be left untouched by the updating procedure.

On the file server:
Code:
# cd /backup/images
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/12.0/FreeBSD-12.0-CURRENT-arm-armv6-BEAGLEBONE-20170309-r314972.img.xz
# xz -d FreeBSD-12.0-CURRENT-arm-armv6-BEAGLEBONE-20170309-r314972.img.xz
On the Beaglebone Black:
Code:
# mount_nfs -o noatime,readahead=4,intr,soft,nfsv4 server:/backup/images /mnt
# mdconfig -a -u 0 -t vnode -f /mnt/FreeBSD-12.0-CURRENT-arm-armv6-BEAGLEBONE-20170309-r314972.img
# mount -o noatime,ro /dev/md0s2a /media

# clone -c rwoff -s -x /usr/home:/usr/local:/usr/ports:/usr/obj:/usr/src /media/usr /usr
# clone -c rwoff -s /media/sbin /sbin
# clone -c rwoff -s /media/rescue /rescue
# clone -c rwoff -s /media/bin /bin
# clone -c rwoff -s /media/libexec /libexec
# clone -c rwoff -s /media/lib /lib
# clone -c rwoff -s -x crontab:exports:fstab:group:localtime:master.passwd:motd:ntp.conf:passwd:pwd.db:rc.conf:rc.local:resolv.conf:spwd.db:ssh:ssl:unbound /media/etc /etc
# clone -c rwoff -s -x /boot/loader.conf:/boot:modules:/boot/msdos /media/boot /boot

# umount /media
# mdconfig -d -u 0
# umount /mnt

# shutdown -r now
The system should now come up with the updated FreeBSD installation, and finally the U-Boot partition must be updated as well.


5. Updating U-Boot
Code:
# mount_nfs -o noatime,readahead=4,intr,soft,nfsv4 server:/backup/images /mnt
# mdconfig -a -u 0 -t vnode -f /mnt/FreeBSD-12.0-CURRENT-arm-armv6-BEAGLEBONE-20170309-r314972.img
# mount_msdosfs -o noatime /dev/md0s1 /media

# cp -p /media/* /boot/msdos/

# umount /media
# mdconfig -d -u 0
# umount /mnt

# shutdown -r now
Now the system should be completely up to date.
 
Last edited:
Back
Top