.\"	$NetBSD: upgrade,v 1.19.66.1 2019/11/21 19:28:40 martin Exp $
.\"
.\" Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.
.\"	NOTE:	This file is shared between the hp300 and the mvme68k
.
It is possible to easily upgrade your existing
.Nx*M
system using the upgrade program in the miniroot or by manually performing
the same steps as the miniroot upgrade program.
.
.Ss2 Upgrading using the miniroot
.
If you wish to upgrade
your system by this method, simply select the
.Sy upgrade
option once the miniroot has booted.
The upgrade program with then guide you through the procedure.
.if \n[hp300] \{\
While you can boot the miniroot using the same methods described above for
a fresh install of
.Nx*M
there are easier and less intrusive options since your disk is already
labeled and bootable.
The easiest is to dump the miniroot to your swap
partition and boot from that.
.(enum
Download the files you'll need to upgrade
.Pp
In particular, make sure you have on your locally mounted file systems
.Pa base.\*[setsuffix]
and
.Pa miniroot.fs.gz
.It
Boot your \*M into
.Sq "single-user mode" :
.Pp
Follow the instructions in the section above on
.Sx Chosing a kernel location
and type
.Li -s
at the prompt.
.It
Extract and install a new boot block:
.Pp
Make sure you install the bootstrap program distributed with this version of
.Nx*M .
.(disp
.No # Ic "tar -xpvzf base.\*[setsuffix] ./usr/mdec"
.No # Ic "disklabel -B -b ./usr/mdec/uboot.lif " Ar root-disk
.disp)
E.g.:
.Ar root-disk
could be
.Li sd0
or
.Li rd0 .
We'll assume
.Li rd0
for now.
.It
Install the miniroot file system:
.Pp
First make sure that your
.Sq Li "b"
partition has enough room for the uncompressed miniroot (otherwise it
might overwrite another partition or the end of the disk).
.(disp
.No # Ic "gunzip miniroot.fs.gz"
.No # Ic "dd if=miniroot.fs of=/dev/rd0b"
.disp)
.It
Boot the miniroot:
.Pp
Follow the instructions in the section above on
.Sx Chosing a kernel location
and type
.Li rd0b:netbsd
at the prompt.
.enum)
.Pp
.\} \" ! \n[hp300]
The upgrade program will:
.(enum
Enable the network based on your system's current
network configuration.
.It
Mount your existing file systems.
.It
Extract binary sets from the media of your choice.
.It
Fixup your system's existing
.Pa /etc/fstab ,
changing the occurrences of
.Sy ufs
to
.Sy ffs
and let you edit the resulting file.
.It
Make new device nodes in your root file system under
.Pa /dev .
.It
Don't forget to extract the
.Sy kern
set from the distribution.
.(Note
The existing kernel
.Em will not
be backed up; doing so would be pointless, since older kernels may not be
capable of running
.Nx \*V executables.
.Note)
.It
Install a new boot block.
.It
Check your file systems for integrity.
.It
You'll have to reboot your system manually
.enum)
.
.Ss2 Manual upgrade
.
While using the miniroot's upgrade program is the preferred method
of upgrading your system, it is possible to upgrade your system
manually.
To do this, follow the following procedure:
.(enum
Place
.Em at least
the
.Sy base
binary set in a file system
accessible to the target machine.
A local file system is preferred, since the NFS subsystem in the
.Nx \*V
kernel may be incompatible with your old binaries.
.It
Back up your pre-existing kernel and copy the \*V
kernel into your root partition
.Pq Pa / .
.ie \n[hp300] \{\
.It
Extract and install a new boot block:
.Pp
Make sure you install the bootstrap program distributed with this version of
.Nx*M .
.(disp
.No # Ic "tar -xpvzf base.\*[setsuffix] ./usr/mdec"
.No # Ic "disklabel -B -b ./usr/mdec/uboot.lif " Ar root-disk
.disp)
E.g.:
.Ar root-disk
could be
.Li sd0
or
.Li rd0 .
.\}
.It
Reboot with the \*V kernel into single-user mode.
.It
Check all file systems:
.Pp
.Dl # Ic "/sbin/fsck -pf"
.It
Mount all local file systems:
.Pp
.Dl # Ic "/sbin/mount -a -t nonfs"
.It
If you keep
.Pa /usr
or
.Pa /usr/share
on an NFS server, you will want to mount those file systems as well.
To do this, you will need to enable the network:
.Pp
.Dl # Ic "sh /etc/rc.d/network start"
.It
Make sure you are in the root file system
.Pq Pa /
and extract
the
.Sy base
binary set:
.Pp
.Dl # Ic "cd /"
.Dl # Ic "pax -zrvpe -f" Em /path/to/ Ns Ic base.\*[setsuffix]
.if \n[mvme68k] \{\
.It
Install a new boot block:
.Pp
.Dl # Ic "cd /usr/mdec"
.Dl # Ic "cp bootsd /.bootsd"
.Dl # Ic "./installboot /.bootsd bootxx \*<" Ar root-disk
.Pp
E.g.:
.Ar root-disk
could be
.Pa /dev/rsd0a .
.\}
.It
Sync the file systems:
.Pp
.Dl # Ic sync
.It
At this point you may extract any other binary sets
you may have placed on local file systems, or you may
wish to extract additional sets at a later time.
To extract these sets, use the following commands:
.Pp
.Dl # Ic "cd /"
.Dl # Ic "pax -zrvpe -f" Ar path_to_set
.enum)
.(Note
You
.Em should not
extract the
.Sy etc
set if upgrading.
Instead, you should extract that set into another
area and carefully merge the changes by hand.
.Note)
