b11b5f
From 3c2d2345814935cea8525e802e764fb2949eb3df Mon Sep 17 00:00:00 2001
b11b5f
From: Luca Boccassi <luca.boccassi@microsoft.com>
b11b5f
Date: Mon, 27 Dec 2021 18:22:43 +0000
b11b5f
Subject: [PATCH] core: do not touch /run/systemd/systemd-units-load from user
b11b5f
 session instances
b11b5f
b11b5f
Follow-up for: https://github.com/systemd/systemd/commit/15b9243c0d7f6d1531fa65dbc01bd11e8e6c12ca
b11b5f
Fixes: https://github.com/systemd/systemd/issues/21911
b11b5f
b11b5f
(cherry picked from commit 4b3ad81bfafcd97acb06db463495e348d159d8e6)
b11b5f
b11b5f
Related: #2136869
b11b5f
---
b11b5f
 src/core/manager.c | 7 ++++---
b11b5f
 1 file changed, 4 insertions(+), 3 deletions(-)
b11b5f
b11b5f
diff --git a/src/core/manager.c b/src/core/manager.c
b11b5f
index a9cd51b624..e083596e58 100644
b11b5f
--- a/src/core/manager.c
b11b5f
+++ b/src/core/manager.c
b11b5f
@@ -3555,9 +3555,10 @@ int manager_reload(Manager *m) {
b11b5f
         manager_catchup(m);
b11b5f
 
b11b5f
         /* Create a file which will indicate when the manager started loading units the last time. */
b11b5f
-        (void) touch_file("/run/systemd/systemd-units-load", false,
b11b5f
-                m->timestamps[MANAGER_TIMESTAMP_UNITS_LOAD].realtime ?: now(CLOCK_REALTIME),
b11b5f
-                UID_INVALID, GID_INVALID, 0444);
b11b5f
+        if (MANAGER_IS_SYSTEM(m))
b11b5f
+                (void) touch_file("/run/systemd/systemd-units-load", false,
b11b5f
+                        m->timestamps[MANAGER_TIMESTAMP_UNITS_LOAD].realtime ?: now(CLOCK_REALTIME),
b11b5f
+                        UID_INVALID, GID_INVALID, 0444);
b11b5f
 
b11b5f
         /* Sync current state of bus names with our set of listening units */
b11b5f
         q = manager_enqueue_sync_bus_names(m);