# Jails - How can I install succesfully packages over Ports?



## bsus (Jul 19, 2011)

Hi, I used the handbook to create some jails. On one I want to set up a FAMP server.

Unforunatly there are still problems installing software. I changed under /etc/fstab the mode for the jails from ro to rw so that I can edit/create/remove things. Now I still need a internet connection or better the jail needs access to the internet to get the required packages.


```
famp# cd /usr/ports/shells/bash
famp# make install clean
===>  Vulnerability check disabled, database not found
===>  License check disabled, port has not defined LICENSE
=> bash-4.1.tar.gz doesn't seem to exist in /usr/ports/distfiles/bash.
=> Attempting to fetch http://ftp.gnu.org/gnu/bash/bash-4.1.tar.gz
fetch: http://ftp.gnu.org/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.gnu.org/gnu/bash/bash-4.1.tar.gz
fetch: ftp://ftp.gnu.org/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch http://www.gtlib.cc.gatech.edu/pub/gnu/gnu/bash/bash-4.1.tar.gz
fetch: http://www.gtlib.cc.gatech.edu/pub/gnu/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch http://mirrors.usc.edu/pub/gnu/bash/bash-4.1.tar.gz
fetch: http://mirrors.usc.edu/pub/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.kddlabs.co.jp/GNU/bash/bash-4.1.tar.gz
fetch: ftp://ftp.kddlabs.co.jp/GNU/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.dti.ad.jp/pub/GNU/bash/bash-4.1.tar.gz
fetch: ftp://ftp.dti.ad.jp/pub/GNU/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch http://ring.nict.go.jp/archives/GNU/bash/bash-4.1.tar.gz
fetch: http://ring.nict.go.jp/archives/GNU/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch http://ring.riken.jp/archives/GNU/bash/bash-4.1.tar.gz
fetch: http://ring.riken.jp/archives/GNU/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.mirrorservice.org/sites/ftp.gnu.org/gnu/bash/bash-4.1.tar.gz
fetch: ftp://ftp.mirrorservice.org/sites/ftp.gnu.org/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.sunsite.org.uk/package/gnu/bash/bash-4.1.tar.gz
fetch: ftp://ftp.sunsite.org.uk/package/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.informatik.hu-berlin.de/pub/gnu/gnu/bash/bash-4.1.tar.gz
fetch: ftp://ftp.informatik.hu-berlin.de/pub/gnu/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.informatik.rwth-aachen.de/pub/mirror/ftp.gnu.org/pub/gnu/bash/bash-4.1.tar.gz
fetch: ftp://ftp.informatik.rwth-aachen.de/pub/mirror/ftp.gnu.org/pub/gnu/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch http://ftp.funet.fi/pub/gnu/prep/bash/bash-4.1.tar.gz
fetch: http://ftp.funet.fi/pub/gnu/prep/bash/bash-4.1.tar.gz: No address record
=> Attempting to fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/bash/bash-4.1.tar.gz
fetch: ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/bash/bash-4.1.tar.gz: No address record
=> Couldn't fetch it - please try to retrieve this
=> port manually into /usr/ports/distfiles/bash and try again.
*** Error code 1

Stop in /usr/ports/shells/bash.
famp# ping -c4 www.freebsd.org
ping: cannot resolve www.freebsd.org: Host name lookup failure
```


----------



## Nukama (Jul 19, 2011)

What says your /etc/resolv.conf() inside the jail? Nameservers aren't there for nothing. How did you configured the network?


----------



## bsus (Jul 19, 2011)

Hi, the resolv.conf is emtpy.
I need dhcpclient to get an ip but I can't install without inet

Regards


----------



## bsus (Jul 20, 2011)

```
cat /etc/rc.conf
# jails
jail_enable="YES"
jail_set_hostname_allow="NO"
jail_list="famp"
#jail_list="test www famp"
#jail_test_hostname="test.fritz.box"
#jail_test_ip="192.168.178.61"
#jail_test_rootdir="/usr/home/j/test"
#jail_test_devfs_enable="YES"
#jail_www_hostname="www.fritz.box"
#jail_www_ip="192.168.178.62"
#jail_www_rootdir="/usr/home/j/www"
#jail_www_devfs_enable="YES"
jail_famp_hostname="famp.fritz.box"
jail_famp_ip="192.168.178.63"
jail_famp_rootdir="/usr/home/j/famp"
jail_famp_devfs_enable="YES"
```


```
cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
```

Network is configurable over static and dhcp for test use I mostly use dhcp.
For the jails I would like to stay at the basic I am not the best friend of administrations tools.


```
ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
	ether bc:ae:c5:70:76:64
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
```

Regards


----------



## SirDice (Jul 20, 2011)

