# Linux emulation



## nickednamed (Oct 8, 2014)

This is probably a dumb question, but I'm going to ask it anyway: Would it be possible to use one of the mini-Linux distros to achieve a lightweight Linux compatibility layer? And, if possible, what would the benefits and drawbacks be?


----------



## Oko (Oct 8, 2014)

nickednamed said:
			
		

> This is probably a dumb question, but I'm going to ask it anyway: Would it be possible to use one of the mini-Linux distros to achieve a lightweight Linux compatibility layer? And, if possible, what would the benefits and drawbacks be?


PC-BSD has an interesting approach to "Linux emulation". They have something called a Linux jail which is a FreeBSD jail running a copy of Linux. They accomplish this cleverly using GNU/kFreeBSD. I have not played with it so I am not sure if it works as advertised but if it does that would be way to go. Real Linux emulation has no function beyond running Flash, Acrobat Reader and Skype. The commits to Linux emulation are very infrequent. IMHO that thing should be removed from the kernel. My advice is if you need Linux than you run Linux. Anybody who is trying to run MATLAB or even worse something like Oracle database on FreeBSD is a fool. You don't run thousands of dollars worth of proprietary software on non officially supported platform. The same goes for people who need Windows applications. You need Windows, get yourself Windows.


----------



## Terry_Kennedy (Oct 9, 2014)

Oko said:
			
		

> Real Linux emulation has no function beyond running Flash, Acrobat Reader and Skype. The commits to Linux emulation are very infrequent. IMHO that thing should be removed from the kernel. My advise is if you need Linux than you run Linux. Anybody who is trying to run MATLAB or even worse something like Oracle database on FreeBSD is a fool.


There are a number of system management utilities (for example, Dell's racadm) which work fine under FreeBSD's Linux emulation. It seems that many of the more unusual things that were put into the Linux emulator were put there to make specific Linux software run, and got committed because there was a developer that needed that particular Linux utility to work on FreeBSD.

In another case, I was assisting the author of the commercial AlphaVM emulator with the port to FreeBSD, and the author initially wanted to re-use their code which used the Linux sg(4) driver for SCSI passthru. There is an un-documented scsi_sg.ko kernel module which implements some of the Linux functionality under FreeBSD. The FreeBSD developer involved (mav@) was very helpful in adding some additional functions to this piece of Linux emulation, although eventually development switched to the native pass(4) driver.

In yet a third case, a different commercial software vendor is considering retiring the native FreeBSD version of their product and instead supporting their Linux build under FreeBSD's Linux emulator. This would still be a fully-supported commercial product, just using the Linux emulator.

With these examples, I hope I made a reasonable argument for continuing to support the Linux emulator in FreeBSD.


----------



## qsecofr (Oct 9, 2014)

> Linux emulation has no function beyond running Flash, Acrobat Reader and Skype.



Surely there's some people who have gotten some use from Linux binaries other than those named.  I can think of me as an example.    Where there's a will there's a way..  And by my subjective observance, the Linux binary in question seems to run better in FreeBSD than it's direct counterpart Windows native binary does in Windows -  same machine, dual boot.  But it did take me a long while and the CentOS structure to get it running..


----------



## Oko (Oct 9, 2014)

Terry_Kennedy said:
			
		

> Oko said:
> 
> 
> 
> ...


That is a very interesting post and I concur that you are making very compelling argument.


----------



## nickednamed (Oct 9, 2014)

Oko said:
			
		

> PC-BSD has an interesting approach to "Linux emulation". They have something call Linux jail which is FreeBSD jail running copy of Linux. They accomplish this cleverly using GNU/kFreeBSD.



Yeah, that's very interesting. So running a Linux userland on top of (I presume) the GNU C library and the FreeBSD kernel. Nice idea. I haven't used PC-BSD since they switched to 64-bit only architectures, but I will look into that, out of interest.

Does anyone have an idea how it compares to the "traditional" Fedora or CentOS approach in terms of compatibility, reliability, convenience or performance?

I'd still be interested to see if any work has been done to use a Linux kernel with, say, a busybox-style userland IE small, lightweight, great on older hardware, If it is at all possible, or even desirable.


----------



## kpedersen (Oct 9, 2014)

I recently had to use the Linux emulation layer on OpenBSD to run the Perforce commandline client (p4). It worked and I was happy. Before that I was always quite convinced they should get rid of the emulation layer.

So with FreeBSD emulators/wine and Linux compat are not really necessary for me (since FreeBSD is a supported platform on Perforce), however I know how easily this can change and I am certain that other people find the extra flexibility useful.


----------



## SirDice (Oct 9, 2014)

nickednamed said:
			
		

> I'd still be interested to see if any work has been done to use a Linux kernel with, say, a busybox-style userland IE small, lightweight, great on older hardware, If it is at all possible, or even desirable.


Keep in mind that the Linux emulation layer does not load a Linux kernel. It's mostly stubs that translate the Linux ABI to FreeBSD's ABI.


----------



## drhowarddrfine (Oct 9, 2014)

nickednamed said:
			
		

> Does anyone have an idea how it compares to the "traditional" Fedora or CentOS approach in terms of compatibility, reliability, convenience or performance?


There is an often repeated rumor that FreeBSD runs Linux binaries faster than Linux does for architectural reasons. The only actual evidence of this that I could find was by Phoronix a couple of years ago for games.


----------



## deathbyfreezeray (Oct 9, 2014)

If only we had a reliable method of benchmarking without too many variables. Most benchmarks between Linux and FreeBSD are very inconsistent.


----------

