# FreeBSD 8 Src Upgrade



## vivek (Nov 15, 2009)

Backup the system before you do this. I've successfully upgraded my Gnome desktop from 7.2 to 8RC3. I'm also assuming that you are using portsnap and portmaster to manage apps. Here is how I did it:

Edit supfile and make sure tag set to RELENG 8 (this will get RC3):

```
*default release=cvs tag=RELENG_8_0
```
Note if you do not have supfile, enter:

```
# cp /usr/share/examples/cvsup/standard-supfile /root/supfile
# vi /root/supfile
```
And make sure it looks as follows

```
*default host=cvsup1.us.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_8_0
*default delete use-rel-suffix
```

Get the freebsd 8 source:

```
csup /root/supfile
```
Read last minute info:

```
vi /usr/src/UPDATING
```
You can disable unwanted options i.e. source build options via /etc/src.conf. Here is my sample /etc/src.conf (read man page src.conf(5) for more info):

```
WITHOUT_ATM=yes
WITHOUT_BLUETOOTH=yes
WITHOUT_CALENDAR=yes
WITHOUT_GAMES=yes
WITHOUT_I4B=yes
WITHOUT_IPFILTER=yes
WITHOUT_IPX=yes
WITHOUT_LPR=yes
WITHOUT_NETCAT=yes
WITHOUT_NIS=yes
WITHOUT_RCMDS=yes
WITHOUT_SENDMAIL=yes
WITHOUT_WPA_SUPPLICANT_EAPOL=yes
WITHOUT_ZFS=yes
WITHOUT_BLUETOOTH=yes
```
Type the following command to build base system:

```
cd /usr/src
make cleanworld && make cleandir
make buildworld
```
Build and install the kernel:

```
make buildkernel
make installkernel
```
Reboot the box:

```
reboot
```
Boot into a single user mode and mount it:

```
mount -a -t ufs
df
```
Install sys configuration files that are required by the new base system

```
mergemaster -p
```
Warning: Be careful with /etc/passwd, /etc/group and other modified file in based. Verify each file before installing the new version or merging something.
Instal the base system:

```
cd /usr/src
make installworld
```
Merge your configuration files

```
mergemaster -i
make delete-old
reboot
```
Warning: Be careful with /etc/passwd, /etc/group and other modified file in based. Verify each file before installing the new version or merging something.
Verify it:

```
uname -a
```
O/P

```
FreeBSD ninjutsu.my.lan  8.0-RC3 FreeBSD 8.0-RC3 #2: Sun Nov 15 22:34:26 IST 2009     root@ninjutsu.my.lan:/usr/obj/usr/src/sys/GENERIC  amd64
```

Recompile all apps:

```
portsnap fetch update
pkg_version -l '<'
portmaster -Da
make delete-old-libs
```

*References:*

man pages portmaster, portsnap, make, csup, src.conf(5) etc, /usr/src/Makefile
http://www.freebsd.org/doc/en/books/handbook/makeworld.html

Let me know if you've any question. Enjoy! Peace & Love!!


----------



## aragon (Nov 15, 2009)

No offense, but are posts like these really necessary?  I see nothing unique in your howto compared to simply reading the handbook...


----------



## DutchDaemon (Nov 15, 2009)

You miss some important steps, like 'make delete-old' and 'make delete-old-libs' (the second one should only be done after rebuilding all installed ports). Starting with 'make cleanworld' and 'make cleandir' is advisable as well.

See /usr/src/Makefile.


----------



## vivek (Nov 15, 2009)

@DutchDaemon, thanks for the heads up and information. 

@aragon, not everything is covered in handbook. The main point of forum is discussion. See DutchDaemon's comment. It was helpful and informative.


----------



## jb_fvwm2 (Nov 15, 2009)

One would want to upgrade more carefully if one has
a custom kernel; compare v7 GENERIC to v8 GENERIC,
see the Release_Notes_for_v8;
Despite that, some features I could not get to work
properly without loading additional ko's in loader.conf,
(in this case, geom_bsd.ko, geom_mbr.ko, geom_label.ko, to
"allow" dev entries to appear). Could have been something
I overlooked, a temporary glitch at that particular day
of _8 stable, ... 
I think I made a simple post of the process in this or another
forum (and not a full howto).


----------



## SIFE (Nov 23, 2009)

how can i force to rebuild packages even thye are updates ?


----------



## vivek (Nov 25, 2009)

SIFE said:
			
		

> how can i force to rebuild packages even thye are updates ?



From the man page ( I never did this ):
Using portmaster to do a complete reinstallation of all your ports:

```
portmaster --list-origins > ~/installed-port-list
```
Update your ports tree

