Compare commits

..

No commits in common. "16a4a2f8cc703f958790e11c97449c7d1b417d5e" and "60b45a80c1f98bad000bd902d97ecf6c4e3fc315" have entirely different histories.

6 changed files with 83 additions and 144 deletions

7
TODO
View File

@ -17,10 +17,6 @@ Janitorial Clean-ups:
Features: Features:
* complement root=, rootflags=, rootfstype= with rootsubdir= which allows
mounting a subdir of the root fs as actual root. This can be used as
fstype-agnostic version of btrfs' rootflags=subvol=foobar.
* add --copy-from and --copy-to command to systemd-dissect which copies stuff * add --copy-from and --copy-to command to systemd-dissect which copies stuff
in and out of a disk image in and out of a disk image
@ -28,6 +24,9 @@ Features:
* if /usr/bin/swapoff fails due to OOM, log a friendly explanatory message about it * if /usr/bin/swapoff fails due to OOM, log a friendly explanatory message about it
* add loud warning to the logs (with catalog entry) if systemd-udev-settle is
pulled into the boot process
* build short web pages out of each catalog entry, build them along with man * build short web pages out of each catalog entry, build them along with man
pages, and include hyperlinks to them in the journal output pages, and include hyperlinks to them in the journal output

View File

@ -484,36 +484,3 @@ It is strongly recommended to avoid running services under this user identity,
in particular on systems using NFS or running containers. Allocate a user ID in particular on systems using NFS or running containers. Allocate a user ID
specific to this service, either statically via systemd-sysusers or dynamically specific to this service, either statically via systemd-sysusers or dynamically
via the DynamicUser= service setting. via the DynamicUser= service setting.
-- 1c0454c1bd2241e0ac6fefb4bc631433
Subject: systemd-udev-settle.service is deprecated.
Defined-By: systemd
Support: %SUPPORT_URL%
Usage of the systemd service unit systemd-udev-settle.service is deprecated. It
inserts artificial delays into the boot process without providing the
guarantees other subsystems traditionally assumed it provides. Relying on this
service is racy, and it is generally a bug to make use of it and depend on it.
Traditionally, this service's job was to wait until all devices a system
possesses have been fully probed and initialized, delaying boot until this
phase is completed. However, today's systems and hardware generally don't work
this way anymore, hardware today may show up any time and take any time to be
probed and initialized. Thus, in the general case, it's no longer possible to
correctly delay boot until "all devices" have been processed, as it is not
clear what "all devices" means and when they have been found. This is in
particular the case if USB hardware or network-attached hardware is used.
Modern software that requires some specific hardware (such as a network device
or block device) to operate should only wait for the specific devices it needs
to show up, and otherwise operate asynchronously initializing devices as they
appear during boot and during runtime without delaying the boot process.
It is a defect of the software in question if it doesn't work this way, and
still pulls systemd-udev-settle.service into the boot process.
Please file a bug report against the following units, with a request for it to
be updated to operate in a hotplug fashion without depending on
systemd-udev-settle.service:
@OFFENDING_UNITS@

View File

@ -85,14 +85,11 @@ static int parse_condition(Unit *u, const char *line) {
p = startswith(line, c->name); p = startswith(line, c->name);
if (!p) if (!p)
continue; continue;
p += strspn(p, WHITESPACE); p += strspn(p, WHITESPACE);
if (*p != '=') if (*p != '=')
continue; return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Expected \"=\" in \"%s\".", line);
p++;
p += strspn(p, WHITESPACE); p += 1 + strspn(p + 1, WHITESPACE);
return c->parser(NULL, "(stdin)", 0, NULL, 0, c->name, c->type, p, target, u); return c->parser(NULL, "(stdin)", 0, NULL, 0, c->name, c->type, p, target, u);
} }

View File

@ -170,11 +170,6 @@ _SD_BEGIN_DECLARATIONS;
#define SD_MESSAGE_NOBODY_USER_UNSUITABLE_STR \ #define SD_MESSAGE_NOBODY_USER_UNSUITABLE_STR \
SD_ID128_MAKE_STR(b4,80,32,5f,9c,39,4a,7b,80,2c,23,1e,51,a2,75,2c) SD_ID128_MAKE_STR(b4,80,32,5f,9c,39,4a,7b,80,2c,23,1e,51,a2,75,2c)
#define SD_MESSAGE_SYSTEMD_UDEV_SETTLE_DEPRECATED \
SD_ID128_MAKE(1c,04,54,c1,bd,22,41,e0,ac,6f,ef,b4,bc,63,14,33)
#define SD_MESSAGE_SYSTEMD_UDEV_SETTLE_DEPRECATED_STR \
SD_ID128_MAKE_STR(1c,04,54,c1,bd,22,41,e0,ac,6f,ef,b4,bc,63,14,33)
_SD_END_DECLARATIONS; _SD_END_DECLARATIONS;
#endif #endif

View File

