# ezjail on RasPi



## photor-freebsd (Jan 20, 2017)

Hello Forum,

I am getting more and more familiar with FreeBSD 11 on my RasPi 2 Model B. Next step would be to use jails. Is this possible or is the RasPi tooo weak for this? 

Some years ago I used `ezjail` to manage and administrate jails - but this was on a regular PC. I have discovered sysutils/ezjail in the ports tree and installaltion seems to work. Has anyone experiance on RasPi?

Thank you,

Photor

PS: some info about the RasPi installation:

Raspberry Pi 2 Model B; 1 GB RAM; 900MHz quad-core ARM Cortex-A7 CPU


```
$ uname -a
FreeBSD riker.mydomain.home 11.0-STABLE FreeBSD 11.0-STABLE #0 r310703: Fri Dec 30 11:53:18 CET 2016     root@riker.mydomain.home:/usr/obj/usr/src/sys/RPI2  arm
```



```
$ df -h
Filesystem                Size    Used   Avail Capacity  Mounted on
/dev/ufs/rootfs            29G     10G     16G    39%    /
devfs                     1.0K    1.0K      0B   100%    /dev
/dev/msdosfs/MSDOSBOOT     50M    7.4M     43M    15%    /boot/msdos
tmpfs                      50M    4.0K     50M     0%    /tmp
```


----------



## Phishfry (Jan 21, 2017)

photor-freebsd said:


> Is this possible or is the RasPi tooo weak for this?


I don't think it's to weak but it depends on what you run in your jail.

https://forums.freebsd.org/threads/54526/

I know from your prior posts you successfully ran buildworld natively so running the release scripts should be easy.
Checkout /usr/src/release/arm/RPI2.conf This looks to build the ISO so you might need to change it.
Probably include this line=YES from the prototype file release.conf.sample
`#WITH_COMPRESSED_IMAGES=`

On a RaspberryPi 3 the ARM64 port has the base.txz file available via ftp.


----------



## photor-freebsd (Jan 21, 2017)

Thank you Phishfry,

so, I will test it  I'll come back with questions - or with success.

The jail(s) are intended to run a small internal web server (nginx) and a git server. Both will usually see small traffic. 

Ciao,

Photor


----------



## Phishfry (Jan 22, 2017)

I may have given you wrong information. I looked very hard at release(7) and think that
_WITH_*_*_COMPRESSED_*_*_IMAGES_ applies to the installation image and does not create base.txz

It looks like this is a know issue.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211868

Maybe use another mechanism for jails. I see them built on NAS4Free Arm by hand.
http://forums.nas4free.org/viewtopic.php?t=10273
http://forums.nas4free.org/viewtopic.php?t=10224


----------



## photor-freebsd (Jan 25, 2017)

hello forum,

I am coming back with questions. I have tried to create jails with `ezjail-admin`. I have done `make buildworld`, ... `make installworld` before all - so the upgraded system is running. I was following the handbook https://www.freebsd.org/doc/de_DE.ISO8859-1/books/handbook/jails-ezjail.html.

