# Moving a FreeBSD 9.3-STABLE System to 10.1.0-RELEASE

In order to move from maintaining a FreeBSD system using source updates and manual builds, one needs to get it on a release track.  One way to do this is to upgrade it to the next release by doing a final source build.  Unfortunately, there is no FreeBSD 9 release after FreeBSD 9.3. So one has to jump to 10.x.  At the time of writing 10.1.0-RELEASE was the most current.

## Getting the Source for 10.1-RELEASE

### The Plan for Fetching Source

I wanted to save the old source tree just in case, before getting the new one.  So I moved /usr/src out of the way and grabbed the release via svn.

```
mv /usr/src /usr/src.old
rm -rf /usr/obj
mkdir /usr/src
cd /usr/src
svn checkout https://svn0.us-west.freebsd.org/base/releng/10.1/ /usr/src
```

### The Reality

Unfortunately this failed

```
# svn checkout https://svn0.us-west.freebsd.org/base/release/10.1.0/ /usr/src       
svn: E000064: Unable to connect to a repository at URL 'https://svn0.us-west.freebsd.org/base/release/10.1.0'
svn: E000064: Error running context: Host is down
```

After 20 minutes of wasted debugging, it turned out that there was a DNS entry for an AAAA, but the server was not reachable via IPv6

```
# ping6 svn0.us-west.freebsd.org
PING6(56=40+8+8 bytes) 2001:418:1::27 --> 2001:1900:2254:206a::e6a:0
^C
--- svnmir.ysv.freebsd.org ping6 statistics ---
5 packets transmitted, 0 packets received, 100.0% packet loss
```

So I turned off IPv6 and the svn ran successfully.  <sad face>

## Building the 10.1 release

### The Instructions

The classic instructions from /usr/src/UPDATING are

```
To upgrade in-place from stable to current
----------------------------------------------
<make sure you have good level 0 dumps>
make buildworld                                 [9]
make kernel KERNCONF=YOUR_KERNEL_HERE           [8]
                                                [1]
<reboot in single user>                         [3]
mergemaster -p                                  [5]
make installworld
mergemaster -i                                  [4]
make delete-old                                 [6]
<reboot>
```

### What I Actually Did

My habits were slightly different.  So I did the following

#### Build World and Kernel

Note that one first builds the new world but does not install it, so that the kernel will be built with the new compiler and library.

```
time make buildworld 2>&1 | tee buildworld.log
time make kernel 2>&1 | tee kernel.log
```

Note that this last has installed the new kernel, so you are committed.

If you turned IPv6 off in /etc/rc.conf you may want to re-enable it.

### Finish Installation of the New World

At or before this point, it is wise to test that you have serial (or VGA) console.  You're gonna need it.

Now boot the new kernel in single user mode.

```
shutdown now
```

Then install the world as built in the previous steps. From the serial (or VGA) console,

```
export TERM=vt100
mergemaster -p
cd /usr/src
time make installworld 2>&1 > installworld.log
# check installworld.log to be sure it's ok
tail installworld.log
mergemaster -cviFU
```

In once case, after installworld, mergemaster got a jillion

```
<jemalloc>: Conf string ends with key
```

The hack is to

```
rm /etc/malloc.conf
```

and rerun installworld.

## Finally, Boot into the New System

One should now be able to boot multi-user.  Careful inspection of the boot console output would be wise.

```
reboot
```

One should get to the current security patch level.

```
freebsd-update fetch
freebsd-update install
```

And a reboot would probably be wise, as there was likely a kernel or other critical component update.

### Oopsie!

The reboot gave me

```
Configuring syscons: keymap keyrate blanktime.
Performing sanity check on sshd configuration.
Shared object "libkrb5.so.11" not found, required by "sshd"
/etc/rc: WARNING: failed precmd routine for sshd
```

I had to go in over serial console and

```
cd /usr/src/secure/lib/libssh
make
make install
cd /usr/src/secure/usr.sbin/sshd
make
make install
cd /usr/src/lib/libgssapi
make
make install
service sshd restart
```

to get going again.  I never debugged this, just hacked.

## And Rebuild Ports

It is recommend that one rebuild all installed ports.

```
pkg-static install -f pkg
portmaster -af
```

If portmaster has a bad day, fix whatever caused it to barf and

```
portmaster -af -R 
```

to resume without rebuilding what it already rebuilt.