@ -14,9 +14,7 @@
#include "sd-bus.h" #include "sd-bus.h"
#include "sd-login.h" #include "sd-login.h"
#include "sd-messages.h"
#include "bus-util.h"
#include "io-util.h" #include "io-util.h"
#include "libudev-util.h" #include "libudev-util.h"
#include "string-util.h" #include "string-util.h"
@ -89,25 +87,19 @@ static int parse_argv(int argc, char *argv[]) {
static int emit_deprecation_warning(void) { static int emit_deprecation_warning(void) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_strv_free_ char **a = NULL; _cleanup_free_ char *unit = NULL, *unit_path = NULL;
_cleanup_free_ char *unit = NULL; _cleanup_strv_free_ char **a = NULL, **b = NULL;
int r; int r;
r = sd_pid_get_unit(0, &unit); r = sd_pid_get_unit(0, &unit);
if (r < 0) { if (r < 0 || !streq(unit, "systemd-udev-settle.service"))
log_debug_errno(r, "Failed to determine unit we run in, ignoring: %m");
return 0;
}
if (!streq(unit, "systemd-udev-settle.service"))
return 0; return 0;
r = bus_connect_system_systemd(&bus); log_notice("systemd-udev-settle.service is deprecated.");
r = sd_bus_open_system(&bus);
if (r < 0) if (r < 0)
log_debug_errno(r, "Failed to open connection to systemd, skipping dependency queries: %m"); return log_debug_errno(r, "Failed to open system bus, skipping dependency queries: %m");
else {
_cleanup_strv_free_ char **b = NULL;
_cleanup_free_ char *unit_path = NULL;
unit_path = unit_dbus_path_from_name("systemd-udev-settle.service"); unit_path = unit_dbus_path_from_name("systemd-udev-settle.service");
if (!unit_path) if (!unit_path)
@ -134,24 +126,15 @@ static int emit_deprecation_warning(void) {
r = strv_extend_strv(&a, b, true); r = strv_extend_strv(&a, b, true);
if (r < 0) if (r < 0)
return r; return r;
}
if (strv_isempty(a)) if (!strv_isempty(a)) {
/* Print a simple message if we cannot determine the dependencies */
log_notice("systemd-udev-settle.service is deprecated.");
else {
/* Print a longer, structured message if we can acquire the dependencies (this should be the
* common case). This is hooked up with a catalog entry and everything. */
_cleanup_free_ char *t = NULL; _cleanup_free_ char *t = NULL;
t = strv_join(a, ", "); t = strv_join(a, ", ");
if (!t) if (!t)
return -ENOMEM; return -ENOMEM;
log_struct(LOG_NOTICE, log_notice("Hint: please fix %s not to pull it in.", t);
"MESSAGE=systemd-udev-settle.service is deprecated. Please fix %s not to pull it in.", t,
"OFFENDING_UNITS=%s", t,
"MESSAGE_ID=" SD_MESSAGE_SYSTEMD_UDEV_SETTLE_DEPRECATED_STR);
} }
return 0; return 0;

View File

@ -1,58 +1,56 @@
# SPDX-License-Identifier: LGPL-2.1+ # SPDX-License-Identifier: LGPL-2.1+
if install_tests testdata_dir = testsdir + '/testdata/'
testdata_dir = testsdir + '/testdata/'
install_subdir('journal-data', install_subdir('journal-data',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('units', install_subdir('units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('test-execute', install_subdir('test-execute',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('test-path', install_subdir('test-path',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('test-umount', install_subdir('test-umount',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('test-network-generator-conversion', install_subdir('test-network-generator-conversion',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-04.units', install_subdir('testsuite-04.units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-06.units', install_subdir('testsuite-06.units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-10.units', install_subdir('testsuite-10.units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-11.units', install_subdir('testsuite-11.units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-16.units', install_subdir('testsuite-16.units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-28.units', install_subdir('testsuite-28.units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-30.units', install_subdir('testsuite-30.units',
install_dir : testdata_dir) install_dir : testdata_dir)
install_subdir('testsuite-52.units', install_subdir('testsuite-52.units',
install_dir : testdata_dir) install_dir : testdata_dir)
testsuite08_dir = testdata_dir + '/testsuite-08.units' testsuite08_dir = testdata_dir + '/testsuite-08.units'
install_data('testsuite-08.units/-.mount', install_data('testsuite-08.units/-.mount',
install_dir : testsuite08_dir) install_dir : testsuite08_dir)
install_data('testsuite-08.units/systemd-remount-fs.service', install_data('testsuite-08.units/systemd-remount-fs.service',
install_dir : testsuite08_dir) install_dir : testsuite08_dir)
meson.add_install_script(meson_make_symlink, meson.add_install_script(meson_make_symlink,
'./-.mount', './-.mount',
testsuite08_dir + '/root.mount') testsuite08_dir + '/root.mount')
meson.add_install_script(meson_make_symlink, meson.add_install_script(meson_make_symlink,
'../-.mount', '../-.mount',
testsuite08_dir + '/local-fs.target.wants/-.mount') testsuite08_dir + '/local-fs.target.wants/-.mount')
if conf.get('ENABLE_RESOLVE') == 1 if conf.get('ENABLE_RESOLVE') == 1
install_subdir('test-resolve', install_subdir('test-resolve',
install_dir : testdata_dir) install_dir : testdata_dir)
endif endif
install_data('create-busybox-container', install_data('create-busybox-container',
install_mode : 'rwxr-xr-x', install_mode : 'rwxr-xr-x',
install_dir : testdata_dir) install_dir : testdata_dir)
endif
test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh') test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')