Compare commits

..

11 Commits

Author SHA1 Message Date
Yu Watanabe f5c3892266
network: also assume Table=local for ipv6 route if Type=local, broadcast, anycast or nat (#14148)
Also, if Type=multicast and scope is not set, then assume Scope=link.

Fixes #14122.
2019-11-26 12:41:54 +09:00
Yu Watanabe cfbb1c6def
Merge pull request #14134 from keszybz/variables-and-docs
Documentation and option parsing fixes
2019-11-26 12:40:30 +09:00
Anita Zhang 05d6628ad2
Merge pull request #14151 from mk-fg/fix-timer-dump-syntax-bug
core.timer: fix "systemd-analyze dump" and docs syntax inconsistencies wrt OnTimezoneChange=
2019-11-25 15:56:33 -08:00
Mike Kazantsev 0810e39628 core.timer: fix "systemd-analyze dump" and docs syntax inconsistencies wrt OnTimezoneChange= 2019-11-26 04:29:03 +05:00
Anita Zhang 9b1f0b9064
Merge pull request #14112 from keszybz/restart-no-log
core/service: downgrade "scheduling restart" message to debug
2019-11-25 12:09:00 -08:00
Zbigniew Jędrzejewski-Szmek 6a5b75dbcc man: refer to systemd.syntax(7) from systemd.nspawn(5)
systemd.nspawn(5) contained a partial repeat of the stuff that is now in the
dedicated man page. Let's just refer to that.

While at it, do s/searched/searched for/ where appropriate and reword some
sentences for brevity.
2019-11-25 14:03:09 +01:00
Zbigniew Jędrzejewski-Szmek 83dbb4df99 fuzz-unit-file: add new items to the corpus 2019-11-25 14:02:58 +01:00
Zbigniew Jędrzejewski-Szmek 0b8d307587 pid1: fix the names of AllowedCPUs= and AllowedMemoryNodes=
The original PR was submitted with CPUSetCpus and CPUSetMems, which was later
changed to AllowedCPUs and AllowedMemmoryNodes everywhere (including the parser
used by systemd-run), but not in the parser for unit files.

Since we already released -rc1, let's keep support for the old names. I think
we can remove it in a release or two if anyone remembers to do that.

Fixes #14126. Follow-up for 047f5d63d7.
2019-11-25 14:02:14 +01:00
Zbigniew Jędrzejewski-Szmek 3d58bfc01c man: document all pager variables for systemctl and systemd
In those two pages, we need to include individual entries with xi:include to
merge the list less-variables.xml with the other entries, which is obviously
error prone. All variables are supported in both tools so add them.
2019-11-24 13:59:32 +01:00
Zbigniew Jędrzejewski-Szmek c484315b01 basic/terminal-util: add support for $NO_COLOR
See inline comments. Fixes #13752.
2019-11-24 13:59:22 +01:00
Zbigniew Jędrzejewski-Szmek 868f7d36cc core/service: downgrade "scheduling restart" message to debug
I see we log this during every boot, even though it is a routine expected event:
Nov 12 14:50:01 krowka systemd[1]: systemd-journald.service: Service has no hold-off time (RestartSec=0), scheduling restart.
(and for other services too). Let's downgrade this to debug level.

https://bugzilla.redhat.com/show_bug.cgi?id=1614871
2019-11-22 14:19:51 +01:00
15 changed files with 85 additions and 78 deletions

View File

@ -348,7 +348,7 @@ Most timer unit settings are available to transient units.
✓ OnCalendar=
✓ OnClockChange=
✓ OnStartupSec=
✓ OnTimezoneChange
✓ OnTimezoneChange=
✓ OnUnitActiveSec=
✓ OnUnitInactiveSec=
✓ Persistent=

View File

@ -73,6 +73,17 @@
</listitem>
</varlistentry>
<!-- This is not documented on purpose, because it is not clear if $NO_COLOR will become supported
widely enough. So let's provide support, but without advertising this.
<varlistentry id='no-color'>
<term><varname>$NO_COLOR</varname></term>
<listitem><para>If set (to any value), and <varname>$SYSTEMD_COLORS</varname> is not set, equivalent to
<option>SYSTEMD_COLORS=0</option>. See <ulink url="https://no-color.org/">no-color.org</ulink>.</para>
</listitem>
</varlistentry>
-->
<varlistentry id='urlify'>
<term><varname>$SYSTEMD_URLIFY</varname></term>

View File

@ -2161,6 +2161,8 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<xi:include href="less-variables.xml" xpointer="pager"/>
<xi:include href="less-variables.xml" xpointer="less"/>
<xi:include href="less-variables.xml" xpointer="lesscharset"/>
<xi:include href="less-variables.xml" xpointer="colors"/>
<xi:include href="less-variables.xml" xpointer="urlify"/>
</refsect1>
<refsect1>

View File

@ -1263,9 +1263,12 @@
<varlistentry>
<term><varname>Scope=</varname></term>
<listitem>
<para>The scope of the route, which can be <literal>global</literal>,
<literal>link</literal> or <literal>host</literal>. Defaults to
<literal>global</literal>.</para>
<para>The scope of the route, which can be <literal>global</literal>, <literal>site</literal>,
<literal>link</literal>, <literal>host</literal>, or <literal>nowhere</literal>. For IPv4 route,
defaults to <literal>host</literal> if <varname>Type=</varname> is <literal>local</literal>
or <literal>nat</literal>, and <literal>link</literal> if <varname>Type=</varname> is
<literal>broadcast</literal>, <literal>multicast</literal>, or <literal>anycast</literal>.
In other cases, defaults to <literal>global</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>
@ -1277,10 +1280,14 @@
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Table=<replaceable>num</replaceable></varname></term>
<term><varname>Table=</varname></term>
<listitem>
<para>The table identifier for the route (a number between 1 and 4294967295, or 0 to unset).
The table can be retrieved using <command>ip route show table <replaceable>num</replaceable></command>.
<para>The table identifier for the route. Takes <literal>default</literal>,
<literal>main</literal>, <literal>local</literal> or a number between 1 and 4294967295.
The table can be retrieved using <command>ip route show table <replaceable>num</replaceable></command>.
If unset and <varname>Type=</varname> is <literal>local</literal>, <literal>broadcast</literal>,
<literal>anycast</literal>, or <literal>nat</literal>, then <literal>local</literal> is used.
In other cases, defaults to <literal>main</literal>.
</para>
</listitem>
</varlistentry>

View File

@ -32,58 +32,32 @@
<refsect1>
<title>Description</title>
<para>An nspawn container settings file (suffix
<filename>.nspawn</filename>) encodes additional runtime
information about a local container, and is searched, read and
used by
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
when starting a container. Files of this type are named after the
containers they define settings for. They are optional, and only
required for containers whose execution environment shall differ
from the defaults. Files of this type mostly contain settings that
may also be set on the <command>systemd-nspawn</command> command
line, and make it easier to persistently attach specific settings
to specific containers. The syntax of these files is inspired by
<filename>.desktop</filename> files following the <ulink
url="http://standards.freedesktop.org/desktop-entry-spec/latest/">XDG
Desktop Entry Specification</ulink>, which in turn are inspired by
Microsoft Windows <filename>.ini</filename> files.</para>
<para>Boolean arguments used in these settings files can be
written in various formats. For positive settings, the strings
<option>1</option>, <option>yes</option>, <option>true</option>
and <option>on</option> are equivalent. For negative settings, the
strings <option>0</option>, <option>no</option>,
<option>false</option> and <option>off</option> are
equivalent.</para>
<para>Empty lines and lines starting with # or ; are
ignored. This may be used for commenting. Lines ending
in a backslash are concatenated with the following
line while reading and the backslash is replaced by a
space character. This may be used to wrap long lines.</para>
<para>An nspawn container settings file (suffix <filename>.nspawn</filename>) contains runtime
configuration for a local container, and is used used by
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
Files of this type are named after the containers they define settings for. They are optional, and only
required for containers whose execution environment shall differ from the defaults. Files of this type
mostly contain settings that may also be set on the <command>systemd-nspawn</command> command line, and
make it easier to persistently attach specific settings to specific containers. The syntax of these files
is inspired by <filename>.desktop</filename> files, similarly to other configuration files supported by
the systemd project. See
<citerefentry><refentrytitle>systemd.syntax</refentrytitle><manvolnum>7</manvolnum></citerefentry> for an
overview.</para>
</refsect1>
<refsect1>
<title><filename>.nspawn</filename> File Discovery</title>
<para>Files are searched by appending the
<filename>.nspawn</filename> suffix to the machine name of the
container, as specified with the <option>--machine=</option>
switch of <command>systemd-nspawn</command>, or derived from the
directory or image file name. This file is first searched in
<filename>/etc/systemd/nspawn/</filename> and
<filename>/run/systemd/nspawn/</filename>. If found in these
directories, its settings are read and all of them take full effect
(but are possibly overridden by corresponding command line
arguments). If not found, the file will then be searched next to
the image file or in the immediate parent of the root directory of
the container. If the file is found there, only a subset of the
settings will take effect however. All settings that possibly
elevate privileges or grant additional access to resources of the
host (such as files or directories) are ignored. To which options
this applies is documented below.</para>
<para>Files are searched for by appending the <filename>.nspawn</filename> suffix to the machine name of
the container, as specified with the <option>--machine=</option> switch of
<command>systemd-nspawn</command>, or derived from the directory or image file name. This file is first
searched for in <filename>/etc/systemd/nspawn/</filename> and
<filename>/run/systemd/nspawn/</filename>. If found there, the settings are read and all of them take
full effect (but may still be overridden by corresponding command line arguments). Otherwise, the file
will then be searched for next to the image file or in the immediate parent of the root directory of the
container. If the file is found there, only a subset of the settings will take effect however. All
settings that possibly elevate privileges or grant additional access to resources of the host (such as
files or directories) are ignored. To which options this applies is documented below.</para>
<para>Persistent settings files created and maintained by the
administrator (and thus trusted) should be placed in

View File

@ -42,7 +42,9 @@
<citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry></para></listitem>
<citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.nspawn</refentrytitle><manvolnum>5</manvolnum></citerefentry>
</para></listitem>
<listitem><para>daemon config files, see
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,

View File

@ -669,8 +669,11 @@
script runlevel link farms.</para></listitem>
</varlistentry>
<xi:include href="less-variables.xml" xpointer="colors" />
<xi:include href="less-variables.xml" xpointer="urlify" />
<xi:include href="less-variables.xml" xpointer="pager"/>
<xi:include href="less-variables.xml" xpointer="less"/>
<xi:include href="less-variables.xml" xpointer="lesscharset"/>
<xi:include href="less-variables.xml" xpointer="colors"/>
<xi:include href="less-variables.xml" xpointer="urlify"/>
<varlistentry>
<term><varname>$LISTEN_PID</varname></term>

View File

@ -1206,6 +1206,11 @@ bool colors_enabled(void) {
val = getenv_bool("SYSTEMD_COLORS");
if (val >= 0)
cached_colors_enabled = val;
else if (getenv("NO_COLOR"))
/* We only check for the presence of the variable; value is ignored. */
cached_colors_enabled = false;
else if (getpid_cached() == 1)
/* PID1 outputs to the console without holding it open all the time */
cached_colors_enabled = !getenv_terminal_is_dumb();
@ -1231,6 +1236,9 @@ bool dev_console_colors_enabled(void) {
if (b >= 0)
return b;
if (getenv("NO_COLOR"))
return false;
if (getenv_for_pid(1, "TERM", &s) <= 0)
(void) proc_cmdline_get_key("TERM", 0, &s);

View File

@ -166,6 +166,8 @@ $1.WatchdogSignal, config_parse_signal, 0,
)m4_dnl
m4_define(`CGROUP_CONTEXT_CONFIG_ITEMS',
`$1.Slice, config_parse_unit_slice, 0, 0
$1.AllowedCPUs, config_parse_allowed_cpus, 0, offsetof($1, cgroup_context)
$1.AllowedMemoryNodes, config_parse_allowed_mems, 0, offsetof($1, cgroup_context)
$1.CPUAccounting, config_parse_bool, 0, offsetof($1, cgroup_context.cpu_accounting)
$1.CPUWeight, config_parse_cg_weight, 0, offsetof($1, cgroup_context.cpu_weight)
$1.StartupCPUWeight, config_parse_cg_weight, 0, offsetof($1, cgroup_context.startup_cpu_weight)
@ -173,8 +175,6 @@ $1.CPUShares, config_parse_cpu_shares, 0,
$1.StartupCPUShares, config_parse_cpu_shares, 0, offsetof($1, cgroup_context.startup_cpu_shares)
$1.CPUQuota, config_parse_cpu_quota, 0, offsetof($1, cgroup_context)
$1.CPUQuotaPeriodSec, config_parse_sec_def_infinity, 0, offsetof($1, cgroup_context.cpu_quota_period_usec)
$1.CPUSetCpus, config_parse_cpuset_cpus, 0, offsetof($1, cgroup_context)
$1.CPUSetMems, config_parse_cpuset_mems, 0, offsetof($1, cgroup_context)
$1.MemoryAccounting, config_parse_bool, 0, offsetof($1, cgroup_context.memory_accounting)
$1.MemoryMin, config_parse_memory_limit, 0, offsetof($1, cgroup_context)
$1.DefaultMemoryMin, config_parse_memory_limit, 0, offsetof($1, cgroup_context)

View File

@ -3146,7 +3146,7 @@ int config_parse_cpu_quota(
return 0;
}
int config_parse_cpuset_cpus(
int config_parse_allowed_cpus(
const char *unit,
const char *filename,
unsigned line,
@ -3165,7 +3165,7 @@ int config_parse_cpuset_cpus(
return 0;
}
int config_parse_cpuset_mems(
int config_parse_allowed_mems(
const char *unit,
const char *filename,
unsigned line,

View File

@ -90,8 +90,8 @@ CONFIG_PARSER_PROTOTYPE(config_parse_set_status);
CONFIG_PARSER_PROTOTYPE(config_parse_namespace_path_strv);
CONFIG_PARSER_PROTOTYPE(config_parse_temporary_filesystems);
CONFIG_PARSER_PROTOTYPE(config_parse_cpu_quota);
CONFIG_PARSER_PROTOTYPE(config_parse_cpuset_cpus);
CONFIG_PARSER_PROTOTYPE(config_parse_cpuset_mems);
CONFIG_PARSER_PROTOTYPE(config_parse_allowed_cpus);
CONFIG_PARSER_PROTOTYPE(config_parse_allowed_mems);
CONFIG_PARSER_PROTOTYPE(config_parse_protect_home);
CONFIG_PARSER_PROTOTYPE(config_parse_protect_system);
CONFIG_PARSER_PROTOTYPE(config_parse_bus_name);

View File

@ -3758,12 +3758,12 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
case SERVICE_AUTO_RESTART:
if (s->restart_usec > 0) {
char buf_restart[FORMAT_TIMESPAN_MAX];
log_unit_info(UNIT(s),
"Service RestartSec=%s expired, scheduling restart.",
format_timespan(buf_restart, sizeof buf_restart, s->restart_usec, USEC_PER_SEC));
log_unit_debug(UNIT(s),
"Service RestartSec=%s expired, scheduling restart.",
format_timespan(buf_restart, sizeof buf_restart, s->restart_usec, USEC_PER_SEC));
} else
log_unit_info(UNIT(s),
"Service has no hold-off time (RestartSec=0), scheduling restart.");
log_unit_debug(UNIT(s),
"Service has no hold-off time (RestartSec=0), scheduling restart.");
service_enter_restart(s);
break;

View File

@ -216,7 +216,7 @@ static void timer_dump(Unit *u, FILE *f, const char *prefix) {
"%sAccuracy: %s\n"
"%sRemainAfterElapse: %s\n"
"%sOnClockChange: %s\n"
"%sOnTimeZoneChange %s\n",
"%sOnTimeZoneChange: %s\n",
prefix, timer_state_to_string(t->state),
prefix, timer_result_to_string(t->result),
prefix, trigger ? trigger->id : "n/a",

View File

@ -1494,16 +1494,14 @@ int route_section_verify(Route *route, Network *network) {
route->section->filename, route->section->line);
}
if (route->family != AF_INET6) {
if (!route->table_set && IN_SET(route->type, RTN_LOCAL, RTN_BROADCAST, RTN_ANYCAST, RTN_NAT))
route->table = RT_TABLE_LOCAL;
if (!route->table_set && IN_SET(route->type, RTN_LOCAL, RTN_BROADCAST, RTN_ANYCAST, RTN_NAT))
route->table = RT_TABLE_LOCAL;
if (!route->scope_set) {
if (IN_SET(route->type, RTN_LOCAL, RTN_NAT))
route->scope = RT_SCOPE_HOST;
else if (IN_SET(route->type, RTN_BROADCAST, RTN_ANYCAST))
route->scope = RT_SCOPE_LINK;
}
if (!route->scope_set && route->family != AF_INET6) {
if (IN_SET(route->type, RTN_LOCAL, RTN_NAT))
route->scope = RT_SCOPE_HOST;
else if (IN_SET(route->type, RTN_BROADCAST, RTN_ANYCAST, RTN_MULTICAST))
route->scope = RT_SCOPE_LINK;
}
if (network->n_static_addresses == 0 &&

View File

@ -3,6 +3,8 @@ Accept=
AccuracySec=
After=
Alias=
AllowedCPUs=
AllowedMemoryNodes=
AllowIsolate=
Also=
AmbientCapabilities=