Upgrading NetBSD

Fetching the sets

mirror=http://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-9.0/amd64/binary/sets
#mirror=http://x.x.x.x/netbsd9/amd64/binary/sets

mkdir ~/sets/
#cd ~/
#ln -s /tftpboot/netbsd9/amd64/binary/sets
cd ~/sets/
ftp -a http://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-9.0/amd64/binary/sets/MD5
#MD5 (kern-GENERIC.tar.xz) = d05c27e691f21587664cff01091e91e9
#MD5 (kern-GENERIC_KASLR.tar.xz) = 5623556456895a6c75f6ba0011c4636d

bare-metal

for set in kern-GENERIC modules; do
    ftp -a $mirror/$set.tar.xz
done; unset set
md5 kern-GENERIC.tar.xz

all the rest

for set in base comp debug etc man misc rescue tests text; do
    ftp -a $mirror/$set.tar.xz
done; unset set

Daily upgrades

One could consider automating the whole process and tracking daily binaries… See the Tracking Daily section on PXE // NetBSD for grabbing the necessary sets and kernels down there: /tftpboot/netbsd9/amd64/.

Process for XEN/PV guests

draft

Kernel

mv -f /netbsd /netbsd.old
#mv -f /netbsd.xen /netbsd.xen.old
tar xvJpf ~/sets/kern-GENERIC.tar.xz -C /
tar xvJpf ~/sets/modules.tar.xz -C /
ls -lF /stand/
#vi /boot.cfg
sync
shutdown -r now #xc takes about exactly 1 minute to restart

reboot in single user mode if you got access to the console

mount -o rw /

proceed with userland and etc, and when finished, continue the boot process by exiting the single user shell

cd /
sync
exit

otherwise you will have to reboot a second time.

Userland

cd ~/sets/
ls -lF etc* misc*
for set in base comp debug man misc rescue tests text; do
    print $set... \\c
    tar xJpf $set.tar.xz -C / && print done
done; unset set

now deal with the /etc/ directory

ls -ldF /etc.old/
rm -rf /etc.old/
cp -a /etc/ /etc.old/
etcupdate -s ~/sets/etc.tar.xz
sh /usr/sbin/postinstall -s /root/sets/etc.tar.xz -d / fix periodic ptyfsoldnodes varshm obsolete

cap_mkdb /etc/login.conf
ls -lF /etc/login.conf.db

cd /dev/
./MAKEDEV all

sync
shutdown -r now

otherwise

#sh /usr/sbin/postinstall -s 'new/' -d / fix ptyfsoldnodes
#sh /usr/sbin/postinstall -s '$newrelease' -d / fix gid pwd_mkdb obsolete ptyfsoldnodes

yet another alternative

#sysupgrade auto

for the record, the basic post-install changes you probably wanna keep

/etc/hosts
/etc/master.passwd (KSH)
/etc/rc.conf (sshd and shit)
#/etc/ttys (XEN)
#/etc/ssh/sshd_config (if that's a public host)
/root/.profile (PKG_PATH)

Trash

old tar

#tar xvzphfe
#tar xzphfe
#tar xvJphfe
#tar xJphfe

tracking release changes

Eventually review the changes between the old and the new etc.tgz

#mkdir old/ new/
#tar xzphfe OLD-RELEASE/binary/sets/etc.tgz -C old/
#tar xzphfe ~/sets/etc.tgz -C new/ 
#etcupdate -h
#etcupdate -s new

HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun