Setting up a (Debian) Linux jail on FreeBSD

aragats

Daemon

Reaction score: 603
Messages: 1,501

How to deal with /dev/pts?
When using jexec in Linux jail I have:
Code:
# ll /dev/pts/
total 1
dr-xr-xr-x 2 root root    512 Nov  5 14:01 .
dr-xr-xr-x 9 root root    512 Nov  5 14:01 ..
crw--w---- 1 1001 adm  136, 3 Nov  5 15:18 3
So, the 3 corresponds to my current terminal, but when logging in with ssh no PTY can be allocated:
Code:
% ssh -t mylinuxjail
PTY allocation request failed on channel 0
 

cabriofahrer

Active Member

Reaction score: 10
Messages: 221

Does this devuan installed in a jail provide graphics/2D/3D-Acceleration and sound? I am asking if this could be a solution for watching Netflix and for playing games through the linux-steam-client?
 

cabriofahrer

Active Member

Reaction score: 10
Messages: 221

What you don't like about our current Steam solution?
I just asked a generic question, also including the Netflix-Issue. I did not want to say that there is something about the current steam solution that I don't like. I have had no time to do further experiments since the last time I posted on the other thread, but the last status for me was that not even all source-games I tried would work. But I do appreciate and support very much all possible solutions and developments on the matter, of course.
But I also asked the question because independently from steam, I would just like to know if 2D/3D works in a jail, for I have never worked with jails and I am just curious.
 

shkhln

Daemon

Reaction score: 549
Messages: 1,521

Well, and the answer is "No". Linuxulator provides a very different environment from the Linux kernel, which requires quite a bit of package customization to work properly. Trying to run a standard Linux distribution in a jail makes everything harder, not easier.

It also pays to remember that 100% Linux compatibility is not the goal for Linuxulator, since that pretty much requires converting FreeBSD into a Linux reimplementation with all their architectural choices and whatnot.
 

shkhln

Daemon

Reaction score: 549
Messages: 1,521

linuxkpi.ko; As far as I know this one simulates the Kernel Programming Interface, but I have no idea what this exactly does. However, when I check /usr/src/sys/modules/linuxkpi/Makefile then my theory quickly becomes that this module provides access to the Linux hardware layer. So if a program tries to access USB, PCI or even a Linux kernel module then this is the FreeBSD kernel module which handles all that.
You might want to correct that part. Linuxkpi simply provides some struct/constant definitions and helper functions to ease the process of porting the kernel drivers from Linux. Specifically intel/amd graphics and, I think, some network drivers. Linuxkpi doesn't expose any APIs to userspace applications. It is also fully independent from the Linux emulation code.

As for the USB support, see linux_libusb. I haven't tried it myself (yet), but anything else definitely won't work.
 

UrsusDominatus

New Member


Messages: 6

Hi all.
Can you help me with Devuan jail + vnet setup. I have several ordinary FreeBSD jails configured with vnet, bridge and epair. Following through tutorial I ended up with functional jail, but I cannot setup network in it. ifconfig and ip commands inside jail produce output like:
Code:
root@devuan:/# ifconfig epair15b 192.168.10.15 netmask 255.255.255.0
SIOCSIFADDR: Invalid argument
SIOCSIFFLAGS: Invalid argument
SIOCSIFNETMASK: Invalid argument

root@devuan:/# ifconfig eth0 192.168.10.15 netmask 255.255.255.0
SIOCSIFADDR: Invalid argument
SIOCSIFFLAGS: Invalid argument
SIOCSIFNETMASK: Invalid argument
Code:
root@devuan:/# ifconfig -a
eth0: flags=4162<BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 02:d3:4b:71:3c:0b  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo0: flags=4104<LOOPBACK,MULTICAST>  mtu 16384
        loop  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Code:
root@devuan:/# ip a
Cannot open netlink socket: Address family not supported by protocol
Jail config is:
Code:
devuan {
    host.hostname = "devuan.example.com";
    $ip = 15;
    mount.fstab = "/usr/local/jails/devuan.fstab";

    exec.prestart = "ifconfig epair$ip create";
    exec.prestart += "ifconfig bridge0 addm epair${ip}a";
    exec.prestart += "ifconfig epair${ip}a up";

    exec.poststop = "ifconfig bridge0 deletem epair${ip}a";
    exec.poststop += "ifconfig epair${ip}a destroy";

    exec.start = "/etc/init.d/rc 3";
    exec.stop = "/etc/init.d/rc 0";
    exec.clean;

    vnet.interface = "epair${ip}b";
    vnet = "new";

    persist;
    mount.devfs;
    allow.mount;
    allow.mount.devfs;
}
Probably I am doing some stupid configuration mistake, but I am zero in linux, and slightly more than that in FreeBSD.
 

chris123

New Member


Messages: 2