```
portmaster --clean-distfiles-all
portmaster --check-port-dbdir
portmaster -Faf
pkg_delete '*'
rm -rf /usr/local/lib/compat/pkg
```
Manually check /usr/local and /var/db/pkg to make sure that they are really empty:
portmaster `cat ~/installed-port-list`

See man page for details.


----------



## SeaHag (Dec 9, 2009)

*Where's supfile*

Where's the supfile found? It's been a long time since I set the system up and I don't remember where it is or what it was called?


----------



## DutchDaemon (Dec 9, 2009)

/usr/share/examples/cvsup/


----------



## graudeejs (Dec 9, 2009)

DutchDaemon said:
			
		

> /usr/share/examples/cvsup/



man he's lazy to read.... I've told him everything he needs to know to update system....
https://forums.freebsd.org/showthread.php?t=9163


----------



## SeaHag (Dec 9, 2009)

DutchDaemon said:
			
		

> /usr/share/examples/cvsup/



Those are example ones. Where is the one my system is currently using?


----------



## SeaHag (Dec 9, 2009)

killasmurf86 said:
			
		

> man he's lazy to read.... I've told him everything he needs to know to update system....
> https://forums.freebsd.org/showthread.php?t=9163



No, he just told me to read the handbook which is not clear or helpful.


----------



## DutchDaemon (Dec 9, 2009)

c(v)sup is not configured to use any cvsupfile by default. You'll have to either create one or use one of the examples.


----------



## SeaHag (Dec 9, 2009)

I'm confused. I thought I had to have one to set up the system in the first place, no? Doesn't it remain on the system somewhere?


----------



## DutchDaemon (Dec 9, 2009)

csup plays no role in the initial setup of the machine. The initial setup is either done from CD/DVD or over the net (FTP/HTTP). Those are binary ("canned") sets, not source code.


----------



## SeaHag (Dec 9, 2009)

Ok. Yes I install over the net. I remember making a supfile a while back when I set up a different system. I thought it was always used for net install to specify the mirror repository but I guess I was just confusing it with when I used to use cvsup for port install. I've been using portsnap for the last year or two and used to use cvsup. I thought it was used for net install too but I was mistaken.

So I guess I need to make a new one for this upgrade then it will remain on the system if I ever want to use csup again right?


----------



## sixtydoses (Dec 9, 2009)

Yes, it'll remain on the system. For the source supfile you have to specify the branch tag that you want, in your case it's `RELENG_8`. For ports supfile the tag is always current.


----------



## DutchDaemon (Dec 9, 2009)

But leave the ports part out of the csup process, since you're already running portsnap. Don't want two separate processes competing over the ports tree.


----------



## SeaHag (Dec 9, 2009)

sixtydoses said:
			
		

> Yes, it'll remain on the system. For the source supfile you have to specify the branch tag that you want, in your case it's `RELENG_8`. For ports supfile the tag is always current.



So you're saying there are two supfiles, one for ports and one for source?


----------



## SeaHag (Dec 9, 2009)

I followed the above steps and followed along in the handbook at the same time but when I got to the step;


```
make installkernel
```

It failed for / filesystem full. / is at 109%. My /dev/ad8s3a is 500MB. Is this normal? Is there something I can delete to make room?

df -h

```
Filesystem       Size      Used    Avail   Capacity Mounted on
/dev/ad8s3a     496M       495M     -39M       109%      /
devfs           1.0k       1.0k      0B        100%      /dev
/dev/ad8s3e     496M       1.0M     455M         0%      /tmp
/dev/ad8s3f      89G        29G      53G        35%      /usr
/dev/ad8s3d     2.9G       776M     1.9G        29%      /var
/dev/ad8s5      500G       224G     276G        45%      /Data
```

fstab

```
Device                Mountpoint      FStype  Options Dump Pass#
/dev/ad8s3b           none            swap    sw      0    0
/dev/ad8s3a           /               ufs     rw      1    1
/dev/ad8s3e           /tmp            ufs     rw      2    2
/dev/ad8s3f           /usr            ufs     rw      2    2
/dev/ad8s3d           /var            ufs     rw      2    2
/dev/ad8s5            /Data           ntfs    rw      2    2
/dev/acd0             /cdrom          cd9660  ro,noauto 0    0
```


----------



## sixtydoses (Dec 9, 2009)

SeaHag said:
			
		

> So you're saying there are two supfiles, one for ports and one for source?



Yes. But as DutchDaemon had mentioned earlier, leave the csup for ports since you're already using portsnap.

Wrt your / space being full, I remember having the same issue couple of years back, but that was completely my bad as I wrongly symlinked one of my data directory to a directory in / (I forgot I was root and I used the `~` instead of /home/user/). Might wanna check the content of your /.


