# Installing Red Baron on FreeBSD: a guide for Linux users

Red Baron was Red Hat's branded, Spyglass-derived browser, distributed as a binary without source code. The copy used here comes from Red Hat Linux 4.2. Its RPM is named `redbaron-3.1-1.i386.rpm`; the executable inside is `redbaron_3.10`.

The [redbaron-freebsd-jail README](redbaron-freebsd-jail/README.md) describes a short installation command. This post explains the preparation that command assumes, what [provision.sh](redbaron-freebsd-jail/provision.sh) installs, and why the supporting files are needed. It also covers the new [preload diagnostics](diagnostics/preload/README.md), which help distinguish Linux loader behavior from FreeBSD loader behavior.

This is a walkthrough of the supplied files, with additional preparation and corrections identified explicitly. The complete installation was not rerun while preparing this post; diagnostic outputs below are labelled as expected rather than newly observed browser results.

## What runs where

For a Linux user, a jail is roughly comparable to an operating-system container: it shares the host kernel but has a separate filesystem root and restricted access to the system. This jail contains a native FreeBSD base system, plus an old Linux runtime for the browser.

```text
FreeBSD host kernel
  |
  +-- redbaron jail: /usr/local/jails/redbaron
        +-- native Python gateway -> HTTPS websites
        +-- native Xvfb, display :99
        +-- native x11vnc -> VNC viewer, TCP port 5900
        +-- Linux Red Baron + old Linux libraries
              +-- Linux syscalls -> Linuxulator -> FreeBSD kernel
```

Linuxulator supplies the Linux system-call ABI. It does not boot Linux or emulate the x86 processor. On a suitable amd64 host, the CPU executes the browser's i386 instructions directly. Linux libraries are still required: FreeBSD libc cannot substitute for the libc5 expected by this executable. The [FreeBSD Linux compatibility chapter](https://docs.freebsd.org/en/books/handbook/linuxemu/) explains this division.

There is also a distinction between the README's description and the provisioner's implementation: the script uses a FreeBSD release downloaded by Bastille, but does not call `bastille create`. It copies that release into `/usr/local/jails/redbaron` and manages the jail with native `service jail` commands. Do not expect an ordinary Bastille container layout or use `bastille start` as the management interface for this recipe.

## 1. Prepare the host and download a FreeBSD base

Use an amd64 FreeBSD host with i386 Linuxulator support. The provisioner hard-codes `15.1-RELEASE` as its base. Use a compatible host kernel; editing the release string alone does not establish that another host is suitable.

The FreeBSD command blocks below assume a root `/bin/sh` session. Enter one using your normal administration method; `doas sh` is an option if already configured. The installer checks that it is running as root, although its error message specifically says to use `doas`.

```sh
pkg install -y bastille
sysrc linux_enable=YES
service linux start
kldstat
bastille bootstrap 15.1-RELEASE
test -x /usr/local/bastille/releases/15.1-RELEASE/bin/sh
```

`pkg` installs binary packages. `sysrc` changes settings in `rc.conf`, FreeBSD's service configuration file. The Linux service enables host compatibility support; check that the module list includes i386 support, normally `linux.ko`, not only `linux64.ko`. `linux_common.ko` supplies shared infrastructure.

Bastille's [bootstrap command](https://docs.bastillebsd.org/en/latest/chapters/releases/bootstrap.html) downloads a release userspace; it does not create this jail. The provisioner expects the release at the exact path above. If you configured another Bastille prefix, adjust its source path first.

No modern Linux base package is needed: the five old RPMs supply this browser's runtime. Nor does this recipe require ZFS, VNET, a bridge, NAT, or a Linux namespace launcher. Linux compatibility modules belong to the host, not inside the jail.

## 2. Check addresses and jail configuration before provisioning

The provisioner uses these defaults:

| Setting | Value | Meaning |
|---|---|---|
| `JAIL` | `redbaron` | Jail name. |
| `RELEASE` | `15.1-RELEASE` | FreeBSD base to copy. |
| `ROOT` | `/usr/local/jails/redbaron` | Host directory containing the jail. |
| `HOST_IP` | `192.168.3.104` | IPv4 address assigned to the jail. |
| `LAN_PREFIX` | `192.168.3.` | Declared but unused. |