`# cp /etc/resolv.conf /usr/home/j/famp/etc/`

Assuming name resolving actually works on the host.


----------



## bsus (Jul 20, 2011)

Ok, copied the resolv.conf
But still now inetaccess..

Could this be because I gave the jail another ip as the host running it?

Regards


----------



## Nukama (Jul 20, 2011)

Use static IP address on your host, and alias it with at least the IP address you use in your famp jail.

/etc/rc.conf on host:

```
ifconfig_re0="inet 192.168.178.60/24"
ipv4_addrs_re0="192.168.178.61-64/32"
defaultrouter="192.168.178.1"
```


----------



## SirDice (Jul 20, 2011)

bsus said:
			
		

> Could this be because I gave the jail another ip as the host running it?


The jail _must_ have a different IP address. But looking at your output your jail currently has *no* IP address. Fix that first.


----------



## bsus (Jul 20, 2011)

hmm I already defined an ip to the jail in the rc.conf of the host


```
cat /etc/rc.conf
# jails
jail_enable="YES"
jail_set_hostname_allow="NO"
jail_list="famp"
#jail_list="test www famp"
#jail_test_hostname="test.fritz.box"
#jail_test_ip="192.168.178.61"
#jail_test_rootdir="/usr/home/j/test"
#jail_test_devfs_enable="YES"
#jail_www_hostname="www.fritz.box"
#jail_www_ip="192.168.178.62"
#jail_www_rootdir="/usr/home/j/www"
#jail_www_devfs_enable="YES"
jail_famp_hostname="famp.fritz.box"
jail_famp_ip="192.168.178.63"
jail_famp_rootdir="/usr/home/j/famp"
jail_famp_devfs_enable="YES"
```


----------



## SirDice (Jul 20, 2011)

Yes, but the end of post #4 shows it has no IP address.


----------



## bsus (Jul 20, 2011)

hmm, yeah sure I see this too.
But what can I do to fix this?


----------



## SirDice (Jul 20, 2011)

Stop and start the jail and look for errors in /var/log/messages.


----------



## bsus (Jul 20, 2011)

```
cat jail_famp_console.log
Creating and/or trimming log files.
Starting syslogd.
syslogd: child pid 19545 exited with return code 1
/etc/rc: WARNING: failed to start syslogd
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
Clearing /tmp (X related).
Updating motd:.
Starting cron.

Tue Jul 19 14:05:32 UTC 2011
```

Ah seems that theres a problem with mounting devfs


```
Jul 18 13:21:08 freebsd admin: /etc/rc.d/jail: WARNING: devfs_domount(): Unable to mount devfs on /usr/home/j/test/dev
Jul 18 13:21:08 freebsd admin: /etc/rc.d/jail: WARNING: devfs_mount_jail: devfs was not mounted on /usr/home/j/test/dev
Jul 18 13:21:08 freebsd admin: /etc/rc.d/jail: WARNING: devfs_domount(): Unable to mount devfs on /usr/home/j/www/dev
Jul 18 13:21:08 freebsd admin: /etc/rc.d/jail: WARNING: devfs_mount_jail: devfs was not mounted on /usr/home/j/www/dev
Jul 18 13:21:08 freebsd admin: /etc/rc.d/jail: WARNING: devfs_domount(): Unable to mount devfs on /usr/home/j/famp/dev
Jul 18 13:21:08 freebsd admin: /etc/rc.d/jail: WARNING: devfs_mount_jail: devfs was not mounted on /usr/home/j/famp/dev
Jul 18 13:21:58 freebsd admin: /etc/rc.d/jail: WARNING: devfs_domount(): Unable to mount devfs on /usr/home/j/test/dev
Jul 18 13:21:58 freebsd admin: /etc/rc.d/jail: WARNING: devfs_mount_jail: devfs was not mounted on /usr/home/j/test/dev
Jul 18 13:21:58 freebsd admin: /etc/rc.d/jail: WARNING: devfs_domount(): Unable to mount devfs on /usr/home/j/www/dev
Jul 18 13:21:58 freebsd admin: /etc/rc.d/jail: WARNING: devfs_mount_jail: devfs was not mounted on /usr/home/j/www/dev
Jul 18 13:21:58 freebsd admin: /etc/rc.d/jail: WARNING: devfs_domount(): Unable to mount devfs on /usr/home/j/famp/dev
Jul 18 13:21:58 freebsd admin: /etc/rc.d/jail: WARNING: devfs_mount_jail: devfs was not mounted on /usr/home/j/famp/dev
```


----------



## fbsd1 (Jul 20, 2011)

Creating jails using the manual method by hand is very complicated and full of pitfalls.  I strongly recommend you use the qjail port for your jail environment.


----------

