From: dongshengyuan <545258830@qq.com> Date: Mon, 27 Jul 2026 01:50:57 +0000 (+0800) Subject: repart: drop legacy FactoryReset EFI variable X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d73f3879f084b7e98002d2545a08c8a52fa01c18;p=thirdparty%2Fsystemd.git repart: drop legacy FactoryReset EFI variable Follow-up for 9e050b0458930b96dc9abebd822ab0b8fe2b14aa. --- diff --git a/NEWS b/NEWS index 2c760d48161..5e451eb82c4 100644 --- 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 3ad7ec7bda8..0be8601cb4e 100644 --- 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. diff --git a/src/repart/repart.c b/src/repart/repart.c index 48a6352c2f7..ae41fc0d2e5 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -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);