# whats the best method for upgrading freebsd 7.x to 8.0 on a remote system?



## wonslung (Oct 2, 2009)

I was wondering what the best method was for upgrading from freebsd 7.x to 8.0 when you only have ssh as a means to connecting.

When i've upgraded in the past it was 

buildworld
buildkernel
installkernel
reboot
mergemaster -p
installworld
mergemaster 
reboot


but when i just tried that, the system didn't come back up after the first kernel install/reboot.

Did something go wrong with the kernel or is the procedure different with 8.0?


----------



## DutchDaemon (Oct 2, 2009)

The procedure doesn't change, so it must be something with the kernel. Was it GENERIC or did you try a stripped kernel (usually better to start off with GENERIC).


----------



## wonslung (Oct 2, 2009)

DutchDaemon said:
			
		

> The procedure doesn't change, so it must be something with the kernel. Was it GENERIC or did you try a stripped kernel (usually better to start off with GENERIC).



yes, i tried a stripped down kernel, it's pretty similar to the one i used before, but i must have missed something.

Will try rebuilding the generic kernel first.  I figured this may be the problem, but i'm not sure what went wrong.


----------



## aragon (Oct 2, 2009)

Moving between major versions might be problematic when you boot with the new kernel and old userland.  In those situations you really need a remote console, or someone physically at the server to boot the new kernel in single user mode and get the network up for you.


----------



## wonslung (Oct 3, 2009)

i can't get that.  This company doesn't support anything over freebsd 7.1

is there anyways to install the kernel and userland at the same time from freebsd 7.1?


----------



## dennylin93 (Oct 3, 2009)

I've heard that some people skip the first reboot, but I'm not sure if this is safe.


----------



## DutchDaemon (Oct 3, 2009)

I do that (skipping the first reboot) all the time (I update _very_ frequently within -STABLE), but I have _never_ tried it with a major version upgrade. On the one hand, a radically new userland on an old kernel is a recipe for failure; on the other hand: not much needs to be done after installing userland, except mergemaster and a reboot. Still, wouldn't advise it.


----------



## aragon (Oct 3, 2009)

You can run installworld straight after installkernel before rebooting.  It should work, but the results are what are very risky.  If your new kernel is broken you won't really have a back pedal because your userland will be new and very likely incompatible with your old kernel.

Surely this hosting company has a remote console device?  Or a serial box?

Something else you can try is to rename /etc/rc and write your own very basic rc script that does nothing more than mount all file systems, configure the network, and start sshd.  That too is risky, so test the script on a spare machine nearby.


----------



## wonslung (Oct 3, 2009)

aragon said:
			
		

> You can run installworld straight after installkernel before rebooting.  It should work, but the results are what are very risky.  If your new kernel is broken you won't really have a back pedal because your userland will be new and very likely incompatible with your old kernel.
> 
> Surely this hosting company has a remote console device?  Or a serial box?
> 
> Something else you can try is to rename /etc/rc and write your own very basic rc script that does nothing more than mount all file systems, configure the network, and start sshd.  That too is risky, so test the script on a spare machine nearby.




they do offer a kvm but it's WAY too expensive for what i'm trying to do.  I'll just build the generic kernel.

If something DOES go wrong, they do have an automated reinstall of 7.1...not ideal but not horrible either.

so you're saying to do this:

make buildworld
make buildkernel
make installkernel
make installworld
mergemaster -p
mergemaster
reboot

and this will bring me into 8 unless something goes wrong?


----------



## aragon (Oct 3, 2009)

Yes.  You can skip "mergemaster -p" though.

Fingers crossed.


----------



## wonslung (Oct 3, 2009)

when i run mergemaster i get this:


```
install -o root -g wheel  -m 644 atrun cron ftpd imap kde login other passwd pop3 rsh sshd su system telnetd xdm /var/tmp/temproot/etc/pam.d
/var/tmp/temproot/etc/pam.d/ftp -> /var/tmp/temproot/etc/pam.d/ftpd
Bad system call (core dumped)
*** Error code 140

Stop in /usr/src/etc/pam.d.
*** Error code 1

Stop in /usr/src/etc.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.

  *** FATAL ERROR: Cannot 'cd' to /usr/src and install files to
      the temproot environment
```

edit:

