# Possible to use freebsd-update to update Jails?



## Sephiroth (Oct 8, 2010)

I have a box with jails setup as per the handbook, with a read-only section shared by multiple jails. Updates are kind of a pain in the butt, since I have to sync the source tree with cvsup, buildworld, installworld, and then run mergemaster in each jail. It takes a long time, and I have to date been unable to make it all the way through a build/installworld without it failing somewhere (usually I need to make a directory in some random spot, never sure why). Anyway, is there a way to leverage freebsd-update to keep the jails patched? Maybe mount the read only section read-write (even temporarily)?

I wrote a script that automates the upgrade instructions from the handbook, but being as build/installworld always seem to run into random problems the script has been a mixed blessing at best.

I should probably have gone ezjail in the first place, but I really thought keeping with the handbook would pay dividends somewhere along the line.

Thanks for any help!


----------



## DutchDaemon (Oct 9, 2010)

mergemaster(8) should not take more than a minute when run with the right flags (like e.g. -U -i). If you run it without flags you'll have to hit 'install' a couple of hundred times, yeah ..


----------



## danger@ (Oct 9, 2010)

also -F is worth mentioning.


----------



## plamaiziere (Oct 9, 2010)

Sephiroth said:
			
		

> I have a box with jails setup as per the handbook, with a read-only section shared by multiple jails. Updates are kind of a pain in the butt, since I have to sync the source tree with cvsup, buildworld, installworld, and then run mergemaster in each jail. It takes a long time, and I have to date been unable to make it all the way through a build/installworld without it failing somewhere (usually I need to make a directory in some random spot, never sure why).



That should not fail, are you trying to installworld or mergemaster from the jail? You have to do this from the main host using DESTDIR for make installworld and -D for mergemaster.



> Anyway, is there a way to leverage freebsd-update to keep the jails patched?



I do not use freebsd-update but I ve already asked for this :
http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2007-05/msg00328.html


----------



## Sephiroth (Oct 9, 2010)

Thanks for the tips on Mergemaster, hitting install a million times was indeed the issue. I had googled this before posting but had not found your post, sounds like it might work!

My source is definately not compiling. I just did another cvsup on the main box, not trying to build in a jail, then did make cleanworld and make buildworld. It's failing an hour or so later while building sendmail:

```
===> etc/sendmail (all)
find: /usr/src/s/etc/sendmail/../../contrib/sendmail/cf: No such file or directory
"/usr/src/s/etc/sendmail/Makefile", line 14: warning: "find /usr/src/s/etc/sendmail/../../contrib/sendmail/cf -type f -name '*.m4' -print" 
returned non-zero status
rm -f freebsd.cf
m4 -D_CF_DIR_=/usr/src/s/etc/sendmail/../../contrib/sendmail/cf/   /usr/src/s/etc/sendmail/../../contrib/sendmail/cf/m4/cf.m4 
/usr/src/s/etc/sendmail/freebsd.mc > freebsd.cf
m4: /usr/src/s/etc/sendmail/../../contrib/sendmail/cf/m4/cf.m4: No such file or directory
*** Error code 1

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

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

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

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

Stop in /usr/src.
```


----------



## anomie (Oct 13, 2010)

@Sephiroth: could you post your supfile?


----------



## Sephiroth (Oct 13, 2010)

Sure. I just used the one from the examples folder and modified it to the cvsup10 mirror, although I can't remember if there was a hard and fast reason for that choice.


```
# $FreeBSD: src/share/examples/cvsup/standard-supfile,v 1.25.4.2.2.2 2009/11/09 23:57:40 kensmith Exp $
#
# This file contains all of the "CVSup collections" that make up the
# FreeBSD-current source tree.
#
# CVSup (CVS Update Protocol) allows you to download the latest CVS
# tree (or any branch of development therefrom) to your system easily
# and efficiently (far more so than with sup, which CVSup is aimed
# at replacing).  If you're running CVSup interactively, and are
# currently using an X display server, you should run CVSup as follows
# to keep your CVS tree up-to-date:
#
#       cvsup standard-supfile
#
# If not running X, or invoking cvsup from a non-interactive script, then
# run it as follows:
#
#       cvsup -g -L 2 standard-supfile
#
# You may wish to change some of the settings in this file to better
# suit your system:
#
# host=CHANGE_THIS.FreeBSD.org
#               This specifies the server host which will supply the
#               file updates.  You must change it to one of the CVSup
#               mirror sites listed in the FreeBSD Handbook at
#               [url]http://www.freebsd.org/doc/handbook/mirrors.html[/url].
#               You can override this setting on the command line
#               with cvsup's "-h host" option.
#
# base=/var/db
#               This specifies the root where CVSup will store information
#               about the collections you have transferred to your system.
#               A setting of "/var/db" will generate this information in
#               /var/db/sup.  You can override the "base" setting on the
#               command line with cvsup's "-b base" option.  This directory
#               must exist in order to run CVSup.
#
# prefix=/usr
#               This specifies where to place the requested files.  A
#               setting of "/usr" will place all of the files requested
#               in "/usr/src" (e.g., "/usr/src/bin", "/usr/src/lib").
#               The prefix directory must exist in order to run CVSup.

# Defaults that apply to all the collections
#
# IMPORTANT: Change the next line to use one of the CVSup mirror sites
# listed at [url]http://www.freebsd.org/doc/handbook/mirrors.html[/url].
*default host=cvsup10.us.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_8_0
*default delete use-rel-suffix

# If you seem to be limited by CPU rather than network or disk bandwidth, try
# commenting out the following line.  (Normally, today's CPUs are fast enough
# that you want to run compression.)
*default compress

## Main Source Tree.
#
# The easiest way to get the main source tree is to use the "src-all"
# mega-collection.  It includes all of the individual "src-*" collections.
src-all

# These are the individual collections that make up "src-all".  If you
# use these, be sure to comment out "src-all" above.
#src-base
#src-bin
#src-cddl
#src-contrib
#src-etc
#src-games
#src-gnu
#src-include
#src-kerberos5
#src-kerberosIV
#src-lib
#src-libexec
#src-release
#src-rescue
#src-sbin
#src-share
#src-sys
#src-tools
#src-usrbin
#src-usrsbin
# These are the individual collections that make up FreeBSD's crypto
# collection. They are no longer export-restricted and are a part of
# src-all
#src-crypto
#src-eBones
#src-secure
#src-sys-crypto
```


----------



## anomie (Oct 13, 2010)

That supfile should be fine. What have you specified in /etc/make.conf?


----------



## Sephiroth (Oct 17, 2010)

All I have in the base server's /etc/make.conf is this:


```
# added by use.perl 2010-08-01 21:38:00
PERL_VERSION=5.8.9
```


----------

