Compare commits

..

No commits in common. "ce416f425c509bac429b8c9971f5f4edf726a54f" and "ac24e418d9bc988ecf114c464701b35934948178" have entirely different histories.

15 changed files with 50 additions and 108 deletions

View File

@ -67,13 +67,9 @@
<para>To activate the NSS modules, add <literal>myhostname</literal> to the line starting with <para>To activate the NSS modules, add <literal>myhostname</literal> to the line starting with
<literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>.</para> <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>.</para>
<para>It is recommended to place <literal>myhostname</literal> either between <literal>resolve</literal> <para>It is recommended to place <literal>myhostname</literal> last in the <filename>nsswitch.conf</filename>'
and "traditional" modules like <literal>files</literal> and <literal>dns</literal>, or after them. In the <literal>hosts:</literal> line to make sure that this mapping is only used as fallback, and that any DNS or
first version, well-known names like <literal>localhost</literal> and the machine hostname are given <filename>/etc/hosts</filename> based mapping takes precedence.</para>
higher priority than the external configuration. This is recommended when the external DNS servers and
network are not absolutely trusted. In the second version, external configuration is given higher
priority and <command>nss-myhostname</command> only provides a fallback mechanism. This might be suitable
in closely controlled networks, for example on a company LAN.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
@ -87,10 +83,7 @@
group: compat mymachines systemd group: compat mymachines systemd
shadow: compat shadow: compat
# Either (untrusted network): hosts: files mymachines resolve [!UNAVAIL=return] dns <command>myhostname</command>
hosts: mymachines resolve [!UNAVAIL=return] <command>myhostname</command> files dns
# Or (only trusted networks):
hosts: mymachines resolve [!UNAVAIL=return] files dns <command>myhostname</command>
networks: files networks: files
protocols: db files protocols: db files

View File

@ -69,7 +69,7 @@
group: compat <command>mymachines</command> systemd group: compat <command>mymachines</command> systemd
shadow: compat shadow: compat
hosts: <command>mymachines</command> resolve [!UNAVAIL=return] myhostname files dns hosts: files <command>mymachines</command> resolve [!UNAVAIL=return] dns myhostname
networks: files networks: files
protocols: db files protocols: db files

View File

@ -34,15 +34,14 @@
name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
hostnames via DNS.</para> hostnames via DNS.</para>
<para>To activate the NSS module, add <literal>resolve [!UNAVAIL=return]</literal> to the line starting <para>To activate the NSS module, add <literal>resolve</literal> to the line starting with
with <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifically, it is <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifically, it is recommended to place
recommended to place <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s <literal>hosts:</literal> line (but
<literal>hosts:</literal> line. It should be before the <literal>files</literal> entry, since after the <literal>files</literal> or <literal>mymachines</literal> entries), right before the
<filename>systemd-resolved</filename> supports <filename>/etc/hosts</filename> internally, but with <literal>dns</literal> entry if it exists, followed by <literal>[!UNAVAIL=return]</literal>, to ensure DNS queries
caching. To the contrary, it should be after <literal>mymachines</literal>, to give hostnames given to are always routed via
local VMs and containers precedence over names received over DNS. Finally, we recommend placing <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> if it is
<literal>dns</literal> somewhere after <literal>resolve</literal>, to fall back to running, but are routed to <command>nss-dns</command> if this service is not available.</para>
<command>nss-dns</command> if <filename>systemd-resolved.service</filename> is not available.</para>
<para>Note that <command>systemd-resolved</command> will synthesize DNS resource <para>Note that <command>systemd-resolved</command> will synthesize DNS resource
records in a few cases, for example for <literal>localhost</literal> and the records in a few cases, for example for <literal>localhost</literal> and the
@ -67,7 +66,7 @@
group: compat mymachines systemd group: compat mymachines systemd
shadow: compat shadow: compat
hosts: mymachines <command>resolve [!UNAVAIL=return]</command> myhostname files dns hosts: files mymachines <command>resolve [!UNAVAIL=return]</command> dns myhostname
networks: files networks: files
protocols: db files protocols: db files

View File