Hi all.
Can you help me with Devuan jail + vnet setup. I have several ordinary FreeBSD jails configured with vnet, bridge and epair. Following through tutorial I ended up with functional jail, but I cannot setup network in it. ifconfig and ip commands inside jail produce output like:
Code:
root@devuan:/# ifconfig epair15b 192.168.10.15 netmask 255.255.255.0
SIOCSIFADDR: Invalid argument
SIOCSIFFLAGS: Invalid argument
SIOCSIFNETMASK: Invalid argument

root@devuan:/# ifconfig eth0 192.168.10.15 netmask 255.255.255.0
SIOCSIFADDR: Invalid argument
SIOCSIFFLAGS: Invalid argument
SIOCSIFNETMASK: Invalid argument
Code:
root@devuan:/# ifconfig -a
eth0: flags=4162<BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 02:d3:4b:71:3c:0b  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo0: flags=4104<LOOPBACK,MULTICAST>  mtu 16384
        loop  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Code:
root@devuan:/# ip a
Cannot open netlink socket: Address family not supported by protocol
Jail config is:
Code:
devuan {
    host.hostname = "devuan.example.com";
    $ip = 15;
    mount.fstab = "/usr/local/jails/devuan.fstab";

    exec.prestart = "ifconfig epair$ip create";
    exec.prestart += "ifconfig bridge0 addm epair${ip}a";
    exec.prestart += "ifconfig epair${ip}a up";

    exec.poststop = "ifconfig bridge0 deletem epair${ip}a";
    exec.poststop += "ifconfig epair${ip}a destroy";

    exec.start = "/etc/init.d/rc 3";
    exec.stop = "/etc/init.d/rc 0";
    exec.clean;

    vnet.interface = "epair${ip}b";
    vnet = "new";

    persist;
    mount.devfs;
    allow.mount;
    allow.mount.devfs;
}
Probably I am doing some stupid configuration mistake, but I am zero in linux, and slightly more than that in FreeBSD.
I'm struggling with the same thing: https://www.ixsystems.com/community/threads/debian-devuan-linux-jail-network-access-problems.80920 . Using Iocage and FreeNAS.
 
Last edited:

dch

Active Member

Reaction score: 50
Messages: 128

What you don't like about our current Steam solution?
what steam solution would this be? I'd like to see if I can get XCom2 running on FreeBSD (with nvidia gpu) as the little linux box I'm currently using gets nastily hot.
 

macosxgeek

New Member

Reaction score: 3
Messages: 17

Very good post. Thank you ShelLuser!

OK. So I did all the steps and I'm trying to start the jail now with:

jail -c devuan

Unfortunately I'm getting the following error message:


Code:
jail: devuan: mount.devfs: /path/to/jail/dev: No such file or directory
Any ideas what can be possibly wrong?
 

gilby

New Member


Messages: 9

I am wondering if this allows the use of hardware that is not supported in FreeBSD. I have an Nvidia GPU to use with Tensorflow, and instead of putting Linux as the OS on this server, I would love to get it running on FreeBSD, with a Linux jail just for this.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,085
Messages: 33,642

I am wondering if this allows the use of hardware that is not supported in FreeBSD.
Jails run on the host's kernel. You may have a Linux userland, it still runs on top of a FreeBSD kernel. So, no.
 

Vadim_Mkk

Member

Reaction score: 6
Messages: 63