For this recipe, use the host's existing LAN address. This is a shared-IP jail: the script does not add an interface address or forward ports through NAT. Host services must not already occupy the address/port combinations needed by the jail.

In [startup.sh](redbaron-freebsd-jail/startup.sh), x11vnc separately uses `-allow 192.168.3.`. Edit that argument before provisioning if the viewer is on another subnet, or replace it with a specific permitted client address. Setting `LAN_PREFIX` does not change it. Only `HOST_IP` has an environment override; the jail name and release are directly assigned.

VNC is intentionally LAN-visible and unencrypted. Restrict port 5900 to intended clients and use SSH forwarding or a VPN across untrusted networks. Also restrict external access to port 8080: the gateway's `127.0.0.1` bind is not necessarily private in this configuration. FreeBSD can redirect loopback binds and connections in a shared-IP jail to its primary address. The [Handbook's jail networking discussion](https://docs.freebsd.org/en/books/handbook/jails/) explains this behavior. Allow the jail to reach its own gateway, but do not expose that fetching service publicly.

Next, prepare configuration discovery:

```sh
mkdir -p /etc/jail.conf.d
```

Ensure `/etc/jail.conf` exists and contains this line, preserving any existing configuration:

```text
.include "/etc/jail.conf.d/*.conf";
```

The leading dot is significant. If `/etc/jail.conf` is absent, the supplied provisioner writes `include` without the dot. Creating the correct configuration first avoids that branch. The script also assumes `/etc/jail.conf.d` already exists. The [official jail configuration example](https://docs.freebsd.org/en/books/handbook/jails/) uses `.include`.

Use a new, dedicated jail. An existing root directory makes the script skip copying the base; an existing `/etc/jail.conf.d/redbaron.conf` is retained. These are existence checks, not installation-completeness checks. Changing `HOST_IP` on a subsequent run will not update that retained configuration.

## 3. Run the installer

From the project directory:

```sh
cd redbaron-freebsd-jail
sh -n provision.sh
sh -n startup.sh
sh -n redbaron-launch.sh
HOST_IP=192.168.3.104 sh ./provision.sh
```

Replace the example address with your actual host address. The README's `doas sh provision.sh` also works with its default address. To override it through `doas`, use `doas env HOST_IP=YOUR_ADDRESS sh provision.sh`.

The script uses `set -eu` to stop on many failures and unset variables. Some failures are deliberately ignored, including an initial jail start and account creation. Its final success message means the provisioning sequence completed; it does not prove that the browser opened a window.

The next sections explain what that invocation does. Commands shown as implementation examples do not need to be repeated after provisioning.

## 4. Fetch five RPMs, then copy the FreeBSD base

The script determines its own directory and creates a `media/` cache. It downloads any missing RPM from the configured [ibiblio historic Linux archive](https://www.ibiblio.org/pub/historic-linux/distributions/redhat-4.2/i386/RedHat/RPMS/).

| RPM | Purpose |
|---|---|
| `redbaron-3.1-1.i386.rpm` | Browser, help pages, and resources. |
| `libc-5.3.12-18.i386.rpm` | Linux libc5 and matching math library. |
| `ld.so-1.7.14-4.i386.rpm` | Linux loader, `libdl`, and Linux `ldconfig`. |
| `XFree86-libs-3.2-9.i386.rpm` | Old Linux X11 client libraries. |
| `xpm-3.4i-1.i386.rpm` | Linux XPM image library. |

All five are supplied in `media/`, so the corresponding downloads are skipped. The test is only file existence, not checksum verification. `sha256 media/*.rpm` can record local hashes, but that is not independent authentication of the files. Keep unrelated RPMs out of the directory: later loops copy and extract every `*.rpm` there.

If the jail root does not exist, the script creates it and copies the bootstrapped FreeBSD base through a tar pipe, equivalent to:

```sh
tar -C /usr/local/bastille/releases/15.1-RELEASE -cf - . |
  tar -C /usr/local/jails/redbaron -xpf -
```

No intermediate archive is needed, and extraction preserves permissions. The host's `/etc/resolv.conf` is copied into the jail for DNS. A resolver listening only on the host's loopback address may require adjustment for jail networking.

A failed copy can leave a partially populated root that the next invocation will skip. Inspect and recover that dedicated jail before retrying; do not delete an existing directory without checking its contents.

## 5. Define and start the jail

The generated `/etc/jail.conf.d/redbaron.conf` looks like this with the default address:

```text
redbaron {
    host.hostname = "redbaron";
    path = "/usr/local/jails/redbaron";
    ip4.addr = "192.168.3.104";
    exec.clean;
    exec.start = "/bin/sh /etc/rc";
    exec.stop = "/bin/sh /etc/rc.shutdown";
    mount.devfs;
    allow.raw_sockets = 1;
}
```

The hostname and root identify the jail. `ip4.addr` restricts its IPv4 addresses; `exec.clean` supplies a clean environment. The start and stop commands run normal FreeBSD boot/shutdown scripts inside the jail. `mount.devfs` provides device nodes. Raw sockets are allowed for tools such as ping, although ordinary browser TCP connections do not need them.

The provisioner attempts `service jail onestart redbaron`, then verifies the jail exists with `jls -j redbaron`. `onestart` bypasses the host's boot-time enable flag for this explicit start. For Linux users, `jls` lists running containers and `jexec redbaron command` is the way to execute a command inside this one.

## 6. Install native tools and extract the Linux runtime

Inside the jail, the installer runs:

```sh
jexec redbaron env ASSUME_ALWAYS_YES=yes pkg bootstrap -f
jexec redbaron pkg install -y python313 xorg-vfbserver x11vnc xauth
```

Python 3.13 handles the gateway. Xvfb provides an X server backed by memory, without a monitor or host desktop. x11vnc exports that display. `xauth` is installed, although the supplied Xvfb command disables X access control rather than using a cookie. These programs are native FreeBSD software and do not use libc5.

The RPMs are copied into `/opt/redbaron/rpms` inside the jail and unpacked into its `/compat/linux`. FreeBSD's `bsdtar` can extract an RPM payload directly:

```sh
bsdtar -xf package.i386.rpm -C /usr/local/jails/redbaron/compat/linux
```

This does not run RPM scriptlets, resolve RPM dependencies, or register Linux packages in FreeBSD's package database. The provisioner supplies the necessary setup explicitly.

There are three path views:

| Host path | Path inside the jail | Linux-visible name |
|---|---|---|
| `/usr/local/jails/redbaron/compat/linux/lib/libc.so.5` | `/compat/linux/lib/libc.so.5` | `/lib/libc.so.5` |
| `/usr/local/jails/redbaron/compat/linux/usr/X11R6/lib` | `/compat/linux/usr/X11R6/lib` | `/usr/X11R6/lib` |
| `/usr/local/jails/redbaron/compat/linux/usr/lib/redbaron/redbaron_3.10` | `/compat/linux/usr/lib/redbaron/redbaron_3.10` | `/usr/lib/redbaron/redbaron_3.10` |

Linuxulator's compatibility lookup finds old Linux paths under `/compat/linux`, with fallback for other paths. Thus the executable's interpreter, `/lib/ld-linux.so.1`, can find the imported Linux loader. FreeBSD's native `rtld` does not select this browser's libraries. The compatibility prefix is not a security boundary; the jail supplies the surrounding confinement.

## 7. Restore library aliases and run Linux ldconfig

The installer creates these aliases:

```text
libc.so.5  -> libc.so.5.3.12
libm.so.5  -> libm.so.5.0.6
libdl.so.1 -> libdl.so.1.7.14
```

The executable imports shorter ABI names, while the RPM payloads contain fully versioned filenames. Another loop adds `.so.6` aliases for ICE, SM, X11, Xext, Xmu, Xpm, Xt, and Xtst. One detail should not be generalized: the Xpm payload is `libXpm.so.4.9`. Giving it an additional `.so.6` filename does not change its ABI.

The script writes Linux `/etc/ld.so.conf` with `/lib`, `/usr/lib`, and `/usr/X11R6/lib`, then runs:

```sh
jexec redbaron /compat/linux/sbin/ldconfig
```

That is the old **Linux** utility, which builds the old loader's cache and library links. FreeBSD's native `ldconfig` maintains a different runtime and is not a substitute.

The inspected browser imports `libXt.so.6`, `libX11.so.6`, `libm.so.5`, `libdl.so.1`, and `libc.so.5`. This is why installing FreeBSD's native 32-bit runtime alone cannot satisfy it.

## 8. Create the user, password file, and helper scripts

`pw -R` adds the `redbaron` account to the jail's account database and creates its home. FreeBSD normally administers accounts through `pw`, rather than Linux's `useradd`. The script ignores account-creation failures, so verify an unexpected result with:

```sh
jexec redbaron id redbaron
jexec redbaron getent passwd redbaron
```

It creates `/var/db/redbaron` with mode `0700`, owned by the account. If a VNC password file is absent, it generates a random secret with OpenSSL and calls `x11vnc -storepasswd`. That stores VNC authentication data, not a readable password; we will set a known password below.

The helpers are installed executable at these jail paths:

| Source | Installed file |
|---|---|
| [gateway.py](redbaron-freebsd-jail/gateway.py) | `/usr/local/libexec/redbaron-gateway.py` |
| [redbaron-launch.sh](redbaron-freebsd-jail/redbaron-launch.sh) | `/usr/local/bin/redbaron` |
| [startup.sh](redbaron-freebsd-jail/startup.sh) | `/usr/local/libexec/redbaron-startup` |

The checkout's startup script need not already be executable: `install -m 0755` supplies that permission. The provisioner also adds `127.0.0.1 compat.local` to the jail's `/etc/hosts` unless the name already appears.

## 9. How the display and browser start

The installed launcher uses a native shell:

```sh
export DISPLAY="${DISPLAY:-:99}"
export HOME="${HOME:-/home/redbaron}"
export REDBARON=/compat/linux/usr/lib/redbaron
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
exec "$REDBARON/redbaron_3.10" "$@"
```

`DISPLAY` chooses the X server; `HOME` provides a location for preferences. `REDBARON` points to the extracted resources. The library path uses Linux directory names. `exec` replaces the shell with the Linux executable, preserving arguments through quoted `"$@"`. The RPM's original wrapper is not used, so no old Red Hat shell is needed.

The startup script waits 15 seconds, kills leftover browser/display processes, removes stale display-99 locks, and starts:

```sh
Xvfb :99 -screen 0 1024x768x24 -nolisten tcp -ac
```

This provides a 1024×768 display at 24-bit depth. `-nolisten tcp` keeps X11 on a local Unix socket; `-ac` disables X access control. Use this as a dedicated browser jail, not a shared desktop. The script waits up to about 30 seconds for `/tmp/.X11-unix/X99`.

Next it starts x11vnc with `-noshm` to avoid shared-memory capture, `-forever` to survive viewer disconnects, and `-shared` for simultaneous viewers. It supplies the password file, port 5900, and the hard-coded allowlist. Finally it opens Red Baron at `http://compat.local:8080/` and waits for Xvfb.

Display, VNC, and browser logs are written under the account's home as `redbaron-xvfb.log`, `redbaron-vnc.log`, and `redbaron-browser.log`. This is not a browser watchdog: a crashed browser is not restarted merely because Xvfb remains running.

These five RPMs contain no period bitmap fonts, and the script configures no legacy font path. If fonts are missing, supply them to the **native Xvfb server**, not merely the Linux client. The earlier font setup is described in [baron-invest.md](baron-invest.md).

## 10. Register and manage the FreeBSD service

The generated `/usr/local/etc/rc.d/redbaron` sources `/etc/rc.subr` and declares ordering after `LOGIN`. This is FreeBSD's rc framework, not a systemd unit.

Its start function removes stale PID files and uses `daemon -p ... -u redbaron` to detach the gateway and startup script as the unprivileged account. The PID files are named `redbaron-gateway.pid` and `redbaron-supervisor.pid`, but no `daemon` restart option is used. FreeBSD's [daemon implementation](https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/daemon/daemon.c) sets the selected user's environment.

The stop function kills the browser, x11vnc, Xvfb, startup shell, and processes named `python3.13`, then removes PID and display files. Its process-name kills can affect unrelated Python services in the same jail; keep the jail dedicated.

The provisioner enables the service in the **jail's** `/etc/rc.conf` with `redbaron_enable=YES`. It also sets `clear_tmp_enable=NO`, avoiding automatic clearing of temporary display files. The startup script still removes its own stale locks. Provisioning finishes by stopping and starting the jail so normal guest boot runs the application service.

For predictable recovery after configuration changes:

```sh
service jail onestop redbaron
service jail onestart redbaron
```

For host boot, separately configure the **host's** rc settings, preserving its existing jail list and boot policy:

```sh
sysrc jail_enable=YES
sysrc jail_list+=redbaron
```

The provisioner does not set those host flags. Its generated application service also lacks a complete health check; inspect the processes rather than relying on a generic service status response.

## 11. Set a known VNC password and connect

The README calls `/var/db/redbaron/vnc-password` a host path. That is actually the path inside the jail. On the host, the file is:

```text
/usr/local/jails/redbaron/var/db/redbaron/vnc-password
```

It is an obscured VNC authentication file, not plain text. The random secret is not saved separately. Set a password you know using the interactive, one-argument form:

```sh
jexec redbaron su -l redbaron -c \
  'x11vnc -storepasswd /var/db/redbaron/vnc-password'
service jail onestop redbaron
service jail onestart redbaron
```

Classic VNC authentication uses only the first eight password characters and does not encrypt subsequent screen traffic. These details and the prompt syntax are documented in [x11vnc's help](https://github.com/LibVNC/x11vnc/blob/master/src/help.c).

Wait at least the 15-second startup delay. On a Linux workstation using TigerVNC, connect with an explicit port:

```sh
vncviewer 192.168.3.104::5900
```

X display `:99` does **not** mean VNC port 5999: x11vnc was explicitly told to use 5900. Different viewer applications may express an explicit port differently.

For SSH forwarding from the workstation:

```sh
ssh -N -L 15900:192.168.3.104:5900 user@192.168.3.104
```

In another workstation terminal:

```sh
vncviewer 127.0.0.1::15900
```

The forward targets the host's LAN address because that is the jail's configured address. Check the x11vnc allowlist against the resulting connection. A tunnel protects that session but does not remove the existing LAN listener.

## 12. Use the gateway, understanding its limits

In Red Baron, open `http://compat.local:8080/` and enter an HTTP or HTTPS URL. Modern Python/OpenSSL fetches the page and returns HTTP/1.0 to the old browser.

[gateway.py](redbaron-freebsd-jail/gateway.py) works as follows:

1. `/` displays a URL-entry form.
2. `/go?url=...` checks for an HTTP/HTTPS scheme and redirects to a gateway URL.
3. `/fetch/https/example.org/path`, or the HTTP equivalent, fetches upstream.
4. For HTML, it removes some active-content elements and rewrites quoted `href`, `src`, and `action` attributes through the gateway, resolving relative links against the final upstream URL.
5. It returns rewritten HTML as UTF-8 and passes other response content through.

It uses certificate verification, a 20-second upstream timeout, gzip support, and an 8 MiB check on the initially read response. The check precedes decompression, so it does not cap decompressed content. Errors produce gateway error pages.

This is not WRP or a modern rendering engine. It does not execute JavaScript, render modern CSS into images, forward POST requests, or implement a complete upstream cookie/login session. Its regular-expression rewriting is limited and is not a security sanitizer. Some modern sites will remain unusable. Keep it for simple documents and controlled demonstrations, without sensitive logins or public proxy access.

Defaults are `COMPAT_LISTEN=127.0.0.1`, `COMPAT_PORT=8080`, and public base `http://compat.local:8080`. The generated rc service does not explicitly set them, and changing an interactive shell's environment does not reconfigure a running daemon. Remember shared-IP loopback redirection when checking network exposure.

## 13. Check each layer separately

Start with the jail, display, and listeners:

```sh
jls -j redbaron
jexec redbaron ps ax -o user,pid,command
sockstat -4 -l
jexec redbaron ls -l /tmp/.X11-unix/X99
jexec redbaron fetch -o - http://compat.local:8080/
```

Expect the gateway, startup shell, Xvfb, x11vnc, and browser. Inspect actual addresses for ports 5900 and 8080. A working VNC connection with a blank screen does not prove the browser survived startup.

Ask the Linux loader about dependencies without opening another window:

```sh
jexec redbaron /bin/sh -c \
  'LD_TRACE_LOADED_OBJECTS=1 LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib /compat/linux/usr/lib/redbaron/redbaron_3.10'
```

Then read the logs:

```sh
jexec redbaron tail -n 60 /home/redbaron/redbaron-xvfb.log
jexec redbaron tail -n 60 /home/redbaron/redbaron-vnc.log
jexec redbaron tail -n 60 /home/redbaron/redbaron-browser.log
```

If they are absent, check the account's home and startup environment. The gateway has no dedicated logfile in the generated service. For TLS problems, inspect DNS, the clock, the upstream error, and Python's CA trust paths; do not turn certificate verification off.

## 14. Test the preload boundary

The new [diagnostics/preload](diagnostics/preload/README.md) files test which loader reaches initialization. They do **not** replace the allocator.

| File | Role |
|---|---|
| `freebsd32-control` | Native FreeBSD i386 main-program marker. |
| `freebsd32-preload.so` | Native constructor probe for `LD_32_PRELOAD`. |
| `linux-i386-preload.so` | Freestanding Linux constructor probe for `LD_PRELOAD`. |
| `build.sh` | Rebuilds the controls and Linux probe. |
| `run.sh` | Runs comparisons in the `redbaron` jail and checks recent kernel messages. |

The Linux probe exports `_init` and writes `LINUX_LD_PRELOAD_LOADED` to standard error using raw Linux `write`, syscall 4. It defines none of the allocation functions.

### First establish the native control

The native binaries need a compatible FreeBSD i386 runtime. To rebuild, `build.sh` defaults to `/usr/local/bin/i386-unknown-freebsd15.0-gcc15` and `/usr/local/freebsd-sysroot/i386`. The provisioner does not install these. Supply a suitable cross compiler/sysroot through `I386_GCC` and `I386_SYSROOT` if necessary.

From the project root, with those prerequisites present:

```sh
sh diagnostics/preload/build.sh
env LD_32_LIBRARY_PATH=/usr/local/freebsd-sysroot/i386/lib \
  LD_32_PRELOAD="$PWD/diagnostics/preload/freebsd32-preload.so" \
  ./diagnostics/preload/freebsd32-control
```

Expected output:

```text
FREEBSD_LD_32_PRELOAD_LOADED
FREEBSD32_CONTROL_MAIN
```

This tests native FreeBSD i386 independently of Linuxulator. The command uses `LD_32_LIBRARY_PATH`; the supplied runner instead sets unprefixed `LD_LIBRARY_PATH`. That is not the native 32-bit loader's library-path variable, although an installed lib32 runtime might mask the difference. FreeBSD documents the prefix in its [rtld manual](https://github.com/freebsd/freebsd-src/blob/main/libexec/rtld-elf/rtld.1).

### Make a compatible Linux probe

Inspection of the supplied Linux `.so` found only `GNU_HASH`, not a traditional ELF `HASH`. Its source also changes `%ebx` without restoring it when returning to the loader. For a libc5-era loader, avoid depending on GNU-hash support and preserve the i386 calling convention's callee-saved register. Otherwise the diagnostic itself can complicate the result.

Build this equivalent probe separately, leaving the supplied files intact:

```sh
mkdir -p /tmp/redbaron-preload-check
cat > /tmp/redbaron-preload-check/probe.S <<'EOF'
    .section .rodata
message:
    .ascii "LINUX_LD_PRELOAD_LOADED\n"
message_end:
    .section .init,"ax",@progbits
    .globl _init
    .type _init,@function
_init:
    pushl %ebx
    movl $4, %eax
    movl $2, %ebx
    call 1f
1:  popl %ecx
    addl $(message-1b), %ecx
    movl $(message_end-message), %edx
    int $0x80
    popl %ebx
    ret
    .section .note.GNU-stack,"",@progbits
EOF
clang --target=i386-unknown-linux-gnu -m32 -nostdlib -fPIC -shared \
  -Wl,--hash-style=sysv,-soname,linux-i386-preload.so \
  -o /tmp/redbaron-preload-check/linux-i386-preload.so \
  /tmp/redbaron-preload-check/probe.S
readelf -d /tmp/redbaron-preload-check/linux-i386-preload.so
```

The dynamic section should show `INIT` and `HASH`, without `NEEDED` dependencies. No libc or startup objects are required.

Copy that probe into the jail:

```sh
install -d -m 0755 /usr/local/jails/redbaron/opt/redbaron/diagnostics
install -m 0644 /tmp/redbaron-preload-check/linux-i386-preload.so \
  /usr/local/jails/redbaron/opt/redbaron/diagnostics/linux-i386-preload.so
```

With display `:99` running, test without changing the installed launcher:

```sh
jexec redbaron su -l redbaron -c '
  export DISPLAY=:99
  export REDBARON=/compat/linux/usr/lib/redbaron
  export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
  export LD_PRELOAD=/opt/redbaron/diagnostics/linux-i386-preload.so
  exec "$REDBARON/redbaron_3.10" http://compat.local:8080/
'
```

The variables are exported inside an already-running shell immediately before its Linux `exec`. This avoids asking an intervening native FreeBSD executable to preload a Linux library. `/opt/redbaron/diagnostics` is a jail path reachable through compatibility lookup's fallback.

If initialization is reached, expect:

```text
LINUX_LD_PRELOAD_LOADED
```

Close a successful diagnostic browser before another test. The supplied `run.sh` likewise runs browser commands sequentially and can wait for a working browser to exit. It requires `doas`, copies only the Linux probe into the jail, suppresses browser exit failures with `|| true`, and checks only recent `dmesg` lines. Its FreeBSD-preload comparison names a library it does not install in the jail. Treat it as a diagnostic runner, not an automated installation acceptance test.

A Linux marker proves that the loader called this probe's initializer. A missing marker alone does **not** prove no preload object was mapped or that allocator interposition is impossible. Loading, relocations, ELF compatibility, and initialization order can all matter; a preloaded function can be bound before constructors run. The diagnostic README's stronger interpretation requires additional trace evidence.

`LD_32_PRELOAD` belongs to native FreeBSD's 32-bit runtime linker. Red Baron's Linux loader uses `LD_PRELOAD`. Equal pointer sizes do not make the loaders interchangeable.

## 15. The allocator repair is a separate installation step

Neither `provision.sh` nor its launcher installs or enables `libredbaron_compat.so`. The marker probe does not supply it. Do not assume that running this provisioner automatically fixes the allocator failure in the earlier investigation.

[baron-invest.md](baron-invest.md) documents libc5 returning a null allocation, followed by Red Baron passing it to `strcpy`. Its mapping allocator allowed startup in that recorded setup. Appendix A contains the full source and the article supplies build commands.

If a trace of this jail reproduces that failure and establishes a usable interposition path, build the documented allocator and install it into this jail:

```sh
# Run from the directory containing the built allocator library.
install -m 0755 libredbaron_compat.so \
  /usr/local/jails/redbaron/compat/linux/usr/lib/redbaron/libredbaron_compat.so
```

Add this line to the installed `/usr/local/bin/redbaron` inside the jail before its final `exec`:

```sh
export LD_PRELOAD=/usr/lib/redbaron/libredbaron_compat.so
```

Use the Linux-visible library path, restart the jail, and collect new results. If you retain this repair, also update your repository launcher and provisioning recipe: the current provisioner otherwise overwrites the installed launcher on a later run. Installing the diagnostic marker in place of the allocator does not repair allocation.

The earlier success is evidence for its recorded environment, not a guarantee for this smaller runtime or every later browsing workload.

## Troubleshooting by symptom

| Symptom | Next check |
|---|---|
| Release copy fails | Exact Bastille release path; incomplete jail root. |
| Jail configuration error | `.include` spelling and the individual jail definition. |
| Package DNS failures | Copied resolver configuration and jail reachability. |
| Linux executable does not start | Host i386 Linuxulator support and extracted interpreter. |
| Missing libraries | Aliases, Linux `ld.so.conf`, Linux `ldconfig`, search path. |
| VNC refuses connection | Startup delay, listener, firewall, allowlist, VNC log. |
| Unknown VNC password | Reset interactively; the stored file is not plain text. |
| Blank display | Browser process and log; Xvfb can outlive the browser. |
| Startup SIGSEGV | Trace/core, preload diagnostic, and its limitations above. |
| HTTPS error | Gateway error, DNS, clock, CA trust configuration. |
| Modern site still fails | Gateway has no modern renderer, JavaScript, or full session support. |

This installation combines a small historical Linux runtime with native FreeBSD services. Keeping that split clear makes it easier to identify whether a failure belongs to the jail, the Linux loader, the browser, the display, or the gateway.

*Validation note: this post was checked against the supplied scripts, RPM payload listings, ELF metadata, and preload sources. Shell syntax and the separate corrected probe build were checked. The jail provisioner, VNC session, and complete browser installation were not run for this article.*
