core: tolerate kernels without POSIX mqueue support

PrivateIPC= sets up a private mqueue mount for the service. When
CONFIG_POSIX_MQUEUE is disabled, mounting mqueue fails with ENODEV and
prevents the service from starting.

Treat ENODEV as an unavailable optional kernel feature while preserving
the private IPC namespace. Keep all other mount errors fatal.

Add coverage verifying that PrivateIPC= still creates a separate IPC
namespace when POSIX message queues are unavailable.

Fixes #42582

(cherry picked from commit 9d217e051b)
(cherry picked from commit 104bbafc9a)
This commit is contained in:
gkehren authored and Luca Boccassi committed 2026-09-10 20:25:52 +01:00
1 parent 799c747255
commit 5bfb8d2585
2 files changed
+13

No files matched your search

+2
View File
@@ -1641,6 +1641,8 @@ static int mount_mqueuefs(const MountEntry *m) {
(void) umount_recursive(entry_path, 0);
r = mount_nofollow_verbose(LOG_DEBUG, "mqueue", entry_path, "mqueue", m->flags, mount_entry_options(m));
if (r == -ENODEV) /* POSIX message queues may be disabled in the kernel. */
return 0;
if (r < 0)
return r;
@@ -3,6 +3,17 @@
set -eux
set -o pipefail
# Verify PrivateIPC= works and creates a separate IPC namespace even if POSIX
# message queues are not supported.
host_ipcns=$(readlink /proc/self/ns/ipc)
private_ipcns=$(systemd-run --quiet --wait --pipe -p PrivateIPC=yes readlink /proc/self/ns/ipc)
[[ "$private_ipcns" != "$host_ipcns" ]]
if [[ ! -d /proc/sys/fs/mqueue ]]; then
echo "POSIX message queues are not supported, skipping ownership checks"
exit 0
fi
# Verify ownership attributes are applied to message queues
# Select arbitrary non-default attributes to apply to the queue.