Solved Jail with other versions of FreeBSD

I created my first jail tonight.
My goal was to build NanoBSD images from source with -CURRENT in a jail on a FreeBSD 11.1 server.

Is this possible? I got it up and running and configured ssh but when I run uname I get FreeBSD 11.1 not -CURRENT

So can I run -CURRENT in a Jail and compile software with -CURRENT in a jail on FreeBSD 11.1?

I used this for my base.txz and source.txz
http://ftp.freebsd.org/pub/FreeBSD/snapshots/amd64/12.0-CURRENT/

This was my instruction guide:
https://clinta.github.io/freebsd-jails-the-hard-way/

mkdir /jails && mkdir /jails/current
fetch ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/amd64/12.0-CURRENT/base.txz -o /tmp/base.txz
tar -xvf /tmp/base.txz -C /jails/current
cp /etc/resolv.conf /jails/current/etc/resolv.conf
cp /etc/localtime /jails/current/etc/localtime
echo hostname=\"current-jail\" >> /jails/current/etc/rc.conf

Code:
# /etc/jail.conf
# Global settings applied to all jails.
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
# The jail definition for my jail
current {
    host.hostname = "current-jail.domain.local";
    path = "/jails/current";
    interface = "igb0";
    ip4.addr = 10.0.0.100;
}

Command prompt to configure jail and create root passwd:
jail -c path=/jails/current mount.devfs \host.hostname=current-jail ip4.addr=10.0.0.100 \command=/bin/sh

Start Jail
jail -c current
Code:
root@gigabyte:~ # jail -c current
current: created
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
Setting hostname: current-jail.
Creating and/or trimming log files.
Starting syslogd.
Clearing /tmp.
Updating motd:.
Performing sanity check on sshd configuration.
Starting sshd.
Starting cron.

Mon Nov  6 01:04:23 EST 2017
root@gigabyte:~ #

SSH into the jail:
ssh 10.0.0.100

root@current-jail:~ # uname -a
FreeBSD current-jail 11.1-RELEASE-p1 FreeBSD 11.1-RELEASE-p1 #0: Wed Aug 9 11:55:48 UTC 2017 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64


Should I be using Bhyve instead of a Jail?
 
After some reading I am wondering how the jail even boots without kernel.txz
Do Jails share the host kernel or is kernel included in base.txz and each jail uses its own kernel?
 
Jails use the host kernel, so you run one kernel and a number of jailed userlands.

If I recall correctly, because the jail uses the hosts kernel, you should be running either the same version of FreeBSD in the jail as you are on the host, or an older release. Newer jails aren't supported on older hosts because the kernel may (will?) have changed and the jail may make syscalls that don't exist/have changed.
 
My goal was to build NanoBSD images from source with -CURRENT in a jail on a FreeBSD 11.1 server.
You can build newer images on 10.x or 11.x or any other version. It's the same process you use to upgrade from one version to another, except for the install bit.
So can I run -CURRENT in a Jail and compile software with -CURRENT in a jail on FreeBSD 11.1?
You cannot run a newer version on a older kernel.
 
Back
Top