I went ahead and did mergemaster -p and installed all the stuff except /etc/master.passwd /etc/passwd and /etc/group

then i tried again, same deal
so i rebooted
system came up
now doing mergemaster, seems to be working
will reboot again when done if it completes without errors


----------



## wonslung (Oct 3, 2009)

rebooting now, fingers crossed


edit:

```
FreeBSD xxxxxxx.xxxxxxx.com 8.0-RC1 FreeBSD 8.0-RC1 #0: Sat Oct  3 02:38:33 CEST 2009     root@xxxxxxxx.xxxxxxx.com:/usr/obj/usr/src/sys/GENERIC  amd64
```


woooo
thanks for the help guys


----------



## aragon (Oct 3, 2009)

That mergemaster error is from the new userland not working on the old kernel.  Glad the reboot worked.  If you haven't already, run mergemaster now.


----------



## rbelk (Oct 3, 2009)

OK guys, should the correct procedure be this?

1. make buildworld
2. make buildkernel
3. make installkernel
4. make installworld
5. reboot
6. mergemaster -p
7. mergemaster
8. reboot


----------



## aragon (Oct 3, 2009)

Based on won's experience, it might be better to do mergemaster before installworld. (and no mergemaster -p)


----------



## wonslung (Oct 3, 2009)

things would have been a lot easier with a kvm or access to the computer but the cost of a kvm from my hosting company is insane, well, the setup fee that is.  

Either way, it all worked out for me, i got FreeBSD 8 on there.


----------



## DutchDaemon (Oct 3, 2009)

The correct procedure is in /usr/src/Makefile. Don't reinvent the wheel. Unless you need to deviate from it for a very good reason, use that procedure at all times.


```
# For individuals wanting to upgrade their sources (even if only a
# delta of a few days):
#
#  1.  `cd /usr/src'       (or to the directory containing your source tree).
#  2.  `make buildworld'
#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
#       [steps 3. & 4. can be combined by using the "kernel" target]
#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
#  6.  `mergemaster -p'
#  7.  `make installworld'
#  8.  `make delete-old'
#  9.  `mergemaster'                         (you may wish to use -U or -ai).
# 10.  `reboot'
# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)
```

I always add a step 0: [cmd=]rm -rf /usr/obj[/cmd] and a step 1a: [cmd=]make cleanworld[/cmd].


----------



## Business_Woman (Oct 3, 2009)

DutchDaemon said:
			
		

> ...
> I always add a step 0: [cmd=]rm -rf /usr/obj[/cmd] and a step 1a: *make cleanworld*.



Isn't that done automatically before every build of world?


----------



## DutchDaemon (Oct 3, 2009)

No! If your previous build failed, code may be reused (leading to new failures).


----------



## morbit (Oct 3, 2009)

I usually (daily) updated CURRENT like this:

```
make cleandir && make cleandir && svn update && make -j4 buildworld && make -j4 buildkernel KERNCONF=STRIPPED && make installkernel 
KERNCONF=STRIPPED && make installworld && make cleandir && make cleandir && rm -rf /usr/obj  && make delete-old -DBATCH_DELETE_OLD_FILES && make 
delete-old-libs -DBATCH_DELETE_OLD_FILES && mergemaster
```

YMMV as always.


----------



## wonslung (Oct 3, 2009)

yah, i have never had a problem with the standard method until i tried to upgrade from 7.1 to 8.0  

My situation isn't normal.  Most people have single user access to the pc but i didn't and a kvm was in the triple digits for setup, i just wasn't going to pay that if there was a chance at another way.


----------



## ohauer (Oct 4, 2009)

I haven't test a update from FreeBSD 7.x to 8.x but all my machines are updated this way.
daemonforums.org: Remote FreeBSD server upgrade - Guide!

I will Test the next days a Update from 7.2 to 8 and I don't expect any failure.


----------



## jb_fvwm2 (Oct 5, 2009)

Anyone not using a pure GENERIC kernel would want to do at least
one of the following:
a...  peruse the Release Notes (even the ones from the outgoing
kernel if the Notes are more recent than your kernel, maybe)
b...

```
sdiff GENERIC GENERIC    #putting in the old and new paths
                         #to compare new and old generic
```
for additions and deletions unless one does it one of the
several other ways


----------

