# Updating in FreeBSD



## bsus (Jan 17, 2012)

Hi,

I WÃ¼rfels love FreeBSD in Server use. It is perfectly Former and thought but I didn't found till know the right solution for updating.

There are five sections to update:
1. Upgrade to next Release (I would keep this manuelly)
2. Security updates (freebsd-install @cron daily)
3. Sources /src (cvsup or svn?)
4. Portstree (to keep the Makefiles uptodate)
5. Compiled Software (Samba..., everything Compiled from Ports)
(6. Jails)

I thought of following updating period:
1. Manuelly
2. Daily
3. Every Second month(?)
4. Every month
5. Right After four

Are my thoughts till know correct?
How so I Update jails best?
Which Tools are Reformland to Update 3 4 and 5?

Regards


----------



## SirDice (Jan 17, 2012)

[thread=26140]HOWTO: keeping FreeBSD's base system and packages up-to-date[/thread]


----------



## bsus (Jan 18, 2012)

Hi,

thank you for the link 

I am hanging at a certain point in the howto.

I don't know where I should save following functions.

I copied them into /etc/profile but they are still not available...

```
function ports-check {
  # FETCH LATEST PORTS TREE
  sudo portsnap fetch update

  # CHECK WHAT NEW VERSIONS EXIST
  sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }'

  # CHECK SECURITY ISSUES
  sudo portaudit -Fda

  # CHECK /usr/ports/UPDATING MESSAGES
  pkg_updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' )
}
```


----------



## kpa (Jan 18, 2012)

May I interest you in a script by DutchDaemon himself 

http://forums.freebsd.org/showpost.php?p=39092&postcount=37

Save that as lets say /usr/local/sbin/portupdater 

And run it interactively like this:

`# portupdater y`

Any argument goes, it just tells the script that it's run interactively.


----------



## bsus (Jan 19, 2012)

> Hi,
> How do I update the base system in STABLE, when there is no freebsd-update?



@kpa
In the past I have used the script to keep my system uptodate but I had certain issues. Is there a "better" solution between the switch to STABLE with some cronjobs or using the portupdater?

Regards


----------



## SirDice (Jan 19, 2012)

bsus said:
			
		

> Hi,
> How do I update the base system in STABLE, when there is no freebsd-update?



By using the source and building world. See build(7).


----------



## bsus (Jan 19, 2012)

So i will have to rebuild the complete Base System when recdibing an Update?

Isnt that a Bad Way when having an older machine


----------



## jb_fvwm2 (Jan 19, 2012)

"Appears a new 2nd  /usr  on the older machine " from which to upgrade.

```
mount -t ufs -o union /dev/da0 /usr #iirc
```
 if  /usr/obj , /usr/src  from a newer machine upon which buildkernel, buildworld have completed, are on /dev/da0 (a thumbdrive, large )  as  /obj /src , if your machine to upgrade is low on disk space and/or speed. ((Pardon typos!), but without knowing how much older the machine to upgrade is, that may be of help.  Used it to upgrade v6 > v9, many errors along the way because of the skipping of v7 v8 probably. Another thread has a post...)
(No experience with jail upgrades yet.)


----------



## SirDice (Jan 19, 2012)

bsus said:
			
		

> So i will have to rebuild the complete Base System when recdibing an Update?


Yes.



> Isnt that a Bad Way when having an older machine


Define 'bad'. I've been doing this since FreeBSD 3.x running on a Pentium 90. Building world took almost a day.

If you have multiple machines you can build kernels and world on a fast machine, then NFS export /usr/src/ and /usr/obj/. Mount them on the target machine and run installworld and installkernel. Those last steps should only take a few minutes.


----------



## bsus (Jan 19, 2012)

Thank you for youre much answers and the hint with compiling on a fast machine.


Is a period of two weeks for rebuilding world recommand?
What about the period of checking new packages?

Regards


----------



## SirDice (Jan 19, 2012)

bsus said:
			
		

> Is a period of two weeks for rebuilding world recommand?


That depends, I usually do it once or twice a month. 



> What about the period of checking new packages?


Usually the same, unless there's a big security issue with something I use.


----------



## bsus (Jan 19, 2012)

What branch do you use for ports/packages RELEASE or STABLE, which one contains later versions?

Regards


----------



## SirDice (Jan 19, 2012)

bsus said:
			
		

> What branch do you use for ports/packages RELEASE or STABLE, which one contains later versions?


There is only one ports tree.


----------



## bsus (Jan 19, 2012)

Hmm I understand the howto in an other way:


> Some facts about being up-to-date with FreeBSD's packages:
> -- with every RELEASE packages are built and then they are never updated, even if they have security issues
> -- for the STABLE tree packages are rebuilt every 2 weeks


ah now I understand... they mean the packages not ports.

So if we summarize:
Base System:
STABLE => rebuild world 1-2 times a month with cvsup (or svn) over src
RELEASE => freebsd-update-install to update binary mode

Ports:
Keep ports-tree uptodate with portsnap
Update compiled software with portmaster, portupgrade, portmanager (which one is recommand?)

Packages:
STABLE => pkg_upgrade (packages are fixed with security issues)
RELEASE => pkg_upgrade (packages are maybe old and not fixed)


Regards


----------



## SirDice (Jan 20, 2012)

bsus said:
			
		

> ah now I understand... they mean the packages not ports.


Yes, spot on.



> So if we summarize:
> Base System:
> STABLE => rebuild world 1-2 times a month with cvsup (or svn) over src
> RELEASE => freebsd-update-install to update binary mode


You can use csup(1) instead of cvsup(1). No need to install anything, csup(1) has been included in the base since 6.3.



> Ports:
> Keep ports-tree uptodate with portsnap
> Update compiled software with portmaster, portupgrade, portmanager (which one is recommand?)


The ports tree can also be updated using csup(1) but portsnap(8) is a little easier to use.



> Packages:
> STABLE => pkg_upgrade (packages are fixed with security issues)
> RELEASE => pkg_upgrade (packages are maybe old and not fixed)


The -RELEASE packages are indeed never updated. The -STABLE packages get built on a regular basis from a current ports tree. So it gets more than just the security updates.


----------



## bsus (Jan 20, 2012)

Thank you for your help!

Now updating is complety clear for me


----------



## SirDice (Jan 20, 2012)

Excellent :beer

It is one of the trickiest things of FreeBSD and something every starter will have some problems with. Especially if they are used to Linux where almost everything is 'part of the OS'.


----------



## bsus (Jan 21, 2012)

Hi,

I now updated sometimes with rebuild world.
While this actions I always had to reconfigure some things after installing the new world (can't handle mergemaster so well).

I think it would be easier for me to switch back to 9.0-RELEASE.

So I will have to load the RELEASE-sources and build the world again, what do I have to change in my csup file for this action?


```
server ~ # cat stable-supfile
*default host=cvsup.de.freebsd.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_9
*default delete use-rel-suffix
*default compress
src-all
```

Regards


----------