@ -65,7 +65,7 @@
group: compat [SUCCESS=merge] mymachines [SUCCESS=merge] <command>systemd</command> group: compat [SUCCESS=merge] mymachines [SUCCESS=merge] <command>systemd</command>
shadow: compat shadow: compat
hosts: mymachines resolve [!UNAVAIL=return] myhostname files dns hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
networks: files networks: files
protocols: db files protocols: db files

View File

@ -1714,7 +1714,7 @@ exe = executable('systemd-analyze',
libmount, libmount,
libblkid], libblkid],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : get_option('analyze')) install : true)
public_programs += exe public_programs += exe
executable('systemd-journald', executable('systemd-journald',
@ -3500,8 +3500,6 @@ foreach tuple : [
['link-systemctl-shared', get_option('link-systemctl-shared')], ['link-systemctl-shared', get_option('link-systemctl-shared')],
['link-networkd-shared', get_option('link-networkd-shared')], ['link-networkd-shared', get_option('link-networkd-shared')],
['link-timesyncd-shared', get_option('link-timesyncd-shared')], ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
['kernel-install', get_option('kernel-install')],
['systemd-analyze', get_option('analyze')],
] ]
if tuple.length() >= 2 if tuple.length() >= 2

View File

@ -363,6 +363,4 @@ option('oss-fuzz', type : 'boolean', value : 'false',
option('llvm-fuzz', type : 'boolean', value : 'false', option('llvm-fuzz', type : 'boolean', value : 'false',
description : 'build against LLVM libFuzzer') description : 'build against LLVM libFuzzer')
option('kernel-install', type: 'boolean', value: 'true', option('kernel-install', type: 'boolean', value: 'true',
description : 'install kernel-install and associated files') description : 'include kernel-install feature')
option('analyze', type: 'boolean', value: 'true',
description : 'install systemd-analyze')

View File

@ -2931,10 +2931,12 @@ int manager_loop(Manager *m) {
if (manager_dispatch_dbus_queue(m) > 0) if (manager_dispatch_dbus_queue(m) > 0)
continue; continue;
/* Sleep for watchdog runtime wait time */ /* Sleep for half the watchdog time */
if (MANAGER_IS_SYSTEM(m)) if (timestamp_is_set(m->runtime_watchdog) && MANAGER_IS_SYSTEM(m)) {
wait_usec = watchdog_runtime_wait(); wait_usec = m->runtime_watchdog / 2;
else if (wait_usec <= 0)
wait_usec = 1;
} else
wait_usec = USEC_INFINITY; wait_usec = USEC_INFINITY;
r = sd_event_run(m->event, wait_usec); r = sd_event_run(m->event, wait_usec);

View File

@ -825,15 +825,7 @@ static int show_properties(sd_bus *bus, const char *path, bool *new_line) {
*new_line = true; *new_line = true;
r = bus_print_all_properties( r = bus_print_all_properties(bus, "org.freedesktop.login1", path, print_property, arg_property, arg_value, arg_all, NULL);
bus,
"org.freedesktop.login1",
path,
print_property,
arg_property,
arg_value,
arg_all,
NULL);
if (r < 0) if (r < 0)
return bus_log_parse_error(r); return bus_log_parse_error(r);
@ -1355,6 +1347,7 @@ static int help(int argc, char *argv[], void *userdata) {
} }
static int parse_argv(int argc, char *argv[]) { static int parse_argv(int argc, char *argv[]) {
enum { enum {
ARG_VERSION = 0x100, ARG_VERSION = 0x100,
ARG_VALUE, ARG_VALUE,
@ -1493,6 +1486,7 @@ static int parse_argv(int argc, char *argv[]) {
} }
static int loginctl_main(int argc, char *argv[], sd_bus *bus) { static int loginctl_main(int argc, char *argv[], sd_bus *bus) {
static const Verb verbs[] = { static const Verb verbs[] = {
{ "help", VERB_ANY, VERB_ANY, 0, help }, { "help", VERB_ANY, VERB_ANY, 0, help },
{ "list-sessions", VERB_ANY, 1, VERB_DEFAULT, list_sessions }, { "list-sessions", VERB_ANY, 1, VERB_DEFAULT, list_sessions },

View File

@ -3170,12 +3170,6 @@ static int method_set_wall_message(
if (r < 0) if (r < 0)
return r; return r;
/* Short-circuit the operation if the desired state is already in place, to
* avoid an unnecessary polkit permission check. */
if (streq_ptr(m->wall_message, empty_to_null(wall_message)) &&
m->enable_wall_messages == enable_wall_messages)
goto done;
r = bus_verify_polkit_async(message, r = bus_verify_polkit_async(message,
CAP_SYS_ADMIN, CAP_SYS_ADMIN,
"org.freedesktop.login1.set-wall-message", "org.freedesktop.login1.set-wall-message",
@ -3195,7 +3189,6 @@ static int method_set_wall_message(
m->enable_wall_messages = enable_wall_messages; m->enable_wall_messages = enable_wall_messages;
done:
return sd_bus_reply_method_return(message, NULL); return sd_bus_reply_method_return(message, NULL);
} }

View File

@ -283,9 +283,9 @@ static int write_uplink_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSe
"# This is a dynamic resolv.conf file for connecting local clients directly to\n" "# This is a dynamic resolv.conf file for connecting local clients directly to\n"
"# all known uplink DNS servers. This file lists all configured search domains.\n" "# all known uplink DNS servers. This file lists all configured search domains.\n"
"#\n" "#\n"
"# Third party programs should typically not access this file directly, but only\n" "# Third party programs must not access this file directly, but only through the\n"
"# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a\n" "# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,\n"
"# different way, replace this symlink by a static file or a different symlink.\n" "# replace this symlink by a static file or a different symlink.\n"
"#\n" "#\n"
"# See man:systemd-resolved.service(8) for details about the supported modes of\n" "# See man:systemd-resolved.service(8) for details about the supported modes of\n"
"# operation for /etc/resolv.conf.\n" "# operation for /etc/resolv.conf.\n"
@ -308,24 +308,24 @@ static int write_uplink_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSe
} }
static int write_stub_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSet *domains) { static int write_stub_resolv_conf_contents(FILE *f, OrderedSet *dns, OrderedSet *domains) {
fputs("# This file is managed by man:systemd-resolved(8). Do not edit.\n" fputs_unlocked("# This file is managed by man:systemd-resolved(8). Do not edit.\n"
"#\n" "#\n"
"# This is a dynamic resolv.conf file for connecting local clients to the\n" "# This is a dynamic resolv.conf file for connecting local clients to the\n"
"# internal DNS stub resolver of systemd-resolved. This file lists all\n" "# internal DNS stub resolver of systemd-resolved. This file lists all\n"
"# configured search domains.\n" "# configured search domains.\n"
"#\n" "#\n"
"# Run \"resolvectl status\" to see details about the uplink DNS servers\n" "# Run \"resolvectl status\" to see details about the uplink DNS servers\n"
"# currently in use.\n" "# currently in use.\n"
"#\n" "#\n"
"# Third party programs should typically not access this file directly, but only\n" "# Third party programs must not access this file directly, but only through the\n"
"# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a\n" "# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,\n"
"# different way, replace this symlink by a static file or a different symlink.\n" "# replace this symlink by a static file or a different symlink.\n"
"#\n" "#\n"
"# See man:systemd-resolved.service(8) for details about the supported modes of\n" "# See man:systemd-resolved.service(8) for details about the supported modes of\n"
"# operation for /etc/resolv.conf.\n" "# operation for /etc/resolv.conf.\n"
"\n" "\n"
"nameserver 127.0.0.53\n" "nameserver 127.0.0.53\n"
"options edns0\n", f); "options edns0\n", f);
if (!ordered_set_isempty(domains)) if (!ordered_set_isempty(domains))
write_resolv_conf_search(domains, f); write_resolv_conf_search(domains, f);

View File

@ -16,7 +16,6 @@
static int watchdog_fd = -1; static int watchdog_fd = -1;
static char *watchdog_device = NULL; static char *watchdog_device = NULL;
static usec_t watchdog_timeout = USEC_INFINITY; static usec_t watchdog_timeout = USEC_INFINITY;
static usec_t watchdog_last_ping = USEC_INFINITY;
static int update_timeout(void) { static int update_timeout(void) {
int r; int r;
@ -58,8 +57,6 @@ static int update_timeout(void) {
r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0); r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0);
if (r < 0) if (r < 0)
return log_warning_errno(errno, "Failed to ping hardware watchdog: %m"); return log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
watchdog_last_ping = now(clock_boottime_or_monotonic());
} }
return 0; return 0;
@ -117,38 +114,9 @@ int watchdog_set_timeout(usec_t *usec) {
return r; return r;
} }
usec_t watchdog_runtime_wait(void) {
usec_t rtwait;
usec_t ntime;
if (!timestamp_is_set(watchdog_timeout))
return USEC_INFINITY;
/* Sleep half the watchdog timeout since the last succesful ping at most */
if (timestamp_is_set(watchdog_last_ping)) {
ntime = now(clock_boottime_or_monotonic());
assert(ntime >= watchdog_last_ping);
rtwait = usec_sub_unsigned(watchdog_last_ping + (watchdog_timeout / 2), ntime);
} else
rtwait = watchdog_timeout / 2;
return rtwait;
}
int watchdog_ping(void) { int watchdog_ping(void) {
usec_t ntime;
int r; int r;
ntime = now(clock_boottime_or_monotonic());
/* Never ping earlier than watchdog_timeout/4 and try to ping
* by watchdog_timeout/2 plus scheduling latencies the latest */
if (timestamp_is_set(watchdog_last_ping)) {
assert(ntime >= watchdog_last_ping);
if ((ntime - watchdog_last_ping) < (watchdog_timeout / 4))
return 0;
}
if (watchdog_fd < 0) { if (watchdog_fd < 0) {
r = open_watchdog(); r = open_watchdog();
if (r < 0) if (r < 0)
@ -159,8 +127,6 @@ int watchdog_ping(void) {
if (r < 0) if (r < 0)
return log_warning_errno(errno, "Failed to ping hardware watchdog: %m"); return log_warning_errno(errno, "Failed to ping hardware watchdog: %m");
watchdog_last_ping = ntime;
return 0; return 0;
} }

View File

@ -10,7 +10,6 @@ int watchdog_set_device(char *path);
int watchdog_set_timeout(usec_t *usec); int watchdog_set_timeout(usec_t *usec);
int watchdog_ping(void); int watchdog_ping(void);
void watchdog_close(bool disarm); void watchdog_close(bool disarm);
usec_t watchdog_runtime_wait(void);
static inline void watchdog_free_device(void) { static inline void watchdog_free_device(void) {
(void) watchdog_set_device(NULL); (void) watchdog_set_device(NULL);

View File

@ -879,7 +879,7 @@ install_execs() {
# also, plymouth is pulled in by rescue.service, but even there the exit code # also, plymouth is pulled in by rescue.service, but even there the exit code
# is ignored; as it's not present on some distros, don't fail if it doesn't exist # is ignored; as it's not present on some distros, don't fail if it doesn't exist
dinfo "Attempting to install $i" dinfo "Attempting to install $i"
inst $i || [ "${i%.local}" != "$i" ] || [ "${i%systemd-update-done}" != "$i" ] || [ "${i##*/}" == "plymouth" ] inst $i || [ "${i%.local}" != "$i" ] || [ "${i%systemd-update-done}" != "$i" ] || [ "/bin/plymouth" == "$i" ]
done done
) )
} }

View File

@ -19,7 +19,7 @@ Before=rescue.service
[Service] [Service]
Environment=HOME=/root Environment=HOME=/root
WorkingDirectory=-/root WorkingDirectory=-/root
ExecStartPre=-@rootbindir@/plymouth --wait quit ExecStartPre=-/bin/plymouth --wait quit
ExecStart=-@rootlibexecdir@/systemd-sulogin-shell emergency ExecStart=-@rootlibexecdir@/systemd-sulogin-shell emergency
Type=idle Type=idle
StandardInput=tty-force StandardInput=tty-force

View File

@ -18,7 +18,7 @@ Before=shutdown.target
[Service] [Service]
Environment=HOME=/root Environment=HOME=/root
WorkingDirectory=-/root WorkingDirectory=-/root
ExecStartPre=-@rootbindir@/plymouth --wait quit ExecStartPre=-/bin/plymouth --wait quit
ExecStart=-@rootlibexecdir@/systemd-sulogin-shell rescue ExecStart=-@rootlibexecdir@/systemd-sulogin-shell rescue
Type=idle Type=idle
StandardInput=tty-force StandardInput=tty-force