Solved FreeBSD 14.1 RPi4B Jail Issue

this is the error:

jail: <jailname>: exec /bin/sh: Exec format error

Background: 8GB RPi model. Installed the proper .img to an SD card. Booted up no problem. Tried this with both the default ufs install and a zfs install. Created a jail directory with the native toolset. /etc/rc.conf is appropriately populated.

/etc/jail.conf includes:
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";

this is NOT a VNET jail. Tried to start the jail:

jail -c <jaildirectory>

fails to start and gives this error at the command line:

jail: <jailname>: /bin/sh /etc/rc: failed

and the logfile shows:

jail: <jailname>: exec /bin/sh: Exec format error

I've tried everything short of Voodoo with no success and spent hours Googling. I have a lot of experience with FreeBSD jails (but apparently not enough:). Remove the 'exec.start' and 'exec.stop' lines from /etc/jail.conf and the jail starts but does nothing (/etc/rc.conf is not executed).

Any thoughts?


Edited to add:

I have a nagging suspicion as to why it doesn't work.

I used the FreeBSD-14.1-RELEASE-arm64-aarch64-RPI.img to make the SD card for the RPi4B but I used the base.txz file from the FreeBSD-14.1-RELEASE-amd64-disc1.iso to create the jail directory.

Mr Google suggested in several places that the error 'jail: <jailname>: exec /bin/sh: Exec format error' comes from running different versions of the OS.

Could this be the problem?
 
Mr Google suggested in several places that the error 'jail: <jailname>: exec /bin/sh: Exec format error' comes from running different versions of the OS.
It's not a different version, it's a different CPU architecture. You installed binaries for x86_64 (Intel 64/AMD64), those obviously aren't going to work on an ARM CPU.
 
It's not a different version, it's a different CPU architecture. You installed binaries for x86_64 (Intel 64/AMD64), those obviously aren't going to work on an ARM CPU.
[Hand slapping forehead]

Thank you, SirDice! The answer was right there in the installation filenames.
 
Since SirDice pointed the way, I fetched the base.txz from FreeBSD-14.1-RELEASE-arm64-aarch64-disc1.iso and used it to create the jail. Seems to work perfectly now.

Thanks again!
 
Back
Top