```
root@riker:~ # ezjail-admin update -i -p
...
===> gnu/usr.bin/gdb/gdb (install)
install  -s -o root -g wheel -m 555   gdb /usr/local/jails/fulljail/usr/bin/gdb
install  -o root -g wheel -m 444  gdb.debug /usr/local/jails/fulljail/usr/lib/debug/usr/bin/gdb.debug
install  -o root -g wheel -m 444 gdb.1.gz  /usr/local/jails/fulljail/usr/share/man/man1/
===> gnu/usr.bin/gdb/gdbtui (install)
install  -s -o root -g wheel -m 555   gdbtui /usr/local/jails/fulljail/usr/bin/gdbtui
install  -o root -g wheel -m 444  gdbtui.debug /usr/local/jails/fulljail/usr/lib/debug/usr/bin/gdbtui.debug
===> gnu/usr.bin/gdb/kgdb (install)
install  -s -o root -g wheel -m 555   kgdb /usr/local/jails/fulljail/usr/bin/kgdb
strip: elf_update() failed: I/O error: No space left on device
install: strip command strip failed on /usr/local/jails/fulljail/usr/bin/kgdb
*** Error code 70

Stop.
make[7]: stopped in /usr/src/gnu/usr.bin/gdb/kgdb
*** Error code 1

Stop.
make[6]: stopped in /usr/src/gnu/usr.bin/gdb
*** Error code 1

Stop.
make[5]: stopped in /usr/src/gnu/usr.bin
*** Error code 1

Stop.
make[4]: stopped in /usr/src/gnu
*** Error code 1

Stop.
make[3]: stopped in /usr/src
*** Error code 1

Stop.
make[2]: stopped in /usr/src
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src
Error: The command 'make installworld' failed.
  Refer to the error report(s) above.
root@riker:~ #
```
Seems that the disk is full - but it seems it is not! This occures at the stage `ezjail` is creating fulljail-tree.

```
[photor@riker ~]$ df -ih
Filesystem                Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/ufs/rootfs            29G    9.7G     17G    37%    595k  3.3M   15%   /
devfs                     1.0K    1.0K      0B   100%       0     0  100%   /dev
/dev/msdosfs/MSDOSBOOT     50M    7.4M     43M    15%     512     0  100%   /boot/msdos
tmpfs                     100M     34M     66M    34%    1.4k  485k    0%   /tmp
```
I have added `-i`-option to get information about inodes. But even these are not tight - as I think.

What have I overlooked? Is something missing? Or, is it even not possible to use/create jails on RasPi?

Ciao,

Photor


----------



## acheron (Jan 26, 2017)

/tmp is probably not large enough.


----------



## photor-freebsd (Jan 26, 2017)

Thank you acheron. 

That was my first thought, too. I have already doubled it. And I have had a look on if with `df -hi` during `ezjail-admin`-run. But maybe that is too slow.

Maybe I'll give it a try and enlarge it. I WANT to have jails running on that little piece of hardware - if possible.

Ciao,

Photor


----------



## photor-freebsd (Jan 26, 2017)

Short response: I tried with 300 MB /tmp and the process ended with same error message - but at `install -s -o root -g wheel -m 555 clang /usr/local/jails/fulljail/usr/bin/clang` - means later. So, size of /tmp seems to be a factor.

But, I have no idea, what value would help . Any suggestion is welcome.

Another observation (not necessarily connected) : the Raspi sometimes seems to "freeze" for a while; even login via `ssh` is waiting several seconds/minutes.

Ciao,

Photor (a little bit frustrated)


----------



## ASX (Jan 26, 2017)

photor-freebsd said:


> But, I have no idea, what value would help . Any suggestion is welcome.


I would suggest to avoid the use a separate /tmp for the time of building, let /tmp use the space on / filesystem.


----------



## acheron (Jan 28, 2017)

clang needs a lot of space, try with a 2GB /tmp on a separate disk.


----------



## photor-freebsd (Jan 30, 2017)

acheron said:


> clang needs a lot of space, try with a 2GB /tmp on a separate disk.



Can I do this temporalily e.g. by defining another TMPDIR just for the `ezjail-admin`-run? I already thought about something like this but I don't want add this permanently to the system (it would block an USB-slot for a /tmp which is usually not needed in that size).

Ciao,

Photor


----------



## photor-freebsd (Feb 3, 2017)

I found some time to try again: it looks like it is running now (`ezjail-admin` is fetching ports-tree which takes a time due to the slow connection at the moment - have to find out, why it does not use the one in host-system). 

I did the following:

```
# setenv TMPDIR /var/tmp
# ezjail-admin update -i -p
```
From what I have observed, the `ezjail-admin`-run needs around 400 MB.

Ciao,

Photor


----------

