# Jails rc.conf bug? - Combo of Settings Prevents Jail Creation



## BawdyAnarchist (Aug 26, 2020)

The following combination of rc.conf settings inside a jail, will prevent it from persisting after initial creation.

```
syslogd_enable="NO"
cron_enable="NO"
sendmail_enable="NONE"
sshd_enable="NO"
```

The jail will initially create, appear to be successful, but will immediately disappear from both `jls` and `ps ax` with no apparent error message.  Changing any single one of the above will enable successful and persistent jail creation.  If none are changed, then `jail -vc _base` will finish but the jail will disappear.  It ends with these lines:


```
<...snip...>
Creating and/or trimming log files.
Clearing /tmp (X related).
Updating motd:.

Wed Aug 26 01:45:07 CDT 2020
_base: jail_set(JAIL_UPDATE) jid=60 nopersist
root@host:~ #
```

This is a cleanly installed _base, with no users created, and only pkg and doas installed.  jid=60 because that's how many times I started/stopped this for troubleshooting, as I deleted the other standard rc.conf entries one by one, because they seemed to have no effect.  Also, there are no other jails running, or packages running except Xorg, i3, nvidia, and xterm.  My host install is fairly clean.

Here is my /etc/jail.conf:


```
host.hostname="$name";
path="/jails/$name";
mount.devfs;
allow.mount.fdescfs;
vnet;
exec.clean;
exec.start="sh /etc/rc";
exec.stop="sh /etc/rc.shutdown";

_base {
}
```

If some of you more experienced folk believe this is a bug, let me know and I'll file a bug report.  Or if not, please help me understand what the heck is happening here.  I lost a solid 4 hours today figuring this out.


----------



## Bobi B. (Aug 26, 2020)

Set `persist` flag; search for "persist" in jail(8) and jail.conf(5):

```
persist
             Setting this boolean parameter allows a jail to exist without any
             processes.  Normally, a command is run as part of jail creation,
             and then the jail is destroyed as its last process exits.  A new
             jail must have either the persist parameter or exec.start or
             command pseudo-parameter set.
```


----------



## Bobi B. (Aug 26, 2020)

anonymous9 said:


> Their /etc/jail.conf already has
> 
> ```
> exec.start="sh /etc/rc";
> ```


That is correct, except if there are no daemons enabled there would be no processes left running in this jail once /etc/rc completes.


----------



## BawdyAnarchist (Aug 26, 2020)

Bobi B. said:


> Set `persist` flag; search for "persist" in jail(8) and jail.conf(5):
> 
> ```
> persist
> ...


 
I swear I thought I checked `man jail` for "persist" because I saw the "nopersist" at the bottom just before the jail died.  Maybe it was late and I only searched for "nopersist" and missed the parameter.  Thanks.  I guess I can never read the man pages carefully enough.


----------

