# How to upgrade a jail?



## bryn1u (Sep 17, 2013)

Hey,

I have been reading about upgrading jails under FreeBSD. I saw many ideas but none of them helped me. I made a jail using wget, downloaded base.txz and then did `tar -jxvf` in /usr/jail. The jail works very well but I don't know how to upgrade. Using freebsd-update doesn't work. By using svn, have I always had to use svn and compile world? Is there any easy way to upgrade? I don't use ezjail, qjail or something else. Can someone can help me?

P.S.
I found this but I don't understand. Where is `make buildworld`, where is `make distribution`? How to patch sources?

```
# cd /usr/src
# make installworld DESTDIR=$JAIL
# mergemaster -i -C -D $JAIL
```


----------



## SirDice (Sep 17, 2013)

bryn1u said:
			
		

> I found this but I don't understand. Where is `make buildworld`, where is `make distribution`? How to patch sources? ehhhh
> 
> ```
> # cd /usr/src
> ...


It assumes you already have a completed buildworld in /usr/src/. Other than the DESTDIR variable and the -D option it works just like updating the host system.


----------



## bryn1u (Sep 17, 2013)

After I use Subversion to download sources to /usr/src, [size=-1]have I always[/size] do I always have to use `make buildworld`, installworld and distribution to upgrade a jail?


----------



## SirDice (Sep 17, 2013)

`make distribution` is only done once, when you install the jail for the first time. But yes, if you want to use a source upgrade you'll have to do the buildworld, installworld and mergemaster dance.


----------



## bryn1u (Sep 17, 2013)

Thank you. Now I know almost everything what I was looking for. Last question. I'm using FreeBSD 9.1-RELEASE in the jail, how can I use Subversion to download the same source as I'm using in the jail?

```
svn co svn://svn.freebsd.org/base/releng/9.1/
```
Is it correct?


----------



## DutchDaemon (Sep 17, 2013)

bryn1u said:
			
		

> Is there any easy way to upgrade? I don't use ezjail, qjail or something else



It begs the question: why not?


----------



## SirDice (Sep 17, 2013)

bryn1u said:
			
		

> ```
> svn co svn://svn.freebsd.org/base/releng/9.1/
> ```
> Is it correct ?


Almost. It needs a directory where to store it: `svn co [url=svn://svn.freebsd.org/base/releng/9.1/]svn://svn.freebsd.org/base/releng/9.1/[/url] /usr/src/`

Note that this only works if the directory is empty. If you ran the command previously you can update the source tree with `svn update /usr/src/`.


----------



## bryn1u (Sep 17, 2013)

Tell me if I'm wrong. When I use `svn update /usr/src` I need to do a `make buildworld` and `make installworld DESTDIR=/path/to/jail`? Is this a good way to upgrade a jail?


----------



## SirDice (Sep 17, 2013)

bryn1u said:
			
		

> Is this good way to upgrade jail?



Don't forget to run mergemaster(8).


----------



## bryn1u (Sep 18, 2013)

Thank you. Anyway I'm gonna going to try ezjail


----------



## bryn1u (Sep 19, 2013)

I hate it. 


```
root@ks3360102:/usr/src # make buildworld | less
--------------------------------------------------------------
>>> World build started on Thu Sep 19 08:21:12 CEST 2013
--------------------------------------------------------------

--------------------------------------------------------------
>>> Rebuilding the temporary build tree
--------------------------------------------------------------
rm -rf /usr/obj/usr/src/tmp
rm -rf /usr/obj/usr/src/lib32
mkdir -p /usr/obj/usr/src/tmp/lib
mkdir -p /usr/obj/usr/src/tmp/usr
mkdir -p /usr/obj/usr/src/tmp/legacy/usr
mtree -deU -f /usr/src/etc/mtree/BSD.usr.dist  -p /usr/obj/usr/src/tmp/legacy/usr >/dev/null
mtree -deU -f /usr/src/etc/mtree/BSD.groff.dist  -p /usr/obj/usr/src/tmp/legacy/usr >/dev/null
mtree -deU -f /usr/src/etc/mtree/BSD.usr.dist  -p /usr/obj/usr/src/tmp/usr >/dev/null
mtree -deU -f /usr/src/etc/mtree/BSD.include.dist  -p /usr/obj/usr/src/tmp/usr/include >/dev/null
ln -sf /usr/src/sys /usr/obj/usr/src/tmp

--------------------------------------------------------------
>>> stage 1.1: legacy release compatibility shims
--------------------------------------------------------------
cd /usr/src; MAKEOBJDIRPREFIX=/usr/obj/usr/src/tmp  INSTALL="sh /usr/src/tools/install.sh"  PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/src/tmp  VERSION="FreeBSD 9.1-RELEASE-p7 amd64 901000"  MAKEFLAGS="-m /usr/src/tools/build/mk  -m /usr/src/share/mk TARGET=amd64 TARGET_ARCH=amd64" make -f Makefile.inc1  DESTDIR=  BOOTSTRAPPING=901000  SSP_CFLAGS=  -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN  -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED  -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD legacy
===> tools/build (obj,includes,depend,all,install)
/usr/obj/usr/src/tmp/usr/src/tools/build created for /usr/src/tools/build
cd /usr/src/tools/build; make buildincludes; make installincludes
rm -f .depend
mkdep -f .depend -a    -I/usr/obj/usr/src/tmp/legacy/usr/include /usr/src/tools/build/dummy.c
cc  -fstack-protector-all -std=gnu99   -I/usr/obj/usr/src/tmp/legacy/usr/include -c /usr/src/tools/build/dummy.c -o dummy.o
building static egacy library
ranlib libegacy.a
sh /usr/src/tools/install.sh -C -o root -g wheel -m 444   libegacy.a /usr/obj/usr/src/tmp/legacy/usr/lib

--------------------------------------------------------------
>>> stage 1.2: bootstrap tools
--------------------------------------------------------------
cd /usr/src; MAKEOBJDIRPREFIX=/usr/obj/usr/src/tmp  INSTALL="sh /usr/src/tools/install.sh"  PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/src/tmp  VERSION="FreeBSD 9.1-RELEASE-p7 amd64 901000"  MAKEFLAGS="-m /usr/src/tools/build/mk  -m /usr/src/share/mk TARGET=amd64 TARGET_ARCH=amd64" make -f Makefile.inc1  DESTDIR=  BOOTSTRAPPING=901000  SSP_CFLAGS=  -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN  -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED  -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD bootstrap-tools
===> lib/clang/libllvmsupport (obj,depend,all,install)
/usr/obj/usr/src/tmp/usr/src/lib/clang/libllvmsupport created for /usr/src/lib/clang/libllvmsupport
rm -f .depend
mkdep -f .depend -a    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I. -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_DEFAULT_TARGET_TRIPLE=\"x86_64-unknown-freebsd9.0\" -DDEFAULT_SYSROOT=\"\" -I/usr/obj/usr/src/tmp/legacy/usr/include /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regcomp.c /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regerror.c /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regexec.c /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regfree.c /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regstrlcpy.c
mkdep -f .depend -a        /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Triple.cpp:14:40: error: llvm/Support/ErrorHandling.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Twine.cpp:10:28: error: llvm/ADT/Twine.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Twine.cpp:11:34: error: llvm/ADT/SmallString.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Twine.cpp:12:32: error: llvm/Support/Debug.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Twine.cpp:13:38: error: llvm/Support/raw_ostream.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Valgrind.cpp:16:35: error: llvm/Support/Valgrind.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Valgrind.cpp:17:32: error: llvm/Config/config.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/circular_raw_ostream.cpp:14:47: error: llvm/Support/circular_raw_ostream.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_os_ostream.cpp:14:41: error: llvm/Support/raw_os_ostream.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:14:38: error: llvm/Support/raw_ostream.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:15:33: error: llvm/Support/Format.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:16:34: error: llvm/Support/Program.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:17:34: error: llvm/Support/Process.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:18:35: error: llvm/ADT/StringExtras.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:19:34: error: llvm/ADT/SmallVector.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:20:32: error: llvm/Config/config.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:21:35: error: llvm/Support/Compiler.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:22:40: error: llvm/Support/ErrorHandling.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:23:39: error: llvm/Support/system_error.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp:24:32: error: llvm/ADT/STLExtras.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/system_error.cpp:14:39: error: llvm/Support/system_error.h: No such file or directory
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/system_error.cpp:15:32: error: llvm/Support/Errno.h: No such file or directory
mkdep: compile failed
clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringPool.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringRef.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/TargetRegistry.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ThreadLocal.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Threading.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/TimeValue.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Timer.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ToolOutputFile.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Triple.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Twine.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Valgrind.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/circular_raw_ostream.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_os_ostream.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/system_error.cpp
*** [.depend] Error code 1

Stop in /usr/src/lib/clang/libllvmsupport.
*** [bootstrap-tools] Error code 1

Stop in /usr/src.
*** [_bootstrap-tools] Error code 1

Stop in /usr/src.
*** [buildworld] Error code 1

Stop in /usr/src.
```


1) I used svn as in your post.
2) Then I did `make buildworld` and am getting these errors all the time.
What's wrong?


----------

