1
0
mirror of https://github.com/systemd/systemd synced 2025-09-19 20:04:46 +02:00

Compare commits

..

13 Commits

Author SHA1 Message Date
Mike Yuan
b6c8f0ec91 userdb: suppress creation of empty userdb dirs 2025-09-18 22:58:16 +02:00
Luca Boccassi
defa0148b8 units: add missing Documentation=
The initrd units are described in the graphs in the bootup manpage,
so use that one for them.
2025-09-18 21:54:36 +01:00
Lennart Poettering
74c10cfbeb
sd-varlink: two small additions (#38994) 2025-09-18 21:34:09 +02:00
Lennart Poettering
86fd19af14 mountfsd: add recognizable error if we pass an fd with unexpected flags 2025-09-18 21:33:41 +02:00
Nick Rosbrook
9fe168a92c basic: validate timezones in get_timezones()
Depending on the packaging of tzdata, /usr/share/zoneinfo/tzdata.zi may
reference zones or links that are not actually present on the system.
E.g. on Debian and Ubuntu, there is a tzdata-legacy package that
contains "legacy" zones and links, but they are still referenced in
/usr/share/zoneinfo/tzdata.zi shipped by the main tzdata package.

Right now, get_timezoes() does not validate timezones when building the
list, which makes the following possible:

 $ timedatectl list-timezones | grep "US/Alaska"
 US/Alaska

 $ timedatectl set-timezone US/Alaska
 Failed to set time zone: Invalid or not installed time zone 'US/Alaska'

which feels buggy. Hence, simply validate timezones in get_timezones()
to avoid listing timezones that are not installed.
2025-09-18 21:33:24 +02:00
Lennart Poettering
818bd1dfa1 mountfsd: uncomment CapabilityBoundingSet= line
Since mountfsd was added in 702a52f4b5d49cce11e2adbc740deb3b644e2de0 the
caps bounding set line was commented. That's an accident. Fix that. (We
need to add a bunch of caps to the list).
2025-09-18 21:30:51 +02:00
Lennart Poettering
1c9500c2b7 units: explicitly reset TTY before running stuff on console
This adds TTYReset=yes to all units which run directly on the TTY. We
already had this in place for the gettys, but this adds it for the rest
that basically has StandardInput=tty + StandardOutput=tty set.

Originally, for these tools it wasn't necessary to reset the TTY,
because we after all already reset /dev/console very very early on once,
during PID1's early initialization, and hence there's no real reason to
do it again for these early boot services. But that's actually not
right, because since #36666 the TTY we reset from PID 1 is typically
/dev/console but the TTY those services are invoked on is typically the
resolved version of that, i.e. wherever that points. Now you might
think: if one is just an alias to the other, why does it matter to reset
this again? Well, because it's only a half-assed alias, and as it turns
out WIOCSWINSZ is not propagated from one to the other, i.e the terminal
dimesions we initialize for /dev/console don't propagate to whatever
that points to.

