# What is the new jail(8) feature "allow running Linux® in a jailed environment" (in 12.2)?



## ikevin8me (Nov 3, 2020)

In the latest FreeBSD 12.2 release, there is a feature "The jail(8) utility has been updated to allow running Linux® in a jailed environment.".

Diving further, the doc for jail(8) has these entries:



> _linux_   Determine how a jail's Linux emulation environment    appears.  A
> value of "inherit" will keep the same environment,    and "new" will
> give the jail its own environment (still originally inherited
> when the jail is created).
> ...



What does this mean? Does this mean we can *boot an entire Linux OS* (not just some Linux binaries) contained within a jail? Further, and if so, what is the difference with this approach compared to use bhyve?


----------



## Beastie7 (Nov 3, 2020)

All Jails share the same kernel. To my understanding, the Linuxulator does what BrandZ does in OpenSolaris; they provide a system call table that’s convincing for the linux userland to run binaries that were made for it.

I could be wrong though.


----------



## ikevin8me (Nov 3, 2020)

We can already run Linux binaries inside jail (before 12.2).
And we can already run Linux OS using bhyve.

So, what exactly does this new jail(8) feature do? Looking for clarification...


----------



## xtouqh (Nov 3, 2020)

It does exactly what that item says -- the jail(8) *utility* was updated with new functionality.


----------



## SirDice (Nov 3, 2020)

ikevin8me said:


> Does this mean we can *boot an entire Linux OS* (not just some Linux binaries) contained within a jail?


No. You will be running a jail, with Linux executables, on top of the Linux emulation layer on the FreeBSD kernel. This option just makes that easier to do.


----------



## a6h (Nov 3, 2020)

LinuxJails - FreeBSD Wiki


----------



## a6h (Nov 3, 2020)

anonymous9 said:


> Hopefully in future work they can fix that. SmartOS lx branded zones run systemd, so it can be done.


In WSL/WSL2 land, there're discussions about possibility/necessity of systemd presence in their projects. I'm not familiar with WSL and systemd internal, thus I can't comment on that. I'm not sure about FreeBSD LinuxJails either. There're some hacks in WSL/WSL2, but that's all. Therefore it's hard to tell what will happen in the future. If you're interested in state of systemd in WSL, here's two links to relevant discussions:
https://github.com/systemd/systemd/issues/8036/
https://dev.to/bowmanjd/you-probably-don-t-need-systemd-on-wsl-windows-subsystem-for-linux-49gn/


----------



## a6h (Nov 3, 2020)

On FreeBSD LinuxJails:
I think it's a great feature. In the past I was whining why there's no FreeBSD on WSL. LinuxJails is not WSL, but I'm pretty sure it will attract more Linux users to FreeBSD project. It may not be obvious to advanced FreeBSD users, and also they may think my claim silly! but these little improvements are very attractive for non-FreeBSD users. I'm very happy for FreeBSD LinuxJail Project.


----------



## Beastie7 (Nov 3, 2020)

anonymous9 said:


> I've never ran Linux in a jail, but it would be interesting to run the code below in "Linux jail," and see what it gives as the OS.  On SmartOS it will return Linux and the kernel.
> 
> ```
> import os
> ...


So LX Branded Zones can run a full Linux kernel? Interesting. I thought that was an Oracle invention from release notes I’ve read sometime ago for Solaris.

I‘m a huge fan of Bryan and his work. He’s such a great character.


----------



## ikevin8me (Nov 5, 2020)

Any documentation and examples on what variables to set for:

_linux
linux.osname
linux.osrelease
linux.oss_version_

And I guess we don't have to go inside the jail and run "pkg install linux_base-c7" anymore, right?


----------



## tuaris (Dec 2, 2020)

vigole said:


> LinuxJails - FreeBSD Wiki


I'm still a little confused what is the difference between that Wiki link and this old forum post: https://forums.freebsd.org/threads/setting-up-a-debian-linux-jail-on-freebsd.68434 ?



ikevin8me said:


> And I guess we don't have to go inside the jail and run "pkg install linux_base-c7" anymore, right?


Maybe it's that?

I tried both sets of instructions but it looks like there is no network access after all is done.


----------

