jails Alpine Linux Jail can't find /usr/bin/true for exec.start

Hello,
I am trying to make an Alpine Linux jail, to use for a Jellyfin server later. I'm running on FreeBSD 14.1-RELEASE-p3, on an intel laptop. I installed following this guide: https://it-notes.dragas.net/2024/01/18/installing-alpine-linux-on-a-freebsd-jail/

When I do service jail start alpine I get the following error:
Code:
Starting jails: cannot start jail  "alpine":
4
jail: alpine: /usr/bin/true: failed
.

Here is my jail.conf:
Code:
alpine {
    host.hostname="alpine";
    exec.start="/usr/bin/true";
    exec.stop="/usr/bin/true";
    ip4.addr=10.0.0.71;
    interface=wlan0;
    path="/usr/local/jails/containers/alpine";
    allow.raw_sockets=1;
    exec.consolelog = "/var/log/jail_${name}.log";
    persist;
    mount.fstab="/usr/local/jails/containers/alpine.fstab";   
}

In addition, /var/log/jail_alpine.log says the following:
Code:
jail: alpine: exec /usr/bin/true: No such file or directory

However I am sure /usr/bin/true exists, and I used it with other jails no problem. Changing the command for exec.start to other programs I know work and exist gave the same error.
What can be the cause?
 
In the provided link it is /bin/true instead of /usr/bin/true. From my understanding the command must exist in the jail environment and not from the hosts perspective. May be this is why /usr/bin/true works for a FreeBSD jail but not for Alpine Linux.
 
Try this method

Code:
#!/bin/sh

JAIL_NAME="alpine"
EXEC_START="/bin/true"
ALT_PATHS="/usr/bin/true /bin/true /usr/local/bin/true"

service jail onestart "${JAIL_NAME}"

jexec "${JAIL_NAME}" [ ! -f "${EXEC_START}" ] && {
  for PATH in ${ALT_PATHS}; do
    jexec "${JAIL_NAME}" [ -f "${PATH}" ] && { EXEC_START="${PATH}"; break; }
  done
}

sed -i '' "s|exec.start=.*|exec.start=\"${EXEC_START}\";|g" /etc/jail.conf
sed -i '' "s|exec.stop=.*|exec.stop=\"${EXEC_START}\";|g" /etc/jail.conf

service jail restart "${JAIL_NAME}"
 
Back
Top