52b84b
From d9ae3222cfbd5d2a48e6dbade6617085cc76f1c1 Mon Sep 17 00:00:00 2001
52b84b
From: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
52b84b
Date: Tue, 25 Feb 2020 13:35:50 -0500
52b84b
Subject: [PATCH] resolved: Recover missing PrivateTmp=yes and
52b84b
 ProtectSystem=strict
52b84b
52b84b
Since the commit b61e8046ebcb28225423fc0073183d68d4c577c4,
52b84b
systemd-resolved.service often fails to start with the following message:
52b84b
52b84b
    Failed at step NAMESPACE spawning /usr/bin/mount: Read-only file system
52b84b
52b84b
This is because dropping DynamicUser=yes dropped implicit PrivateTmp=yes and
52b84b
also implicit After=systemd-tmpfiles-setup.service, and thus
52b84b
systemd-resolved.service can start before systemd-remount-fs.service. As a
52b84b
result, mount operations associated with PrivateDevices= can be performed to
52b84b
still read-only filesystems.
52b84b
52b84b
To fix this issue, it's better to recover PrivateTmp=yes and
52b84b
ProtectSystem=strict just as the upstream commit
52b84b
62fb7e80fcc45a1530ed58a84980be8cfafa9b3e (Revert "resolve: enable DynamicUser=
52b84b
for systemd-resolved.service").
52b84b
52b84b
Resolves: #1810869
52b84b
---
52b84b
 units/systemd-resolved.service.in | 2 ++
52b84b
 1 file changed, 2 insertions(+)
52b84b
52b84b
diff --git a/units/systemd-resolved.service.in b/units/systemd-resolved.service.in
52b84b
index 6c2ad5ca86..aad1a53a5f 100644
52b84b
--- a/units/systemd-resolved.service.in
52b84b
+++ b/units/systemd-resolved.service.in
52b84b
@@ -28,7 +28,9 @@ WatchdogSec=3min
52b84b
 User=systemd-resolve
52b84b
 CapabilityBoundingSet=CAP_SETPCAP CAP_NET_RAW CAP_NET_BIND_SERVICE
52b84b
 AmbientCapabilities=CAP_SETPCAP CAP_NET_RAW CAP_NET_BIND_SERVICE
52b84b
+PrivateTmp=yes
52b84b
 PrivateDevices=yes
52b84b
+ProtectSystems=strict
52b84b
 ProtectHome=yes
52b84b
 ProtectControlGroups=yes
52b84b
 ProtectKernelTunables=yes