----------



## SeaHag (Dec 9, 2009)

How can I check /? When I go to / and run du -h it shows everything on the entire system.


----------



## phoenix (Dec 10, 2009)

Read the man page: du()
Note the *-d* option.  
[cmd=]du -d 1[/cmd]


----------



## SeaHag (Dec 10, 2009)

phoenix said:
			
		

> Read the man page: du()
> Note the *-d* option.
> [cmd=]du -d 1[/cmd]



du -hd1 outputs;


```
2.0K   ./.snap
2.5K   ./dev
1.0M   ./tmp
 29G   ./usr
776M   ./var
1.7M   ./etc
2.0K   ./cdrom
1.1M   ./bin
392M   ./boot
7.4M   ./lib
274K   ./libexec
2.0K   ./proc
4.0K   ./mnt
2.0K   ./proc
4.3M   ./rescue
 84M   ./root
4.4M   ./sbin
2.0K   ./Data
 30G   .
```

How can I tell from this why / is full?


----------



## DutchDaemon (Dec 10, 2009)

Try [cmd=]du -x -d 1 /[/cmd], or for more detail [cmd=]du -x -d 2 /[/cmd], etc. By using -x you stay inside the / filesystem.


----------



## SeaHag (Dec 10, 2009)

DutchDaemon said:
			
		

> Try [cmd=]du -x -d 1 /[/cmd], or for more detail [cmd=]du -x -d 2 /[/cmd], etc. By using -x you stay inside the / filesystem.



du -x -d 1 / shows the same list as above. Does that mean /boot is within /? /boot seems to have a lot in it.

du -x -d1 -h /boot/ shows;


```
24K   /boot/defaults
2.0K   /boot/firmware
199M   /boot/kernel
2.0K   /boot/modules
2.0K   /boot/zfs
233M   /boot/kernel.old
433M   /boot/
```

I looks like /boot/kernel and /boot/kernel.old are taking up the space. Can/should I delete /boot/kernel.old?


----------



## DutchDaemon (Dec 10, 2009)

The -h flag actually adds confusion. Leave it out, and ignore everything sized 0-2 (those are mostly mountpoints and/or empty directories). Anything bigger is inside /. And yes, /boot is inside /, or the system couldn't boot ..


----------



## SeaHag (Dec 10, 2009)

Ok but what should I do to free up space? First I tried the bianry upgrade method but that didn't work so now I'm trying the source method. Is any of this left over maybe from the binary method that can be deleted?


----------



## DutchDaemon (Dec 10, 2009)

Your /boot/ directory is exceptionally big. A regular /boot/kernel or /boot/kernel.old is about 35-40 MB big. If your current kernel is running well, you can delete /boot/kernel.old/. This might free up enough space for the current kernel to be copied. If /boot/kernel is full of files with 'symbol' in their names, those can be deleted as well (with due care, of course, don't delete the kernel itself or the modules (*.ko).


----------



## SeaHag (Dec 10, 2009)

I freed up some space but when I run make installworld I now get this message;


```
===> share/info (install)
===> lib (install)
===> lib/csu/amd64 (install)
install -o root -g wheel -m 444 crt1.o crti.o crtn.o gcrt1.o /usr/lib
install:No such file or directory
*** Error code 1

Stop in /usr/src/lib/csu/amd64.
*** Error code 1

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

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

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

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

Stop in /usr/src.
```

What file or directory can't it find? I've tried the binary upgrade method and by source but neither one worked. I'm unable to upgrade my system from 7.2 to 8.0


----------



## DutchDaemon (Dec 10, 2009)

I think you'd better start over, using this as a template.


----------



## SeaHag (Dec 11, 2009)

Ok that worked better. I got all the way thru upgrading ports but when I ran startx I got this;


```
/libexec/ld-elf.so.1: Shared object "libz.so.4" not found, required by "X".
```

I installed misc/compat7x then that took care of that. Now all I have to so is get my mouse working in X.


----------



## DutchDaemon (Dec 11, 2009)

Sticky: http://forums.freebsd.org/showthread.php?t=4224


----------



## SeaHag (Dec 11, 2009)

I got the mouse working in X by adding the following;


```
Section "ServerFlags"
 Option "AutoAddDevices"  "false"
EndSection
```

So now everything seems to work. I'm posting this from my new 8.0 box. Thanks for all the help everyone.


----------



## riot_dd (Dec 11, 2009)

You have probaly build your kernel with debug messages and symbols which blows the kernel to the size you see, if you remove/comment out the line
 makeoptions      DEBUG=-g     # Build kernel with gdb(1) debug symbols
in the GENERIC config file or in your own then your kernel shouldn't take
more than 40MB of space.


----------