Tried setup Devuan Jail on FreeBSD 12.1 with Linix base 7.7 1908
Linuxator "uname" command shows kernel version 2.6.XX and after executes command "dpkg --force-depends -i /var/cache/apt/archives/*.deb" appeares message "libc6 2.24-11+deb9u4 requre kernel above 3.2" - after this messages I canceled to set up this Jail because that follow form the official description "glibc - the core libraries for the GNU system and GNU/Linux systems, as well as many other systems that use Linux as the kernel. These libraries provide critical APIs including ISO C11, POSIX.1-2008, BSD, OS-specific APIs and more. These APIs include such foundational facilities as open, read, write, malloc, printf, getaddrinfo, dlopen, pthread_create, crypt, login, exit and more" that mean what this jail must have system mistake on basic level. May be this Devuan Jail witn kernel 2.6.XX may be correct work with Devuan Jessy/oldstable libc6 2.19-18+deb8u10 - but I don't have enough free time for adventurous and creative experiments with software of 2014 year :) I know that older wine, rum or cognac - that more more refined and sophictical its taste and aroma. :) But software isn't rich alcohol. :(
Void Linux randomly and suddenly freezes - solve only reboot. Devuan stable older than Debian stable minimum two years - for example zfs on Devuan 0.6.5 native and 0.7.12 backpots vs Deiban native 0.7.12 and backpots 0.8.2. Gentoo is very time consumption compilation from sources for ephemeral performance 1% - 2% burst. Where to go to the poor peasant? Where looking for disto with out systemd that will correctly work with Anaconda Distribution?
How wrote one poet - The plastic world won, the dummy was stronger :(
Bazar whops cathedral :(
P.S. But Devuan without systemd correct works with removable media and network manager :)
 

shkhln

Daemon

Reaction score: 549
Messages: 1,521

There is a reason Linux jails are completely unsupported and it's not ease of use…
 

Vadim_Mkk

Member

Reaction score: 6
Messages: 63

Only true believer Debian Stable help me! :(
In the near days I will shove the Anaconda Distribution into the Debian LXC container.
ZFS 0.8.2 works perferct in Debian 10 buster, well compresses data without lost performance IO.
It's poorly that Anaconda doesn't start in the FreeBSD - but what me to do?
 

Vadim_Mkk

Member

Reaction score: 6
Messages: 63

"libc6 2.24-11+deb9u4 requre kernel above 3.2"
Really, If something doesn’t work correctly - read mindfully man, the devil in the details and everything new is the very well forgotten old :)
Only if installing Squeeze, change the compatibility level declared 2.6.18.
Code:
root@morsa:/root #  echo 'compat.linux.osrelease=2.6.18' >> /etc/sysctl.conf
In additon devildetail clears sysvinit in the Jail
9. Inside the jail, delete the configuration files sysvinit_*.
Code:
root@morsa:/jailz/etc # rm /jailz/deb-master/var/cache/apt/archives/sysvinit_*
and rebuilding base system with the different command
Code:
I have no name!@morsa:/# dpkg --force-depends -Ei /var/cache/apt/archives/*.deb
I'll try to upgrade the kernel version above 3.2 and see what happens...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,085
Messages: 33,642

I'll try to upgrade the kernel version above 3.2 and see what happens...
Jails don't have a kernel, not a FreeBSD kernel and certainly not a Linux kernel.
 

Vadim_Mkk

Member

Reaction score: 6
Messages: 63

How I think when downloading application from debian repo to devuan/debian jail debbootstrap translates in jail defailt "linux kernel version" that show "uname" from liunuxator directory...
Why linux() contains this words?
The following sysctl(8) tunable variables are available:
compat.linux.osname Linux kernel operating system name.
compat.linux.osrelease Linux kernel operating system release. Changing this to something else is discouraged on non-development systems, because it may change the way Linux programs work. Recent versions of GNU libc are known to use different syscalls depending on the value of this sysctl.
 

Vadim_Mkk

Member

Reaction score: 6
Messages: 63

Best of both worlds, what's there not to like?
ShelLuser which FreeBSD version you use?
I tried run Devuan in the FreeBSD 11.3 jail.
I configure chroot environment before configure jail
mvg@freebsd:/opt/jails/devuan # mount -F /etc/fstab.devuan `pwd`/s
mvg@freebsd:/opt/jails/devuan # mount -F /etc/fstab.devuan `pwd`/proc
mvg@freebsd:/opt/jails/devuan # mount -F /etc/fstab.devuan `pwd`/tmp
mvg@freebsd:/opt/jails/devuan # mount -t devfs none dev
mvg@freebsd:/opt/jails/devuan # chroot . /bin/bash

When I entered chroot and run
dpkg --force-depends -i /var/cache/apt/archives/*.deb
I got next error
Code:
Setting up sysvinit-core (2.88dsf-59.9+devuan2) ...
sysvinit: creating /run/initctl
mv: cannot move '/dev/initctl.new' to '/dev/initctl': Operation not supported
dpkg: error processing package sysvinit-core (--configure):
subprocess installed post-installation script returned error exit status 1
after this errors I while stayed chroot can find apt search install packages with apt install with the permanent error about sysvinit-core when I went out chroot and started Devuan Jail I couldn't run apt search or apt install because I had permanent network error. Didn't help adding to the jail.conf allow.raw_sockets - network error stayed. If I didn't go to the chroot - then when I run jail dpkg --force-depends -i /var/cache/apt/archives/*.deb and I didn't get any errors after executing dpkg -l | grep -v ii but I had permanent network error and couldn't start apt search or apt install .
In both cases, the result is one - deadlock :(
FreeNAS has similar problem
 

Vadim_Mkk

Member

Reaction score: 6
Messages: 63

Jails don't have a kernel, not a FreeBSD kernel and certainly not a Linux kernel.
I understand it, but when I changed version Linux for 4.19 - disappeared error about libc6 2.24-11+deb9u - seem when run dpkg --force-depends -i /var/cache/apt/archives/*.deb it query formal version Linux kernel.
When I add to jail.conf linux - I get correct version Devuan kernel 4.9.хх
 

gpb

Member

Reaction score: 16
Messages: 53

While it may seem to work, this isn't really running Linux in a FreeBSD jail. To really do this you'd need to follow what Sun Microsystems initially did with lx-branded zones, then Joyent picked up to bring lx-branded zones to SmartOS.

Doing this they translate system calls from one API/ABI to another and emulate the Linux system call table.

That's the only way you are really going to run Linux in a jail.
 
Top