Upgrading NetBSD

Fetching the 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


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



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
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 /

otherwise you will have to reboot a second time.


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/

shutdown -r now


#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/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)


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

Nethence | Pub | Lab | Pbraun | SNE Russia