From 4f4d36b0ea469594a8c15c35cd92f35153fce071 Mon Sep 17 00:00:00 2001 From: 123kupola Date: Thu, 4 Jun 2026 09:53:55 +0200 Subject: [PATCH] fix(rc.d): use child pidfile + unique procname for colibri-daemon (Sam & Hermes) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix three bugs identified in live USB diagnostics (COLIBRI-XFCE-HANDOFF-04.JUN.2026): 1. procname collision: 'colibri-daemon' instead of '/usr/sbin/daemon' so service status finds OUR process, not tailscaled or any other daemon(8)-managed service. 2. pidfile flag: -p (child pidfile) instead of -P (supervisor pidfile) so the pidfile holds the colibri-daemon PID, which rc.subr can match against the unique procname. 3. Cascading bypass: fixing procname prevents rc.subr from skipping daemon(8) entirely. Process tree should now be: rc.d → daemon(8) → colibri-daemon (with crash restart) --- packaging/freebsd/colibri_daemon.in | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packaging/freebsd/colibri_daemon.in b/packaging/freebsd/colibri_daemon.in index 84c9fbb..57c526b 100644 --- a/packaging/freebsd/colibri_daemon.in +++ b/packaging/freebsd/colibri_daemon.in @@ -4,8 +4,8 @@ # # colibri-daemon runs in the FOREGROUND — it does not self-daemonize or write a # pidfile. rc.d runs it under daemon(8), which backgrounds it, writes the -# supervisor pidfile, restarts on crash, drops privileges to the colibri user, -# and redirects stdout/stderr (tracing) to a logfile. +# child pidfile (colibri-daemon PID), restarts on crash, drops privileges to +# the colibri user, and redirects stdout/stderr (tracing) to a logfile. # # Setup (one-time, as root): # pw groupadd colibri @@ -48,15 +48,17 @@ load_rc_config $name pidfile="${colibri_daemon_run_dir}/colibri-daemon.pid" -# Run colibri-daemon under daemon(8): -P supervisor pidfile, -r restart on exit, -# -t process title, -u drop to the colibri user, -o append stdout/stderr to log. +# Run colibri-daemon under daemon(8): -p child pidfile (writes colibri-daemon PID), +# -r restart on exit, -t process title, -u drop to the colibri user, -o append +# stdout/stderr to log. command="/usr/sbin/daemon" -command_args="-P ${pidfile} -r -t ${name} -u ${colibri_daemon_user} \ +command_args="-p ${pidfile} -r -t ${name} -u ${colibri_daemon_user} \ -o ${colibri_daemon_logfile} ${colibri_daemon_program}" -# rc.subr matches the pidfile's process against ${procname}; that is daemon(8), -# not colibri-daemon, since daemon(8) is the supervised parent. -procname="/usr/sbin/daemon" +# Use the child's process name so rc.subr can find the right process via the +# child pidfile. Using the daemon(8) supervisor path would collide with +# tailscaled and other daemon(8)-managed services on the system. +procname="colibri-daemon" start_precmd="colibri_daemon_prestart" start_postcmd="colibri_daemon_poststart" -- 2.45.3