Linuxulator: running one's own small Linux in FreeBSD?

Thomas Mueller mueller6722 at twc.com
Mon Feb 15 11:40:47 UTC 2021


from JB:

> > So I guess Linux service is restarted by "service linux restart"?

> # service | grep List
> -l      List all scripts in /etc/rc.d and /usr/local/etc/rc.d

> # service -l | grep ux
> linux

> The `service' command controls the rc script that starts the service.
        
        
> > kldstat on my Freebsd showed only linux.ko, linus_common.ko and linux64.ko .

> Those other modules won't be loaded until you start the `linux' service with 'linux_mounts_enable' enabled (or you mount them yourself with fstab, manually, or another script):
        
> sysrc linux_mounts_enable=YES
        

> > I had not yet actually attempted to run my small Linuxes in FreeBSD or NetBSD, not ready yet.
>       
> > I still would need such things as init scripts, proc fs, /etc/fstab and other configuration files.

> The target directory can be empty (in the case of the default emulation path, '/compat/linux') when starting the service. It doesn't actually "start" your guest OS. I don't know what your plans are, but running Linux inside a jail
> is different than using the compatibility layer. It sounds like you want the former:
        
> https://www.harshadsharma.com/posts/2020/12/ubuntu-bionic-on-freebsd-with-iocage-managed-jails/

        
> > FreeBSD Handbook online is not sufficiently detailed. 
        
> Sadly, documentation has lagged behind the high pace of OS development. But, better that than a slow pace of development.

I was not aware of sysrc, see it is in FreeBSD but not NetBSD.

It looks like "service mountd restart" does the same thing as "/etc/rc.d/mountd restart"; this was on NetBSD.

I took a look at the man page for sysrc.

I browsed the URL you gave me, might not be directly applicable to my case.  I see it requires iocage (which I don't have) and debootstrap (which I never used but was aware of).

Debootstrap is in FreeBSD ports but not NetBSD pkgsrc, however I don't see why one could not download the necessary files, apply the scripts, and make debootstrap outside FreeBSD ports or pkgsrc framework.

I am inclined toward compatibility layer rather than jail if possible and would want to try under both FreeBSD and NetBSD.  I would probably have to do chroot.
        

Tom



More information about the freebsd-emulation mailing list