From 7addbfdc27b6decb348a863ac33c2a1a96f75684 Mon Sep 17 00:00:00 2001 From: Nicolas MASSE Date: Sun, 25 Oct 2026 17:12:23 +0100 Subject: [PATCH] asterisk: create /var/lib/quadlets/asterisk from the package, not tmpfiles On the first boot of Fedora CoreOS, rpm-ostree applies qemu-guest-agent live and runs "systemd-tmpfiles --create --prefix=/var" after the containers have started. The "d" line reset the SELinux label of the directory Podman had relabeled, and every REGISTER then failed with "ast_db_put: SQL logic error". The package now creates the directory and its spool and log sub-directories, once. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UJKweojs6NK5svZwRgQjQH --- cookbooks/asterisk/Makefile | 8 ++++++++ cookbooks/asterisk/tmpfiles.d/asterisk.conf | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cookbooks/asterisk/Makefile b/cookbooks/asterisk/Makefile index 14560f8..1ceac41 100644 --- a/cookbooks/asterisk/Makefile +++ b/cookbooks/asterisk/Makefile @@ -6,5 +6,13 @@ PROJECT_UID = 10036 PROJECT_GID = 10000 +# Spool and logs of Asterisk, created by the package and not by systemd-tmpfiles: +# see the comment in tmpfiles.d/asterisk.conf. +TARGET_FILES += $(TARGET_CHROOT)/var/lib/quadlets/asterisk/spool +TARGET_FILES += $(TARGET_CHROOT)/var/lib/quadlets/asterisk/log + # Include common Makefile include ../../scripts/common.mk + +$(TARGET_CHROOT)/var/lib/quadlets/asterisk/spool $(TARGET_CHROOT)/var/lib/quadlets/asterisk/log: $(TARGET_CHROOT)/var/lib/quadlets/asterisk + install -d -m 0750 -o $(PROJECT_UID) -g $(PROJECT_GID) $@ diff --git a/cookbooks/asterisk/tmpfiles.d/asterisk.conf b/cookbooks/asterisk/tmpfiles.d/asterisk.conf index c9b0d20..ac4d098 100644 --- a/cookbooks/asterisk/tmpfiles.d/asterisk.conf +++ b/cookbooks/asterisk/tmpfiles.d/asterisk.conf @@ -1,11 +1,15 @@ -# Internal database, spool and logs of Asterisk. Not precious: no voicemail, -# no recordings. -d /var/lib/quadlets/asterisk 0750 10036 10000 - -d /var/lib/quadlets/asterisk/spool 0750 10036 10000 - -d /var/lib/quadlets/asterisk/log 0750 10036 10000 - - # Provisioning files of the phones, served over TFTP. Operator-provided, on the # precious-data mount so that the host can write them. The "$" marks it for # removal on `systemd-tmpfiles --purge` (i.e. `make uninstall`). +# +# /var/lib/quadlets/asterisk is NOT declared here, and must not be. The package +# creates it, once. A "d" line adjusts the directory again at every run of +# systemd-tmpfiles, and resets its SELinux label to var_lib_t on the way. Such a +# run happens AFTER the containers start on the first boot of a Fedora CoreOS +# machine: rpm-ostree applies the qemu-guest-agent package live, then runs +# "systemd-tmpfiles --create --prefix=/var". Asterisk then loses access to the +# directory Podman had just relabeled, and every REGISTER fails with +# "ast_db_put: SQL logic error". Measured on 2026-10-25. The virtiofs mount is +# not affected: its label is fixed by the mount. d$ /var/lib/virtiofs/data/asterisk 0750 10036 10000 - d$ /var/lib/virtiofs/data/asterisk/tftp 0750 10036 10000 -