From 651b44bddaeb7d48a970b4b16f2877c37d93f1a2 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 5 Mar 2025 15:54:26 +0100 Subject: [PATCH] units: refuse manual operations on factory-reset-now.target and friends It is strictly mandatory that this is done during initial transaction, and not later when the system is already running. Hence let's refuse manual start for all of the involved units. Additionally, refuse manual stop for systemd-factory-reset-complete.service, as it flags the factory reset completion through /run/systemd/factory-reset-complete, which never gets removed for the whole boot. --- units/factory-reset-now.target | 1 + units/systemd-factory-reset-complete.service.in | 2 ++ 2 files changed, 3 insertions(+) diff --git a/units/factory-reset-now.target b/units/factory-reset-now.target index 6415cc1232e..008d565b17c 100644 --- a/units/factory-reset-now.target +++ b/units/factory-reset-now.target @@ -11,3 +11,4 @@ Description=Factory Reset Execution Documentation=man:systemd.special(7) Wants=systemd-factory-reset-complete.service +RefuseManualStart=yes diff --git a/units/systemd-factory-reset-complete.service.in b/units/systemd-factory-reset-complete.service.in index 337b99d3d42..aa0913dbe69 100644 --- a/units/systemd-factory-reset-complete.service.in +++ b/units/systemd-factory-reset-complete.service.in @@ -15,6 +15,8 @@ Requires=factory-reset-now.target After=factory-reset-now.target Conflicts=shutdown.target Before=shutdown.target +RefuseManualStart=yes +RefuseManualStop=yes [Service] Type=oneshot -- 2.47.3