]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: drop legacy FactoryReset EFI variable
authordongshengyuan <545258830@qq.com>
Mon, 27 Jul 2026 01:50:57 +0000 (09:50 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 28 Jul 2026 10:51:45 +0000 (19:51 +0900)
Follow-up for 9e050b0458930b96dc9abebd822ab0b8fe2b14aa.

NEWS
TODO.md
src/repart/repart.c

diff --git a/NEWS b/NEWS
index 2c760d481614963ee7244dad22552252b263319e..5e451eb82c4f885471d230938d6d57a1cd54119d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ CHANGES WITH 262:
           the symlink target. Previously, these were only expanded in the
           source.
 
+        * systemd-repart no longer honors the legacy "FactoryReset" EFI
+          variable in the initrd. The newer "FactoryResetRequest" EFI variable
+          remains supported and should be used instead.
+
         * As part of changes to systemd-sysupdate, the existing
           "systemd-sysupdate.service" and "systemd-sysupdate.timer" units –
           which periodically ran "systemd-sysupdate" to update the host system –
diff --git a/TODO.md b/TODO.md
index 3ad7ec7bda8749843cfeea55db033080502b6e75..0be8601cb4ec8f86f849ea15b335afcc2c9d1bd1 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -118,9 +118,6 @@ SPDX-License-Identifier: LGPL-2.1-or-later
   That requires distros to enable CONFIG_ACPI_FPDT, and have kernels v5.12 for
   x86 and v6.2 for arm.
 
-- Remove support for deprecated FactoryReset EFI variable in
-  systemd-repart, replaced by FactoryResetRequest (was planned for v260).
-
 - Consider removing root=gpt-auto, and push people to use root=dissect instead.
 
 - remove any trace of "cpuacct" cgroup controller, it's a cgroupv1 thing.
index 48a6352c2f78f13014aad1b6b63ebd5bf45d887c..ae41fc0d2e524ea46ee5275b940af915c9e4eb4b 100644 (file)
@@ -32,7 +32,6 @@
 #include "devnum-util.h"
 #include "dirent-util.h"
 #include "dissect-image.h"
-#include "efivars.h"
 #include "errno-util.h"
 #include "extract-word.h"
 #include "factory-reset.h"
@@ -10924,54 +10923,6 @@ static int parse_proc_cmdline_factory_reset(void) {
         return 0;
 }
 
-static int parse_efi_variable_factory_reset(void) {
-        _cleanup_free_ char *value = NULL;
-        int r;
-
-        /* NB: This is legacy, people should move to the newer FactoryResetRequest variable! */
-
-        // FIXME: Remove this in v260
-
-        if (arg_factory_reset >= 0) /* Never override what is specified on the process command line */
-                return 0;
-
-        if (!in_initrd()) /* Never honour EFI variable factory reset request outside of the initrd */
-                return 0;
-
-        r = efi_get_variable_string(EFI_SYSTEMD_VARIABLE_STR("FactoryReset"), &value);
-        if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r))
-                return 0;
-        if (r < 0)
-                return log_error_errno(r, "Failed to read EFI variable FactoryReset: %m");
-
-        log_warning("Warning, EFI variable FactoryReset is in use, please migrate to use FactoryResetRequest instead, support will be removed in v260!");
-
-        r = parse_boolean(value);
-        if (r < 0)
-                return log_error_errno(r, "Failed to parse EFI variable FactoryReset: %m");
-
-        arg_factory_reset = r;
-        if (r)
-                log_notice("Factory reset requested via EFI variable FactoryReset.");
-
-        return 0;
-}
-
-static int remove_efi_variable_factory_reset(void) {
-        int r;
-
-        // FIXME: Remove this in v260, see above
-
-        r = efi_set_variable(EFI_SYSTEMD_VARIABLE_STR("FactoryReset"), NULL, 0);
-        if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r))
-                return 0;
-        if (r < 0)
-                return log_error_errno(r, "Failed to remove EFI variable FactoryReset: %m");
-
-        log_info("Successfully unset EFI variable FactoryReset.");
-        return 0;
-}
-
 static int acquire_root_devno(
                 const char *p,
                 const char *root,
@@ -11745,10 +11696,6 @@ static int run(int argc, char *argv[]) {
         if (r < 0)
                 return r;
 
-        r = parse_efi_variable_factory_reset();
-        if (r < 0)
-                return r;
-
         if (arg_image) {
                 assert(!arg_root);
 
@@ -11883,11 +11830,6 @@ static int run(int argc, char *argv[]) {
         if (r < 0)
                 return r;
         if (r > 0) {
-                /* We actually did a factory reset! */
-                r = remove_efi_variable_factory_reset();
-                if (r < 0)
-                        return r;
-
                 /* Reload the reduced partition table */
                 context_unload_partition_table(context);
                 r = context_load_partition_table(context);