Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Mar 2010 12:06:57 -0500
From:      Jack Carrozzo <jack@crepinc.com>
To:        Baptiste Daroussin <baptiste.daroussin@gmail.com>
Cc:        freebsd-jail@freebsd.org
Subject:   Re: Linux-only jail: yes it is possible
Message-ID:  <2ad0f9f61003030906s27f90f25m6ae6e7f99bed5df@mail.gmail.com>
In-Reply-To: <20100303063757.GA20246@wicklow.lan>
References:  <20100303063757.GA20246@wicklow.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
So you're running a linux 'world' (binaries and dir structure) inside a
jail'd BSD kernel? Or did you do some insane code to somehow run a linux
kernel...

-Jack Carrozzo

On Wed, Mar 3, 2010 at 1:37 AM, Baptiste Daroussin <
baptiste.daroussin@gmail.com> wrote:

> Hi,
>
> I'm new to the list I just want to testify that linux-only jails are
> possible.
>
> I just (a few days ago) managed to have Debian GNU/Linux Lenny in a jail on
> FreeBSD 8-STABLE (last update should be january). It is not perfect but it
> works. For now I've been able to make work ssh, apache, xinetd, cron. The
> only
> tested thing that currently fail is ssysklogd because of tries entries in
> /dev.
>
> Explaination in french are available here:
> http://blog.etoilebsd.net/post/Emprisonner_une_debian_dans_un_FreeBSD
>
> Here is a fast translation:
>
> 1/ Create the jail skeleton:
> # mkdir /home/jails/debian
> # mkdir /home/jails/debian/dev
> # mkdir /home/jails/debian/proc
> # mkdir /home/jails/debian/sys
>
> 2/ Load the linuxulator modules
> # kldload linux
> # kldload linprocfs
> # kldload linsysfs
> # kldload lindev
>
> 3/ Mount the requiered FS
> # mount -t devfs none /home/jails/debian/dev
> # mount -t linprocfs none /home/jails/debian/proc
> # mount -t linsysfs none /home/jails/debian/sys
>
> (note: I'm note sure lindev is important or not)
>
> I use and OpenVZ debian image for my setup because I'm lazy
> 4/ fetch it
> # fetch
> http://download.openvz.org/template/precreated/debian-5.0-x86.tar.gz
>
> 5/ unpack it
> # tar xvfp debian-5.0-x86.tar.gz -C debian --exclude dev* --exclude proc* \
> --exclude sys*
>
> now to be able to start the jail normally we only need one process to run
> (I
> didn't really try to make it persistant with the persist keyword)
>
> To take care of my lasyness, I created a /etc/rc and /etc/rc.shutdown on
> the
> debian to be sure it can work with the jails init script ootb.
>
> # echo "/etc/init.d/cron start" > /home/jails/debian/etc/rc
> # chmod 755 /home/jails/debian/etc/rc
> # echo "/etc/init.d/cron stop" > /home/jails/debian/etc/rc.shutdown
> # chmod 755 /home/jails/debian/etc/rc.shutdown
>
> in the rc.conf :
> jail_debian_rootdir=/home/jails/debian
> jail_debian_hostname="debian"
> jail_debian_ip="192.168.1.3"
> jail_debian_interface="nfe0"
> jail_debian_devfs_enable="YES"
> jail_debian_devfs_ruleset="devfsrules_jail"
> jail_debian_flags="-n debian"
>
> # /etc/rc.d/jail start debian # to start it
>
> Here is the magic:
> #jls
>   JID  IP Address      Hostname                      Path
>       15  192.168.1.3     debian                        /home/jails/debian
> #jexec debian uname -a
>           Linux debian 2.6.16 FreeBSD 8.0-STABLE #3: Sun Jan 10 20:39:38
> CET 2010 i686 GNU/Linux
> #jexec debian cat /etc/debian_version
>           5.0.4
>
> my main  usage is to be able to test my own C code on linux.
>
> Hope it can help.
>
> regards,
> -----
> Bapt
> _______________________________________________
> freebsd-jail@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-jail
> To unsubscribe, send any mail to "freebsd-jail-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2ad0f9f61003030906s27f90f25m6ae6e7f99bed5df>