Operating a NetBSD system


Search for unneeded packages,

pkg_leaves -&

Upgrading the base system

Review the changes between the old and the new etc.tgz

mkdir old/ new/
tar xzphfe $oldrelease/binary/sets/etc.tgz -C old/
tar xzphfe $newrelease/binary/sets/etc.tgz -C new/ 
etcupdate -s new
#etcupdate -s newrelease/binary/sets/etc.tgz will work too

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

sh /usr/sbin/postinstall -s 'new/' -d / fix ptyfsoldnodes

cd /dev/

Run the new kernel,

mv -f netbsd netbsd.old
#mv -f netbsd.xen netbsd.xen.old
tar xvzphfe kern-GENERIC.tgz -C /
tar xvzphfe modules.tgz -C /
cd /
vi boot.cfg
shutdown -r now

reboot in single user mode if you got access to the console, otherwise use a reduced ssh-only rc.conf,

mount -o rw /

Update the user-land (assuming KSH),

cd $newrelease/binary/sets/
ls -l etc.tgz
ls -l misc.tgz
for set in `ls -1 *.tgz | grep -v ./kern | grep -v ./etc | grep -v ./x`; do
    print $set... \\c
    tar xzphfe $set -C / && print done
done; unset set

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

Continue the boot process by exiting the single user shell,

cd /

Upgrading all packages

Solution 1,

echo $PKG_PATH
pkg_add pkg_chk
pkg_chk -b -P $PKG_PATH -u -q
pkg_chk -b -P $PKG_PATH -u

Solution 2, pkg_rolling-replace.