[Bug 271069] syslogd service inside client jail requires restart before server jail receives logs

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 31 May 2023 22:55:06 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271069

--- Comment #3 from Siva Mahadevan <me@svmhdvn.name> ---
Revisiting this because the bug shows up consistently and with different
services as well.

I've reduced it to a smaller repro case. Not sure what's going on (but I do
have the time to debug this and send a patch once the problem is clear), so
please let me know if you have any pointers on what to try next for debugging
this.

Repro instructions:
1. Fresh install FreeBSD 13.2-RELEASE (jailhost.home.arpa)
2. Add the following /etc/jail.conf

===== /etc/jail.conf =====
mount.devfs;
allow.raw_sockets;
exec.clean;
exec.timeout = 30;
stop.timeout = 30;
path = "/j/${name}";
host.hostname = "${name}.home.arpa";
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
myjail {
    ip6.addr = "re0|fdac::aaaa:202/64";
}
==========================

3. Install a fresh 13.2-RELEASE jail with `bsdinstall jail /j/myjail`
4. Add the following /j/myjail/etc/rc.conf

===== /j/myjail/etc/rc.conf =====
dumpdev="NO"    
sendmail_enable="NO"    
sendmail_msp_queue_enable="NO"    
sendmail_outbound_enable="NO"    
sendmail_submit_enable="NO"

sshd_enable="YES"
=================================

5. Start the jail verbosely to confirm that rc starts sshd: `jail -vc myjail`

myjail: run command: /sbin/ifconfig re0 inet6 fdac::aaaa:202/64 alias
myjail: run command: /sbin/mount -t devfs -oruleset=4 . /j/myjail/dev
myjail: jail_set(JAIL_CREATE) persist name=myjail allow.raw_sockets
path=/j/myjail host.hostname=myjail.home.arpa ip6.addr=fdac::aaaa:202
myjail: created
myjail: run command in jail: /bin/sh /etc/rc
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
Updating motd:.
Creating and/or trimming log files.
Clearing /tmp (X related).
Updating /var/run/os-release done.
Starting syslogd.
Performing sanity check on sshd configuration.
Starting sshd.
Starting cron.

Wed May 31 18:48:36 EDT 2023
myjail: jail_set(JAIL_UPDATE) jid=1 nopersist

6. Check running processes inside jail and confirm that sshd is *not* running:
`ps -J myjail`

 PID TT  STAT    TIME COMMAND
1151  -  IsJ  0:00.01 /usr/sbin/syslogd -s
1207  -  SsJ  0:00.01 /usr/sbin/cron -s

7. Log into the jail and restart sshd, confirm that it *does* run successfully:

```
(jailhost) jexec myjail sh
(myjail) service sshd restart
```

-- 
You are receiving this mail because:
You are the assignee for the bug.