# Is it possible to run Linux devuan on freebsd headless (chroot / vm)?



## honeybear (Nov 5, 2022)

Hello,

I have a AMD Ryzen 8 core, with good power. However I would like to run linux on it, on a chroot base rootfs. 
Meaning using the classic base, without adding more crap. chroot is king.

Is it possible ?

best regards


----------



## cmoerz (Nov 5, 2022)

You might be able to get something "devuan like" going in a linux jail; however, this will not be linux - it will be running on FreeBSD's linux emulation layer.
see https://wiki.freebsd.org/LinuxJails

If you don't mind an "opaque" disk image, you could use bhyve() to get an actual vm going. There's a bunch of helper tools to set this up, if you don't want to do it on your own - sysutils/vm-bhyve for example. It'll run headless, but you'll be able to use vnc to connect to its console.


----------



## honeybear (Nov 5, 2022)

you mean the kernel freebsd is running on rootfs, of Linux. It is compatible in terms of binary? 
kernel freebsd with a rootfs linux?


----------



## drhowarddrfine (Nov 6, 2022)

What is this Linux jail? Is this actually a FreeBSD jail running Linux?


----------



## W.hâ/t (Nov 6, 2022)

drhowarddrfine said:


> What is this Linux jail? Is this actually a FreeBSD jail running Linux?


It's is a linux jail running on FreeBSD.

I'd say you'll have less trouble with an emulator tho.

Edit: See post #2 ...


----------



## drhowarddrfine (Nov 6, 2022)

It runs on the Linuxulator. I see


----------



## Holger (Nov 6, 2022)

drhowarddrfine said:


> What is this Linux jail? Is this actually a FreeBSD jail running Linux?


The terminology is not consistent here. In general, a so-called “Linux-Jail” on FreeBSD is not an actual jail – which would mean something using the well-known FreeBSD jail infrastructure, e.g. `jls`, `jexec`, etc. – but rather a chroot-environment in `/compat/linux`.

However, turning `/compat/linux` into a *genuin* jail is easily possible.


----------



## Phishfry (Nov 6, 2022)

Holger said:


> which would mean something using the well-known FreeBSD jail infrastructure,











						Setting up a (Debian) Linux jail on FreeBSD
					

Hi gang!  Prerequisites: I am assuming that you know how to install software on FreeBSD and also have some basic understanding about FreeBSD jails.  Editorial  I'm going to be very honest here: I started disliking Linux for a while, and I've worked with it for a long time. For various reasons...




					forums.freebsd.org


----------



## cmoerz (Nov 6, 2022)

Holger said:


> The terminology is not consistent here. In general, a so-called “Linux-Jail” on FreeBSD is not an actual jail – which would mean something using the well-known FreeBSD jail infrastructure, e.g. `jls`, `jexec`, etc. – but rather a chroot-environment in `/compat/linux`.
> 
> However, turning `/compat/linux` into a *genuin* jail is easily possible.


Actually, I believe you get pretty close to a full jail - if you replace some of the network related binaries, you can even get your own vnet:








						jails - VNET and a Linux jail
					

So I've been poking at Linux jails in 13.0. I've managed to get a Ubuntu and Debian jail running, but now I want to take it a step further. Has anyone ever got VNET working inside of a Linux jail? I can only get so far before I start running into issues.  Anyway, here's my jail.conf  path =...




					forums.freebsd.org
				




I've used this with great success in the past. It starts like a regular jail, you use `jexec` to run linux binaries on demand. You seem to get jail-based process separation just like with a FreeBSD jail.
Then again, maybe someone with a bit more insight into the source code wants to chime in on whether all jail related boundaries are actually properly working in this context?


----------



## honeybear (Nov 7, 2022)

Hi 

I did get the amd64 rootfs of devuan. Is the error due to amd64/ i686 incompatibility?

```
root@bsd:/ramdisk2/ROOTFS # chroot .
chroot: /bin/csh: Exec format error
root@bsd:/ramdisk2/ROOTFS # uname -a

root@bsd:/ramdisk2/ROOTFS # uname -a
FreeBSD bsd 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:04:45 UTC 2021     [email]root@releng1.nyi.freebsd.org[/email]:/usr/obj/usr/src/i386.i386/sys/GENERIC  i386
```


----------



## SirDice (Nov 7, 2022)

Don't try to to run 64 bit code on an 32 bit OS, that's not possible. You can run 32 bit code on a 64 bit OS though. Why are you running a 32 bit OS on a CPU that's capable of running 64 bit?

And keep in mind that 13.0-RELEASE is end-of-life and not supported anymore.


----------



## honeybear (Nov 7, 2022)

I just tried DEVUAN 686 ... so x86 but error is still same: 

```
root@bsd:/ramdisk2/ROOTFS # chroot .
ELF binary type "0" not known.
ELF binary type "0" not known.
chroot: /bin/csh: Exec format error
```


----------



## SirDice (Nov 7, 2022)

Chapter 11. Linux Binary Compatibility
					

FreeBSD provides binary compatibility with Linux, allowing users to install and run most Linux binaries on a FreeBSD system without having to first modify the binary




					docs.freebsd.org


----------

