From: Yu Watanabe Date: Tue, 6 Jan 2026 18:00:18 +0000 (+0900) Subject: Drop support for SysV rc-local script support X-Git-Tag: v260-rc1~384^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d207be293c08c85620789e42a7d5c665a9df0ec3;p=thirdparty%2Fsystemd.git Drop support for SysV rc-local script support As already announced for several years. --- diff --git a/.github/labeler.yml b/.github/labeler.yml index 0d2549240c2..65ac9750252 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -172,9 +172,6 @@ pstore: random-seed: - changed-files: - any-glob-to-any-file: '**/*random-seed*' -rc-local-generator: - - changed-files: - - any-glob-to-any-file: 'src/rc-local-generator/*' remount-fs: - changed-files: - any-glob-to-any-file: '**/*remount-fs*' diff --git a/docs/DISTRO_PORTING.md b/docs/DISTRO_PORTING.md index fc25d91d70c..159cdd13b46 100644 --- a/docs/DISTRO_PORTING.md +++ b/docs/DISTRO_PORTING.md @@ -13,7 +13,6 @@ You need to make the follow changes to adapt systemd to your distribution: 1. Find the right configure parameters for: - * `-Drc-local=` * `-Dloadkeys-path=` * `-Dsetfont-path=` * `-Dtty-gid=` diff --git a/man/custom-entities.ent.in b/man/custom-entities.ent.in index 1f3ecefe614..6c2738d9080 100644 --- a/man/custom-entities.ent.in +++ b/man/custom-entities.ent.in @@ -12,7 +12,6 @@ - diff --git a/man/rules/meson.build b/man/rules/meson.build index 4868a227090..d062187d6ba 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -1130,10 +1130,6 @@ manpages = [ '8', ['systemd-random-seed'], 'ENABLE_RANDOMSEED'], - ['systemd-rc-local-generator', - '8', - ['rc-local.service'], - 'HAVE_SYSV_RC_LOCAL'], ['systemd-remount-fs.service', '8', ['systemd-remount-fs'], ''], ['systemd-repart', '8', ['systemd-repart.service'], 'ENABLE_REPART'], ['systemd-resolved.service', '8', ['systemd-resolved'], 'ENABLE_RESOLVE'], diff --git a/man/systemd-rc-local-generator.xml b/man/systemd-rc-local-generator.xml deleted file mode 100644 index a2ea8a9d149..00000000000 --- a/man/systemd-rc-local-generator.xml +++ /dev/null @@ -1,80 +0,0 @@ - - -%entities; -]> - - - - - systemd-rc-local-generator - systemd - - - - systemd-rc-local-generator - 8 - - - - systemd-rc-local-generator - rc-local.service - Compatibility generator and service to start &SYSTEM_SYSVRCLOCAL_PATH; during boot - - - - /usr/lib/systemd/system-generators/systemd-rc-local-generator - rc-local.service - - - - Description - - systemd-rc-local-generator is a generator that checks whether - &SYSTEM_SYSVRCLOCAL_PATH; exists and is executable, and if it is, pulls the - rc-local.service unit into the boot process. This unit is responsible for running - this script during late boot. The script is run after network.target, but in - parallel with most other regular system services. - - Note that rc-local.service runs with slightly different semantics than the - original System V version, which was executed "last" in the boot process, which is a concept that does - not translate to systemd. - - Also note that rc-local.service is ordered after - network.target, which does not mean that the network is functional, see - systemd.special7. - If the script requires a configured network connection, it may be desirable to pull in and order it after - network-online.target with a drop-in: - - # /etc/systemd/system/rc-local.service.d/network.conf -[Unit] -Wants=network-online.target -After=network-online.target - - - Support for &SYSTEM_SYSVRCLOCAL_PATH; is provided for compatibility with specific - System V systems only. However, it is strongly recommended to avoid using this script today, and instead - provide proper unit files with appropriate dependencies for any scripts to run during the boot process. - Note that the path to the script is set at compile time and varies between distributions. - - systemd-rc-local-generator implements - systemd.generator7. - - - - Notes - - On systems with SELinux, when creating the file, make sure to set the appropriate context, e.g. - with "sudo restorecon -v &SYSTEM_SYSVRCLOCAL_PATH;". - - - - - See Also - - systemd1 - systemctl1 - - - diff --git a/man/systemd.generator.xml b/man/systemd.generator.xml index 47bb970a550..f39c0733783 100644 --- a/man/systemd.generator.xml +++ b/man/systemd.generator.xml @@ -405,7 +405,6 @@ find $dir systemd-getty-generator8 systemd-gpt-auto-generator8 systemd-hibernate-resume-generator8 - systemd-rc-local-generator8 systemd-system-update-generator8 systemd-xdg-autostart-generator8 systemd.unit5 diff --git a/meson.build b/meson.build index 22e469aa4ba..da7b01f0a79 100644 --- a/meson.build +++ b/meson.build @@ -90,8 +90,6 @@ conf.set10('HAVE_SPLIT_BIN', split_bin, have_standalone_binaries = get_option('standalone-binaries') -sysvrclocal_path = get_option('rc-local') -conf.set10('HAVE_SYSV_RC_LOCAL', sysvrclocal_path != '') conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs')) if get_option('hibernate') and not get_option('initrd') @@ -299,7 +297,6 @@ conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir) conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) -conf.set_quoted('SYSTEM_SYSVRCLOCAL_PATH', sysvrclocal_path) conf.set_quoted('SYSUSERS_DIR', sysusersdir) conf.set_quoted('TMPFILES_DIR', tmpfilesdir) conf.set_quoted('USER_TMPFILES_DIR', usertmpfilesdir) @@ -2401,7 +2398,6 @@ subdir('src/pstore') subdir('src/ptyfwd') subdir('src/quotacheck') subdir('src/random-seed') -subdir('src/rc-local-generator') subdir('src/remount-fs') subdir('src/repart') subdir('src/reply-password') @@ -3022,7 +3018,6 @@ summary({ 'sysconf directory' : sysconfdir, 'include directory' : includedir, 'lib directory' : libdir, - 'SysV rc.local script' : sysvrclocal_path, 'PAM modules directory' : pamlibdir, 'PAM configuration directory' : pamconfdir, 'ssh server configuration directory' : sshdconfdir, diff --git a/meson_options.txt b/meson_options.txt index c555b9ebdc4..21d3e790280 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -45,7 +45,7 @@ option('sysvinit-path', type : 'string', value : '/etc/init.d', deprecated : tru description : 'This option is deprecated and will be removed in a future release') option('sysvrcnd-path', type : 'string', value : '/etc/rc.d', deprecated : true, description : 'This option is deprecated and will be removed in a future release') -option('rc-local', type : 'string', value : '/etc/rc.local', +option('rc-local', type : 'string', value : '/etc/rc.local', deprecated : true, description : 'path to SysV rc.local script') option('initrd', type : 'boolean', description : 'install services for use when running systemd in initrd') diff --git a/mkosi/mkosi.conf.d/opensuse/mkosi.conf.d/debug.conf b/mkosi/mkosi.conf.d/opensuse/mkosi.conf.d/debug.conf index 4614ea06a2a..860319a6108 100644 --- a/mkosi/mkosi.conf.d/opensuse/mkosi.conf.d/debug.conf +++ b/mkosi/mkosi.conf.d/opensuse/mkosi.conf.d/debug.conf @@ -16,6 +16,5 @@ VolatilePackages= systemd-networkd-debuginfo systemd-portable-debuginfo systemd-resolved-debuginfo - systemd-sysvcompat-debuginfo systemd-testsuite-debuginfo udev-debuginfo diff --git a/mkosi/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot b/mkosi/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot index 6adec4ce72c..e14c8884a08 100755 --- a/mkosi/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot +++ b/mkosi/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot @@ -27,6 +27,7 @@ while read -r filelist; do -e '/(initctl|runlevel|telinit)/ d' \ -e 's/systemd-quotacheck.service.8/systemd-quotacheck@.service.8/' \ -e '/systemd-sysv-generator/d' \ + -e '/rc-local/d' \ "$filelist" >"/tmp/$(basename "$filelist")" mount --bind "/tmp/$(basename "$filelist")" "$filelist" done < <(find "pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}" -name "files.*") diff --git a/src/rc-local-generator/meson.build b/src/rc-local-generator/meson.build deleted file mode 100644 index b3a73117f89..00000000000 --- a/src/rc-local-generator/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -executables += [ - generator_template + { - 'name' : 'systemd-rc-local-generator', - 'sources' : files('rc-local-generator.c'), - 'conditions' : [ - 'HAVE_SYSV_RC_LOCAL', - ], - }, -] diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c deleted file mode 100644 index 8b1b75f5692..00000000000 --- a/src/rc-local-generator/rc-local-generator.c +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ - -#include - -#include "generator.h" -#include "initrd-util.h" -#include "log.h" -#include "mkdir-label.h" -#include "string-util.h" - -static const char *arg_dest = NULL; - -/* So you are reading this, and might wonder: why is this implemented as a generator rather than as a plain, statically - * enabled service that carries appropriate ConditionFileIsExecutable= lines? The answer is this: conditions bypass - * execution of a service's binary, but they have no influence on unit dependencies. Thus, a service that is - * conditioned out will still act as synchronization point in the dependency tree, and we'd rather not have that for - * these two legacy scripts. */ - -static int add_symlink(const char *service, const char *where) { - const char *from, *to; - - assert(service); - assert(where); - - from = strjoina(SYSTEM_DATA_UNIT_DIR "/", service); - to = strjoina(arg_dest, "/", where, ".wants/", service); - - (void) mkdir_parents_label(to, 0755); - - if (symlink(from, to) < 0) { - if (errno == EEXIST) - return 0; - - return log_error_errno(errno, "Failed to create symlink %s: %m", to); - } - - return 1; -} - -static int check_executable(const char *path) { - assert(path); - - if (access(path, X_OK) < 0) { - if (errno == ENOENT) - return log_debug_errno(errno, "%s does not exist, skipping.", path); - if (errno == EACCES) - return log_info_errno(errno, "%s is not marked executable, skipping.", path); - - return log_warning_errno(errno, "Couldn't determine if %s exists and is executable, skipping: %m", path); - } - - return 0; -} - -static int run(const char *dest, const char *dest_early, const char *dest_late) { - int r = 0, k = 0; - - assert_se(arg_dest = dest); - - if (in_initrd()) { - log_debug("Skipping generator, running in the initrd."); - return EXIT_SUCCESS; - } - - if (check_executable(SYSTEM_SYSVRCLOCAL_PATH) >= 0) { - log_debug("Automatically adding rc-local.service."); - - r = add_symlink("rc-local.service", "multi-user.target"); - } - - return r < 0 ? r : k; -} - -DEFINE_MAIN_GENERATOR_FUNCTION(run); diff --git a/test/units/TEST-23-UNIT-FILE.verify-unit-files.sh b/test/units/TEST-23-UNIT-FILE.verify-unit-files.sh index 200e7582bdd..b94e486b7ad 100755 --- a/test/units/TEST-23-UNIT-FILE.verify-unit-files.sh +++ b/test/units/TEST-23-UNIT-FILE.verify-unit-files.sh @@ -29,8 +29,7 @@ fi for unit_file in "${UNIT_FILES[@]}"; do # Skip the check for a couple of units, namely: # - syslog.socket: the corresponding syslog.service might not be installed - # - rc-local.service: compat API, /etc/rc.d/rc.local most likely won't be present - if [[ "$unit_file" =~ /(syslog.socket|rc-local.service)$ ]]; then + if [[ "$unit_file" =~ /syslog.socket$ ]]; then continue fi diff --git a/units/console-getty.service.in b/units/console-getty.service.in index aecb8f09481..d28fddbc039 100644 --- a/units/console-getty.service.in +++ b/units/console-getty.service.in @@ -11,9 +11,6 @@ Description=Console Getty Documentation=man:agetty(8) man:systemd-getty-generator(8) After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -{% if HAVE_SYSV_RC_LOCAL %} -After=rc-local.service -{% endif %} Before=getty.target # OCI containers may be run without a console diff --git a/units/container-getty@.service.in b/units/container-getty@.service.in index 6e0e59d396f..839a76c73f8 100644 --- a/units/container-getty@.service.in +++ b/units/container-getty@.service.in @@ -12,9 +12,6 @@ Description=Container Getty on /dev/pts/%I Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=man:machinectl(1) After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -{% if HAVE_SYSV_RC_LOCAL %} -After=rc-local.service -{% endif %} Before=getty.target IgnoreOnIsolate=yes ConditionPathExists=/dev/pts/%I diff --git a/units/getty@.service.in b/units/getty@.service.in index e9ca6401eed..19b95ce56d4 100644 --- a/units/getty@.service.in +++ b/units/getty@.service.in @@ -12,9 +12,6 @@ Description=Getty on %I Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=https://0pointer.de/blog/projects/serial-console.html After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -{% if HAVE_SYSV_RC_LOCAL %} -After=rc-local.service -{% endif %} # If additional gettys are spawned during boot then we should make # sure that this is synchronized before getty.target, even though diff --git a/units/meson.build b/units/meson.build index 25e98ae90e2..f2c5d220554 100644 --- a/units/meson.build +++ b/units/meson.build @@ -174,10 +174,6 @@ units = [ 'file' : 'quotaon-root.service.in', 'conditions' : ['ENABLE_QUOTACHECK'], }, - { - 'file' : 'rc-local.service.in', - 'conditions' : ['HAVE_SYSV_RC_LOCAL'], - }, { 'file' : 'reboot.target', 'symlinks' : ['ctrl-alt-del.target'], diff --git a/units/rc-local.service.in b/units/rc-local.service.in deleted file mode 100644 index b135f3894de..00000000000 --- a/units/rc-local.service.in +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -# This unit gets pulled automatically into multi-user.target by -# systemd-rc-local-generator if {{SYSTEM_SYSVRCLOCAL_PATH}} is executable. -[Unit] -Description={{SYSTEM_SYSVRCLOCAL_PATH}} Compatibility -Documentation=man:systemd-rc-local-generator(8) -ConditionFileIsExecutable={{SYSTEM_SYSVRCLOCAL_PATH}} -After=network.target - -[Service] -Type=forking -ExecStart={{SYSTEM_SYSVRCLOCAL_PATH}} start -TimeoutSec=infinity -RemainAfterExit=yes -GuessMainPID=no diff --git a/units/serial-getty@.service.in b/units/serial-getty@.service.in index c0708f17776..01c6b0abb23 100644 --- a/units/serial-getty@.service.in +++ b/units/serial-getty@.service.in @@ -13,9 +13,6 @@ Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=https://0pointer.de/blog/projects/serial-console.html BindsTo=dev-%i.device After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -{% if HAVE_SYSV_RC_LOCAL %} -After=rc-local.service -{% endif %} # If additional gettys are spawned during boot then we should make # sure that this is synchronized before getty.target, even though