One option to address that would be to immediately propagate this down
ourselves (or to fix the kernel for it), but it felt safer to simply do
the reset again before the use, after all these one one-off services,
and there's no point in optimizing much here. Moreover, its probably
safer to give the guarantee that when the firstboot stuff (which after
all queries for pws to set) runs it definitely certainly guaranteed has
a properly reset terminal.
2025-09-18 21:30:31 +02:00
Mike Yuan
f390e6b708
systemd-boot-update.service & zsh: replace --no-variables with --variables= (#39011) 2025-09-18 19:57:42 +02:00
nl6720
fea2518a71
zsh: replace bootctl --no-variables with --variables=
bbeeea43625d22d2ab92b26ed93378acbad8ca66 replaced the option in bootctl.
2025-09-18 17:00:57 +03:00
nl6720
8ec3e769b5
systemd-boot-update.service: replace --no-variables with --variables=no
bbeeea43625d22d2ab92b26ed93378acbad8ca66 replaced the option in bootctl,
so systemd-boot-update.service should follow.
2025-09-18 17:00:49 +03:00
Lennart Poettering
2bbfbe4089 man: run update-man-rules 2025-09-18 15:56:11 +02:00
Lennart Poettering
cba8c099a9 sd-varlink: optionally handle SIGTERM/SIGINT explicitly in simple varlink event loop 2025-09-18 15:56:11 +02:00
Lennart Poettering
04e2cb8928 sd-varlink: add api for resetting timeout to default
We currently don't expose the literal default time-out as API. Let's at
least provide users with a way to reset the time-out to the default.
2025-09-18 15:56:11 +02:00
21 changed files with 310 additions and 36 deletions

View File

@ -916,11 +916,17 @@ manpages = [
'HAVE_PAM'],
['sd_varlink_push_fd', '3', ['sd_varlink_push_dup_fd'], ''],
['sd_varlink_send', '3', ['sd_varlink_sendb', 'sd_varlink_sendbo'], ''],
['sd_varlink_server_new', '3', [], ''],
['sd_varlink_set_description', '3', ['sd_varlink_get_description'], ''],
['sd_varlink_set_relative_timeout', '3', [], ''],
['sd_watchdog_enabled', '3', [], ''],
['shutdown', '8', [], ''],
['smbios-type-11', '7', [], ''],
['sysctl.d', '5', [], ''],
['sysext.conf',
'5',
['confext.conf', 'confext.conf.d', 'sysext.conf.d'],
'ENABLE_SYSEXT'],
['systemctl', '1', [], ''],
['systemd-ac-power', '1', [], ''],
['systemd-analyze', '1', [], 'ENABLE_ANALYZE'],
@ -1138,7 +1144,6 @@ manpages = [
'systemd-sysext-initrd.service',
'systemd-sysext.service'],
'ENABLE_SYSEXT'],
['sysext.conf', '5', ['confext.conf'], 'ENABLE_SYSEXT'],
['systemd-system-update-generator', '8', [], ''],
['systemd-system.conf',
'5',

View File

@ -0,0 +1,145 @@
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="sd_varlink_server_new" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd_varlink_server_new</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>sd_varlink_server_new</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>sd_varlink_server_new</refname>
<refpurpose>Allocate Varlink server object</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;systemd/sd-varlink.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>sd_varlink_server_new</function></funcdef>
<paramdef>sd_varlink_server** <parameter>ret</parameter></paramdef>
<paramdef>sd_varlink_server_flags_t <parameter>flags</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_varlink_server_new()</function> allocates a new Varlink server object. Initially the
server does not listen on any socket or file descriptor. The newly allocated server object is returned in
the <parameter>ret</parameter> parameter. Use <function>sd_varlink_server_unref()</function> to release
the server object again after use.</para>
<para>The following flags may be passed in the <parameter>flags</parameter> parameter:</para>
<itemizedlist>
<listitem><para><constant>SD_VARLINK_SERVER_ROOT_ONLY</constant>: only allow connections from UID 0
(i.e. the root user). This has two effects: any incoming connections is authenticated via
<constant>SO_PEERCRED</constant> ensuring the UID reported by the kernel is zero. If this check fails
the connection is immediately terminated. Moreover, when binding a socket inode in the file system, the
access mode is set to 0600 (rather than 0666). If this option is used connections on
non-<constant>AF_UNIX</constant> sockets or via pipes are never permitted.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_MYSELF_ONLY</constant>: this is very similar to
<constant>SD_VARLINK_SERVER_ROOT_ONLY</constant> but enforces that the connecting client's UID must
match the server's UID (i.e. the UID this function is invoked as). For servers that run as UID 0 the
flags are equivalent. If both flags are specified in combination, connections are allowed by both UID 0
and the server's own UID.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_ACCOUNT_UID</constant>: if set connection accounting per
client UID is enabled, and a limit on concurrent connections from the same UID is enforced. The limit can
be set via <function>sd_varlink_server_set_connections_per_uid_max()</function>, and defaults to 3/4th
of the total concurrent connection limit, as settable via
<function>sd_varlink_server_set_connections_max()</function>.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_INHERIT_USERDATA</constant>: if set the user data field for
incoming connection (i.e. <type>sd_varlink</type>) objects (as settable via
<function>sd_varlink_set_userdata()</function>) is automatically set to the userdata field of the
server (i.e. <type>sd_varlink_server</type>) object (as settable via
<function>sd_varlink_server_set_userdata()</function>). If this flag is not specified the connection's
user data field will default to <constant>NULL</constant>.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_INPUT_SENSITIVE</constant>: mark all incoming method call
parameters as security sensitive (equivalent to calling
<function>sd_json_variant_sensitive()</function>). This is useful for services that deal with secrets
and similar, as it ensures that the parameters are kept out of debug logging, and memory used by the
parameters is erased after use.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT</constant>: if set, allow receiving
UNIX file descriptors via the connections, equivalent to calling
<function>sd_varlink_set_allow_fd_passing_input()</function> immediately for each incoming
connection. Note that this only has an effect if <constant>AF_UNIX</constant> sockets are used for
communication.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_ALLOW_FD_PASSING_OUTPUT</constant>: similar, but controls
sending of UNIX file descriptors.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_FD_PASSING_INPUT_STRICT</constant>: this flag can be used
in conjunction with <constant>SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT</constant>. If so, file
descriptor passing is turned off on the listening sockets already, ensuring that the connection sockets
derived from it at no time have file descriptor passing enabled. If
<constant>SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT</constant> is used without
<constant>SD_VARLINK_SERVER_FD_PASSING_INPUT_STRICT</constant> then a choice when to prohibit or allow
file descriptor passing can still be made after the connection came in, however permitting a time
window where file descriptors might already be enqueued, that then need to be dropped
again.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_HANDLE_SIGINT</constant>: if set, and
<function>sd_varlink_server_loop_auto()</function> is used, incoming <constant>SIGINT</constant>
process signals will be caught gracefully and cause the event loop to exit cleanly.</para></listitem>
<listitem><para><constant>SD_VARLINK_SERVER_HANDLE_SIGTERM</constant>: similar, but does the same for
<constant>SIGTERM</constant>.</para></listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_varlink_server_new()</function> returns a non-negative integer. On
failure, it returns a negative errno-style error code.</para>
<refsect2>
<title>Errors</title>
<para>Returned errors may indicate the following problems:</para>
<variablelist>
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>An argument is invalid.</para></listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />
<refsect1>
<title>History</title>
<para><function>sd_varlink_server_new()</function> was added in version 257.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para><simplelist type="inline">
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>sd-varlink</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
</simplelist></para>
</refsect1>
</refentry>

View File

@ -0,0 +1,88 @@
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="sd_varlink_set_relative_timeout" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>sd_varlink_set_relative_timeout</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>sd_varlink_set_relative_timeout</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>sd_varlink_set_relative_timeout</refname>
<refpurpose>Set method call time-out</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;systemd/sd-varlink.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>sd_varlink_set_relative_timeout</function></funcdef>
<paramdef>sd_varlink *<parameter>link</parameter></paramdef>
<paramdef>uint64_t <parameter>usec</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>sd_varlink_set_relative_timeout()</function> sets the relative timeout in µs to enforce
on Varlink method calls. A default time-out of 45s (currently) applies, which may be changed with this
call. Set to <constant>UINT64_MAX</constant> to disable the time-out, and to 0 to revert to revert back
to the default time-out. The time-out begins whenever a method call is started, and if no response is
received by the time the time-out elapses a synthetic <constant>io.systemd.TimedOut</constant> error is
raised as client-generated reply to the method call.</para>
<para>This call is particularly useful for method calls issued via
<function>sd_varlink_observe()</function> that shall remain open continously for a long time.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para>On success, <function>sd_varlink_set_relative_timeout()</function> returns a non-negative integer. On
failure, it returns a negative errno-style error code.</para>
<refsect2>
<title>Errors</title>
<para>Returned errors may indicate the following problems:</para>
<variablelist>
<varlistentry>
<term><constant>-EINVAL</constant></term>
<listitem><para>An argument is invalid.</para></listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<xi:include href="libsystemd-pkgconfig.xml" />
<refsect1>
<title>History</title>
<para><function>sd_varlink_set_relative_timeout()</function> was added in version 257.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para><simplelist type="inline">
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>sd-varlink</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
</simplelist></para>
</refsect1>
</refentry>

View File

@ -75,7 +75,6 @@ _arguments \
'(-p --print-esp-path)'{-p,--print-esp-path}'[Print path to the EFI system partition]' \
'(-x --print-boot-path)'{-x,--print-boot-path}'[Print path to the $BOOT partition]' \
'--make-machine-id-directory=[Control creation and deletion of the top-level machine ID directory.]:options:(yes no auto)' \
'--no-variables[Do not touch EFI variables]' \
'--no-pager[Do not pipe output into a pager]' \
'--graceful[Do not fail when locating ESP or writing fails]' \
'--dry-run[Dry run (unlink and cleanup)]' \
@ -83,4 +82,5 @@ _arguments \
'--image=[Operate on the specified image]:PATH' \
'--install-source[Where to pick files when using --root=/--image=]:options:(image host auto)' \
'--random-seed[Whether to create random-seed file during install]:options:(yes no)' \
'--variables=[Touch EFI variables]:options:(yes no)' \
'*::bootctl command:_bootctl_commands'

View File

@ -1435,6 +1435,10 @@ static int get_timezones_from_zone1970_tab(char ***ret) {
if (*cc == '#')
continue;
if (!timezone_is_valid(tz, LOG_DEBUG))
/* Don't list unusable timezones. */
continue;
r = strv_extend(&zones, tz);
if (r < 0)
return r;
@ -1487,6 +1491,10 @@ static int get_timezones_from_tzdata_zi(char ***ret) {
/* Not a line we care about. */
continue;
if (!timezone_is_valid(tz, LOG_DEBUG))
/* Don't list unusable timezones. */
continue;
r = strv_extend(&zones, tz);
if (r < 0)
return r;

View File

@ -2911,9 +2911,9 @@ _public_ int sd_varlink_get_peer_pidfd(sd_varlink *v) {
_public_ int sd_varlink_set_relative_timeout(sd_varlink *v, uint64_t timeout) {
assert_return(v, -EINVAL);
assert_return(timeout > 0, -EINVAL);
v->timeout = timeout;
/* If set to 0, reset to default value */
v->timeout = timeout == 0 ? VARLINK_DEFAULT_TIMEOUT_USEC : timeout;
return 0;
}
@ -3309,7 +3309,9 @@ _public_ int sd_varlink_server_new(sd_varlink_server **ret, sd_varlink_server_fl
SD_VARLINK_SERVER_INPUT_SENSITIVE|
SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT|
SD_VARLINK_SERVER_ALLOW_FD_PASSING_OUTPUT|
SD_VARLINK_SERVER_FD_PASSING_INPUT_STRICT)) == 0, -EINVAL);
SD_VARLINK_SERVER_FD_PASSING_INPUT_STRICT|
SD_VARLINK_SERVER_HANDLE_SIGINT|
SD_VARLINK_SERVER_HANDLE_SIGTERM)) == 0, -EINVAL);
s = new(sd_varlink_server, 1);
if (!s)
@ -3882,6 +3884,18 @@ _public_ int sd_varlink_server_loop_auto(sd_varlink_server *server) {
if (r < 0)
return r;
if (FLAGS_SET(server->flags, SD_VARLINK_SERVER_HANDLE_SIGINT)) {
r = sd_event_add_signal(event, /* ret= */ NULL, SIGINT|SD_EVENT_SIGNAL_PROCMASK, /* callback= */ NULL, /* userdata= */ NULL);
if (r < 0)
return r;
}
if (FLAGS_SET(server->flags, SD_VARLINK_SERVER_HANDLE_SIGTERM)) {
r = sd_event_add_signal(event, /* ret= */ NULL, SIGTERM|SD_EVENT_SIGNAL_PROCMASK, /* callback= */ NULL, /* userdata= */ NULL);
if (r < 0)
return r;
}
r = sd_varlink_server_attach_event(server, event, 0);
if (r < 0)
return r;

View File

@ -771,6 +771,8 @@ static int vl_method_mount_directory(
return log_debug_errno(r, "Failed to get client UID: %m");
DirectoryOwnership owned_by = validate_directory_fd(directory_fd, peer_uid);
if (owned_by == -EREMOTEIO)
return sd_varlink_errorbo(link, "io.systemd.MountFileSystem.BadFileDescriptorFlags", SD_JSON_BUILD_PAIR_STRING("parameter", "directoryFileDescriptor"));
if (owned_by < 0)
return owned_by;

View File

@ -115,6 +115,9 @@ static SD_VARLINK_DEFINE_ERROR(RootPartitionNotFound);
static SD_VARLINK_DEFINE_ERROR(DeniedByImagePolicy);
static SD_VARLINK_DEFINE_ERROR(KeyNotFound);
static SD_VARLINK_DEFINE_ERROR(VerityFailure);
static SD_VARLINK_DEFINE_ERROR(BadFileDescriptorFlags,
SD_VARLINK_FIELD_COMMENT("Name of the parameter referencing the file descriptor with one or more bad flag."),
SD_VARLINK_DEFINE_FIELD(parameter, SD_VARLINK_STRING, 0));
SD_VARLINK_DEFINE_INTERFACE(
io_systemd_MountFileSystem,
@ -143,4 +146,6 @@ SD_VARLINK_DEFINE_INTERFACE(
SD_VARLINK_SYMBOL_COMMENT("The authentication key for this image is not available."),
&vl_error_KeyNotFound,
SD_VARLINK_SYMBOL_COMMENT("Verity could not be set up."),
&vl_error_VerityFailure);
&vl_error_VerityFailure,
SD_VARLINK_SYMBOL_COMMENT("A passed file descriptor has unexpected/forbidden flags set."),
&vl_error_BadFileDescriptorFlags);

View File

@ -69,6 +69,8 @@ __extension__ typedef enum _SD_ENUM_TYPE_S64(sd_varlink_server_flags_t) {
SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT = 1 << 5, /* Allow receiving fds over all connections */
SD_VARLINK_SERVER_ALLOW_FD_PASSING_OUTPUT = 1 << 6, /* Allow sending fds over all connections */
SD_VARLINK_SERVER_FD_PASSING_INPUT_STRICT = 1 << 7, /* Reject input messages with fds if fd passing is disabled (needs kernel v6.16+) */
SD_VARLINK_SERVER_HANDLE_SIGINT = 1 << 8, /* Exit cleanly on SIGINT */
SD_VARLINK_SERVER_HANDLE_SIGTERM = 1 << 9, /* Exit cleanly on SIGTERM */
_SD_ENUM_FORCE_S64(SD_VARLINK_SERVER)
} sd_varlink_server_flags_t;

View File

@ -1184,15 +1184,15 @@ static int ssh_authorized_keys(int argc, char *argv[], void *userdata) {
static int load_credential_one(
int credential_dir_fd,
const char *name,
int userdb_dir_persist_fd,
int userdb_dir_transient_fd) {
int *userdb_dir_persist_fd,
int *userdb_dir_transient_fd) {
int r;
assert(credential_dir_fd >= 0);
assert(name);
assert(userdb_dir_persist_fd >= 0);
assert(userdb_dir_transient_fd >= 0);
assert(userdb_dir_persist_fd);
assert(userdb_dir_transient_fd);
const char *suffix = startswith(name, "userdb.");
if (!suffix)
@ -1205,7 +1205,17 @@ static int load_credential_one(
return 0;
const char *userdb_dir = transient ? "/run/userdb" : "/etc/userdb";
int userdb_dir_fd = transient ? userdb_dir_transient_fd : userdb_dir_persist_fd;
int *userdb_dir_fd = transient ? userdb_dir_transient_fd : userdb_dir_persist_fd;
if (*userdb_dir_fd == -EBADF) {
*userdb_dir_fd = xopenat_full(AT_FDCWD, userdb_dir,
/* open_flags= */ O_DIRECTORY|O_CREAT|O_CLOEXEC,
/* xopen_flags= */ XO_LABEL,
/* mode= */ 0755);
if (*userdb_dir_fd < 0)
return log_error_errno(*userdb_dir_fd, "Failed to open '%s/': %m", userdb_dir);
} else if (*userdb_dir_fd < 0)
return log_debug_errno(*userdb_dir_fd, "Previous attempt to open '%s/' failed, skipping.", userdb_dir);
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
unsigned line = 0, column = 0;
@ -1362,11 +1372,11 @@ static int load_credential_one(
if (r < 0)
return log_error_errno(r, "Failed to format JSON record: %m");
r = write_string_file_at(userdb_dir_fd, fn, formatted, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC);
r = write_string_file_at(*userdb_dir_fd, fn, formatted, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC);
if (r < 0)
return log_error_errno(r, "Failed to write JSON record to %s/%s: %m", userdb_dir, fn);
if (symlinkat(fn, userdb_dir_fd, link) < 0)
if (symlinkat(fn, *userdb_dir_fd, link) < 0)
return log_error_errno(errno, "Failed to create symlink from %s to %s: %m", link, fn);
log_info("Installed %s/%s from credential.", userdb_dir, fn);
@ -1383,7 +1393,7 @@ static int load_credential_one(
if (r < 0)
return log_error_errno(r, "Failed to format JSON record: %m");
r = write_string_file_at(userdb_dir_fd, fn, formatted, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC|WRITE_STRING_FILE_MODE_0600);
r = write_string_file_at(*userdb_dir_fd, fn, formatted, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC|WRITE_STRING_FILE_MODE_0600);
if (r < 0)
return log_error_errno(r, "Failed to write JSON record to %s/%s: %m", userdb_dir, fn);
@ -1397,7 +1407,7 @@ static int load_credential_one(
return log_oom();
}
if (symlinkat(fn, userdb_dir_fd, link) < 0)
if (symlinkat(fn, *userdb_dir_fd, link) < 0)
return log_error_errno(errno, "Failed to create symlink from %s to %s: %m", link, fn);
log_info("Installed %s/%s from credential.", userdb_dir, fn);
@ -1409,7 +1419,7 @@ static int load_credential_one(
if (!membership)
return log_oom();
_cleanup_close_ int fd = openat(userdb_dir_fd, membership, O_WRONLY|O_CREAT|O_CLOEXEC, 0644);
_cleanup_close_ int fd = openat(*userdb_dir_fd, membership, O_WRONLY|O_CREAT|O_CLOEXEC, 0644);
if (fd < 0)
return log_error_errno(errno, "Failed to create %s: %m", membership);
@ -1421,7 +1431,7 @@ static int load_credential_one(
if (!membership)
return log_oom();
_cleanup_close_ int fd = openat(userdb_dir_fd, membership, O_WRONLY|O_CREAT|O_CLOEXEC, 0644);
_cleanup_close_ int fd = openat(*userdb_dir_fd, membership, O_WRONLY|O_CREAT|O_CLOEXEC, 0644);
if (fd < 0)
return log_error_errno(errno, "Failed to create %s: %m", membership);
@ -1475,21 +1485,7 @@ static int load_credentials(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to enumerate credentials: %m");
_cleanup_close_ int userdb_persist_dir_fd = xopenat_full(
AT_FDCWD, "/etc/userdb",
/* open_flags= */ O_DIRECTORY|O_CREAT|O_CLOEXEC,
/* xopen_flags= */ XO_LABEL,
/* mode= */ 0755);
if (userdb_persist_dir_fd < 0)
return log_error_errno(userdb_persist_dir_fd, "Failed to open /etc/userdb/: %m");
_cleanup_close_ int userdb_transient_dir_fd = xopenat_full(
AT_FDCWD, "/run/userdb",
/* open_flags= */ O_DIRECTORY|O_CREAT|O_CLOEXEC,
/* xopen_flags= */ XO_LABEL,
/* mode= */ 0755);
if (userdb_transient_dir_fd < 0)
return log_error_errno(userdb_transient_dir_fd, "Failed to open /run/userdb/: %m");
_cleanup_close_ int userdb_persist_dir_fd = -EBADF, userdb_transient_dir_fd = -EBADF;
FOREACH_ARRAY(i, des->entries, des->n_entries) {
struct dirent *de = *i;
@ -1500,8 +1496,8 @@ static int load_credentials(int argc, char *argv[], void *userdata) {
RET_GATHER(r, load_credential_one(
credential_dir_fd,
de->d_name,
userdb_persist_dir_fd,
userdb_transient_dir_fd));
&userdb_persist_dir_fd,
&userdb_transient_dir_fd));
}
return r;

View File

@ -9,6 +9,7 @@
[Unit]
Description=Cleaning Up and Shutting Down Daemons
Documentation=man:bootup(7)
DefaultDependencies=no
AssertPathExists=/etc/initrd-release
OnFailure=emergency.target

View File

@ -9,6 +9,7 @@
[Unit]
Description=Mountpoints Configured in the Real Root
Documentation=man:bootup(7)
AssertPathExists=/etc/initrd-release
DefaultDependencies=no

View File

@ -9,6 +9,7 @@
[Unit]
Description=Switch Root
Documentation=man:bootup(7)
AssertPathExists=/etc/initrd-release

View File

@ -9,6 +9,7 @@
[Unit]
Description=Switch Root
Documentation=man:bootup(7)
AssertPathExists=/etc/initrd-release
DefaultDependencies=no
Wants=initrd-switch-root.service

View File

@ -9,6 +9,7 @@
[Unit]
Description=Cleanup udev Database
Documentation=man:bootup(7)
DefaultDependencies=no
AssertPathExists=/etc/initrd-release
Conflicts=systemd-udevd.service systemd-udev-trigger.service systemd-udev-settle.service

View File

@ -9,6 +9,7 @@
[Unit]
Description=Create List of Static Device Nodes
Documentation=man:kmod(8)
DefaultDependencies=no
Before=sysinit.target systemd-tmpfiles-setup-dev-early.service
ConditionCapability=CAP_SYS_MODULE

View File

@ -21,7 +21,7 @@ Before=shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=bootctl --no-variables --graceful update
ExecStart=bootctl --variables=no --graceful update
[Install]
WantedBy=sysinit.target

View File

@ -35,6 +35,7 @@ ExecStart=systemd-firstboot --prompt-locale --prompt-keymap --prompt-timezone --
StandardOutput=tty
StandardInput=tty
StandardError=tty
TTYReset=yes
# Optionally, pick up basic fields from credentials passed to the service
# manager. This is useful for importing this data from nspawn's

View File

@ -21,6 +21,7 @@ ExecStart=homectl firstboot --prompt-new-user
StandardOutput=tty
StandardInput=tty
StandardError=tty
TTYReset=yes
ImportCredential=home.*
[Install]

View File

@ -18,7 +18,7 @@ Before=sysinit.target shutdown.target
DefaultDependencies=no
[Service]
#CapabilityBoundingSet=CAP_DAC_READ_SEARCH CAP_SYS_RESOURCE CAP_BPF CAP_PERFMON CAP_SETGID CAP_SETUID
CapabilityBoundingSet=CAP_DAC_READ_SEARCH CAP_SYS_RESOURCE CAP_BPF CAP_PERFMON CAP_SETGID CAP_SETUID CAP_DAC_OVERRIDE CAP_CHOWN CAP_SYS_ADMIN
ExecStart={{LIBEXECDIR}}/systemd-mountfsd
IPAddressDeny=any
LimitNOFILE={{HIGH_RLIMIT_NOFILE}}

View File

@ -24,4 +24,5 @@ Type=notify
RemainAfterExit=yes
StandardInput=tty
StandardOutput=tty
TTYReset=yes
ExecStart={{LIBEXECDIR}}/systemd-storagetm --all