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

ikevin8me

Active Member

Reaction score: 12
Messages: 198

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).

linux.osname, linux.osrelease, linux.oss_version
The Linux OS name, OS release, and OSS version associated with
this jail.

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

Aspiring Daemon

Reaction score: 590
Messages: 709

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.
 
OP
I

ikevin8me

Active Member

Reaction score: 12
Messages: 198

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

Member

Reaction score: 27
Messages: 48

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

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,319
Messages: 38,835

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.
 

vigole

Daemon

Reaction score: 1,462
Messages: 1,270

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/
 

vigole

Daemon

Reaction score: 1,462
Messages: 1,270

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

Aspiring Daemon

Reaction score: 590
Messages: 709

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.
Code:
import os

os.system("uname -rsi")

This is from OpenSolaris documentation in 2010

Joyent revived lx branded zones for SmartOS. Bryan Cantrill has some slides for Running Linux Containers on an illumos kernel at a talk he gave.
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.
 
OP
I

ikevin8me

Active Member

Reaction score: 12
Messages: 198

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

Active Member

Reaction score: 22
Messages: 188

Top