Chapter 4. Upgrading NetBSD

Table of Contents

4.1. Using sysinst
4.1.1. Overview
4.1.2. The INSTALL document
4.1.3. Performing the upgrade
4.2. Using sysupgrade

This chapter describes the binary upgrade of a NetBSD system. There are a variety of alternatives to perform this procedure, and the following sections will guide you through them:

4.1. Using sysinst

4.1.1. Overview

To do the upgrade, you must have some form of bootable media (CD-ROM, USB drive, floppy, etc.) available and at least the base and kern distribution sets. Since files already installed on the system are overwritten in place, you only need additional free space for files which weren't previously installed or to account for growth of the sets between releases. Usually this is not more than a few megabytes.

Note

Since upgrading involves replacing the kernel, boot blocks, and most of the system binaries, it has the potential to cause data loss. Before beginning, you are strongly advised to back up any important data on the NetBSD partition or on any other partitions on your disk.

The upgrade procedure is similar to an installation, but without the hard disk partitioning. sysinst will attempt to merge the settings stored in your /etc directory with the new version of NetBSD. Also, file systems are checked before unpacking the sets. Fetching the binary sets is done in the same manner as in the installation procedure.

4.1.2. The INSTALL document

Before doing an upgrade it is essential to read the release information and upgrading notes in one of the INSTALL files: this is the official description of the upgrade procedure, with platform specific information and important details. It can be found in the root directory of the NetBSD release (on the install CD or on the FTP server).

It is advisable to print the INSTALL document out. It is available in four formats: .txt, .ps, .more, and .html.

4.1.3. Performing the upgrade

The following section provides an overview of the binary upgrade process. Most of the following sysinst dialogs are similar to those of the installation process. More verbose descriptions and explanations of the dialogs are available in Chapter 3, Example installation.

After selecting the installation language and the keyboard type, the main menu appears. Choosing option b: Upgrade NetBSD on a hard disk will start the the upgrade process.

Figure 4.1. Starting the upgrade

Starting the upgrade

The dialog in Figure 4.2, “Continuing the upgrade” will request permission to continue with the upgrade. At this point nothing has been changed yet and the upgrade can still be cancelled. This is a good time to ask yourself whether you have made a backup, and if you know for certain that you will be able to restore from it.

Figure 4.2. Continuing the upgrade

Continuing the upgrade

After choosing to continue with Yes, the next dialog will ask you to specify the hard disk with the NetBSD system that shall be upgraded.

Figure 4.3. Choosing the hard drive

Choosing the hard drive

The system used for the example has only one hard disk available: wd0.

At this point, sysinst will perform a check of the file system to ensure its integrity.

Figure 4.4. File system check

File system check

The next step is to choose which type of bootblocks to install.

Figure 4.5. Choosing bootblocks

Choosing bootblocks

The following dialog provides a menu to choose the installation type. The choices are Full installation, Installation without X11, Minimal installation, or Custom installation.

Figure 4.6. Choosing the distribution filesets

Choosing the distribution filesets

The following dialog asks for the install method of choice and provides a list of possible options. The install medium contains the new NetBSD distribution sets. You will be prompted for different information depending on which option you choose. For example, a CD-ROM or DVD install requires you to specify which device to use and which directory the sets are in, while an FTP install requires you to configure your network and specify the hostname of an FTP server. More details can be found in Section 3.11, “Choosing the installation medium”.

Figure 4.7. Install medium

Install medium

sysinst will now unpack the distribution sets, replacing your old binaries. After unpacking these sets, it runs the postinstall(8) script to perform various system cleanup and configuration update tasks. If postinstall produces errors, you will have to manually resolve the issues it brings up. See postinstall's man page for more information. Even after a successful postinstall run, it is advisable to use etcupdate(8) to aid in merging any other configuration changes. You should also read the remarks in INSTALL about upgrading, as specific compatibility issues are documented there.

Figure 4.8. Upgrade complete

Upgrade complete

When you are back at the main menu, remove the boot medium (if applicable) and reboot. Have fun with your new version of NetBSD!

4.2. Using sysupgrade

The sysupgrade utility (currently found in pkgsrc/sysutils/sysupgrade) allows you to upgrade a running system to a newer binary release.

Note

Take care when upgrading across major releases - ensure your running kernel is never newer than the userspace.

One of the benefits of sysupgrade is that it is an integrated and almost-unattended solution: the tool fetches the new kernel and distribution sets from remote sites if you desire and performs the upgrade without user intervention until new changes to the configuration files need to be merged.

Let's assume you are running NetBSD/amd64 9.1 and you wish to upgrade to NetBSD 9.2. The procedure to do so would be to run the following command:

# sysupgrade auto https://cdn.NetBSD.org/pub/NetBSD/NetBSD-9.2/amd64
  

And that's all that it takes. This will proceed to download the kernel and sets appropriate for your machine, unpack them and assist you in merging new configuration changes. Do not forget to reboot afterwards.

When upgrading between major releases (e.g. between NetBSD 8.2 and 9.2), take care to first upgrade the kernel and modules:

# sysupgrade fetch https://cdn.NetBSD.org/pub/NetBSD/NetBSD-9.2/amd64
# sysupgrade kernel
# sysupgrade modules
# reboot
# sysupgrade sets
# sysupgrade etcupdate
# sysupgrade postinstall
# sysupgrade clean
# reboot
  

For more details, please see the included sysupgrade(8) manual page and the /usr/pkg/etc/sysupgrade.conf configuration file.