systemd/.git
5 years agocore: create per-user inaccessible node from the service manager v246.4
Lennart Poettering [Wed, 19 Aug 2020 15:42:33 +0000 (17:42 +0200)]
core: create per-user inaccessible node from the service manager

Previously, we'd create them from user-runtime-dir@.service. That has
one benefit: since this service runs privileged, we can create the full
set of device nodes. It has one major drawback though: it security-wise
problematic to create files/directories in directories as privileged
user in directories owned by unprivileged users, since they can use
symlinks to redirect what we want to do. As a general rule we hence
avoid this logic: only unpriv code should populate unpriv directories.

Hence, let's move this code to an appropriate place in the service
manager. This means we lose the inaccessible block device node, but
since there's already a fallback in place, this shouldn't be too bad.

(cherry picked from commit 3242980582d501ec2adbcc0f794c7161056812e8)

5 years agonspawn,pid1: pass "inaccessible" nodes from cntr mgr to pid1 payload via /run/host
Lennart Poettering [Fri, 14 Aug 2020 16:56:54 +0000 (18:56 +0200)]
nspawn,pid1: pass "inaccessible" nodes from cntr mgr to pid1 payload via /run/host

Let's make /run/host the sole place we pass stuff from host to container
in and place the "inaccessible" nodes in /run/host too.

In contrast to the previous two commits this is a minor compat break, but
not a relevant one I think. Previously the container manager would place
these nodes in /run/systemd/inaccessible/ and that's where PID 1 in the
container would try to add them too when missing. Container manager and
PID 1 in the container would thus manage the same dir together.

With this change the container manager now passes an immutable directory
to the container and leaves /run/systemd entirely untouched, and managed
exclusively by PID 1 inside the container, which is nice to have clear
separation on who manages what.

In order to make sure systemd then usses the /run/host/inaccesible/
nodes this commit changes PID 1 to look for that dir and if it exists
will symlink it to /run/systemd/inaccessible.

Now, this will work fine if new nspawn and new pid 1 in the container
work together. as then the symlink is created and the difference between
the two dirs won't matter.

For the case where an old nspawn invokes a new PID 1: in this case
things work as they always worked: the dir is managed together.

For the case where different container manager invokes a new PID 1: in
this case the nodes aren't typically passed in, and PID 1 in the
container will try to create them and will likely fail partially (though
gracefully) when trying to create char/block device nodes. THis is fine
though as there are fallbacks in place for that case.

For the case where a new nspawn invokes an old PID1: this is were the
(minor) incompatibily happens: in this case new nspawn will place the
nodes in the /run/host/inaccessible/ subdir, but the PID 1 in the
container won't look for them there. Since the nodes are also not
pre-created in /run/systed/inaccessible/ PID 1 will try to create them
there as if a different container manager sets them up. This is of
course not sexy, but is not a total loss, since as mentioned fallbacks
are in place anyway. Hence I think it's OK to accept this minor
incompatibility.

(cherry picked from commit 9fac502920a648d82e21b207989bfc3c00fbdebc)

5 years agocoredump: don't convert s → µs twice
Lennart Poettering [Tue, 1 Sep 2020 18:29:28 +0000 (20:29 +0200)]
coredump: don't convert s → µs twice

We already append 000000 early on when parsing the cmdline args, let's
not do that a second time.

Fixes: #16919
(cherry picked from commit 64a5384fd2cde9b66a778c318036e7771f273f17)

5 years agofirstboot: fill empty color if ansi_color unavailable from os-release
afg [Tue, 1 Sep 2020 21:20:25 +0000 (05:20 +0800)]
firstboot: fill empty color if ansi_color unavailable from os-release

(cherry picked from commit ae0d36c161ef0b8bde08d37674eb500061245728)

5 years agovarlink: do not parse invalid messages twice
Zbigniew Jędrzejewski-Szmek [Fri, 28 Aug 2020 17:22:20 +0000 (19:22 +0200)]
varlink: do not parse invalid messages twice

Upon reception of a message which fails in json_parse(), we would proceed to
parse it again from a deferred callback and hang. Once we have realized that
the message is invalid, let's move the pointer in the buffer even if the
message is invalid. We don't want to look at this data again.

(before) $ build-rawhide/userdbctl --output=json user test.user
n/a: varlink: setting state idle-client
/run/systemd/userdb/io.systemd.Multiplexer: Sending message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{"userName":"test.user","service":"io.systemd.Multiplexer"}}
/run/systemd/userdb/io.systemd.Multiplexer: varlink: changing state idle-client → awaiting-reply
/run/systemd/userdb/io.systemd.Multiplexer: New incoming message: {...}
/run/systemd/userdb/io.systemd.Multiplexer: varlink: changing state awaiting-reply → pending-disconnect
/run/systemd/userdb/io.systemd.Multiplexer: New incoming message: {...}
/run/systemd/userdb/io.systemd.Multiplexer: varlink: changing state pending-disconnect → disconnected
^C

(after) $ n/a: varlink: setting state idle-client
/run/systemd/userdb/io.systemd.Multiplexer: Sending message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{"userName":"test.user","service":"io.systemd.Multiplexer"}}
/run/systemd/userdb/io.systemd.Multiplexer: varlink: changing state idle-client → awaiting-reply
/run/systemd/userdb/io.systemd.Multiplexer: New incoming message: {...}
/run/systemd/userdb/io.systemd.Multiplexer: Failed to parse JSON: Invalid argument
/run/systemd/userdb/io.systemd.Multiplexer: varlink: changing state awaiting-reply → pending-disconnect
/run/systemd/userdb/io.systemd.Multiplexer: varlink: changing state pending-disconnect → processing-disconnect
Got lookup error: io.systemd.Disconnected
/run/systemd/userdb/io.systemd.Multiplexer: varlink: changing state processing-disconnect → disconnected
Failed to find user test.user: Input/output error

This should fix #16683 and https://bugs.gentoo.org/735072.

(cherry picked from commit 77472d06a4740d820ebccdb04e217d6b7d66dd50)

5 years agouserdbctl: add forgotten --output mode in help
Zbigniew Jędrzejewski-Szmek [Fri, 28 Aug 2020 15:25:14 +0000 (17:25 +0200)]
userdbctl: add forgotten --output mode in help

(cherry picked from commit c4651e3156463758ffde9a791197d62f76caf6ec)

5 years agoshared/{user,group}-record-nss: adjust filtering of "valid" passwords
Zbigniew Jędrzejewski-Szmek [Fri, 28 Aug 2020 14:23:16 +0000 (16:23 +0200)]
shared/{user,group}-record-nss: adjust filtering of "valid" passwords

We would reject various passwords that glibc accepts, for example ""
or any descrypted password. Accounts with empty password are definitely
useful, for example for testing or in scenarios where a password is not
needed. Also, using weak encryption methods is probably not a good idea,
it's not the job of our nss helpers to decide that: they should just
faithfully forward whatever data is there.

Also rename the function to make it more obvious that the returned answer
is not in any way certain.

(cherry picked from commit 8f796e40a561bd9200fde3c8885e6255a2dd4250)

5 years agodoc: cross link sd_listen_fd() docs a bit
Lennart Poettering [Mon, 31 Aug 2020 21:41:30 +0000 (23:41 +0200)]
doc: cross link sd_listen_fd() docs a bit

Let's make sure the sd_listen_fd() docs are really found from the
.socket file documentation as well as the FileDescriptorStoreMax=
documentation.

Let's also emphasize that that's where the order in which the fds are
passed are documented.

Fixes: #16647
(cherry picked from commit df2f58176d0093f5798240d4d0a69aba21a8f2e2)

5 years agoRework how we cache mtime to figure out if units changed
Zbigniew Jędrzejewski-Szmek [Fri, 28 Aug 2020 10:21:48 +0000 (12:21 +0200)]
Rework how we cache mtime to figure out if units changed

Instead of assuming that more-recently modified directories have higher mtime,
just look for any mtime changes, up or down. Since we don't want to remember
individual mtimes, hash them to obtain a single value.

This should help us behave properly in the case when the time jumps backwards
during boot: various files might have mtimes that in the future, but we won't
care. This fixes the following scenario:

We have /etc/systemd/system with T1. T1 is initially far in the past.
We have /run/systemd/generator with time T2.
The time is adjusted backwards, so T2 will be always in the future for a while.
Now the user writes new files to /etc/systemd/system, and T1 is updated to T1'.
Nevertheless, T1 < T1' << T2.
We would consider our cache to be up-to-date, falsely.

(cherry picked from commit c2911d48ff0fc61fb3cfab7050110992a7390417)

5 years agocore: always try to reload not-found unit
Zbigniew Jędrzejewski-Szmek [Mon, 31 Aug 2020 18:44:00 +0000 (20:44 +0200)]
core: always try to reload not-found unit

This check was added in d904afc730268d50502f764dfd55b8cf4906c46f. It would only
apply in the case where the cache hasn't been loaded yet. I think we pretty
much always have the cache loaded when we reach this point, but even if we
didn't, it seems better to try to reload the unit. So let's drop this check.

(cherry picked from commit 02103e57162946b5ac620c552123ff5e305a2791)

5 years agopid1: use the cache mtime not clock to "mark" load attempts
Zbigniew Jędrzejewski-Szmek [Fri, 28 Aug 2020 09:19:38 +0000 (11:19 +0200)]
pid1: use the cache mtime not clock to "mark" load attempts

We really only care if the cache has been reloaded between the time when we
last attempted to load this unit and now. So instead of recording the actual
time we try to load the unit, just store the timestamp of the cache. This has
the advantage that we'll notice if the cache mtime jumps forward or backward.

Also rename fragment_loadtime to fragment_not_found_time. It only gets set when
we failed to load the unit and the old name was suggesting it is always set.

In https://bugzilla.redhat.com/show_bug.cgi?id=1871327
(and most likely https://bugzilla.redhat.com/show_bug.cgi?id=1867930
and most likely https://bugzilla.redhat.com/show_bug.cgi?id=1872068) we try
to load a non-existent unit over and over from transaction_add_job_and_dependencies().
My understanding is that the clock was in the future during inital boot,
so cache_mtime is always in the future (since we don't touch the fs after initial boot),
so no matter how many times we try to load the unit and set
fragment_loadtime / fragment_not_found_time, it is always higher than cache_mtime,
so manager_unit_cache_should_retry_load() always returns true.

(cherry picked from commit c149d2b49128700a2ae361f43b9065b51c174838)

5 years agocore: rename manager_unit_file_maybe_loadable_from_cache()
Zbigniew Jędrzejewski-Szmek [Fri, 28 Aug 2020 08:32:39 +0000 (10:32 +0200)]
core: rename manager_unit_file_maybe_loadable_from_cache()

The name is misleading, since we aren't really loading the unit from cache — if
this function returns true, we'll try to load the unit from disk, updating the
cache in the process.

(cherry picked from commit 81be23886d3d2099784890f35379fee119b351a8)

5 years agoman: document fd ownership for sd-bus fd marshalling
Lennart Poettering [Fri, 28 Aug 2020 19:18:14 +0000 (21:18 +0200)]
man: document fd ownership for sd-bus fd marshalling

Fixes: #8003
(cherry picked from commit e2b40db616b4e723036f72a726e2f2f31d35ffe1)

5 years agoresolved: make sure we initialize t->answer_errno before completing the transaction
Lennart Poettering [Fri, 28 Aug 2020 20:44:57 +0000 (22:44 +0200)]
resolved: make sure we initialize t->answer_errno before completing the transaction

We must have the error number around when completing the transaction.
Let's hence make sure we always initialize it *first* (we accidentally
did it once after).

Fixes: #11626
(cherry picked from commit fd8a30170342cfe245ea6acac392c2b224f0ae1b)

5 years agohomed: fix log message to honor real homework path
Florian Klink [Sat, 29 Aug 2020 17:57:24 +0000 (19:57 +0200)]
homed: fix log message to honor real homework path

This seems to be overridable by setting the SYSTEMD_HOMEWORK_PATH env
variable, but the error message always printed the SYSTEMD_HOMEWORK_PATH
constant.

(cherry picked from commit 43269733ef5e987339b06bd407e4fccf5f76cbe3)

5 years agosrc/shared/dissect-image.c: fix build without blkdid (#16901)
Fabrice Fontaine [Sat, 29 Aug 2020 21:17:18 +0000 (23:17 +0200)]
src/shared/dissect-image.c: fix build without blkdid (#16901)

N_DEVICE_NODE_LIST_ATTEMPTS is unconditionally used since version 246 and
https://github.com/systemd/systemd/commit/ac1f3ad05f7476ae58981dcba45dfeb2c0006824

However, this variable is only defined if HAVE_BLKID is set resulting in
the following build failure if cryptsetup is enabled but not libblkid:

../src/shared/dissect-image.c:1336:34: error: 'N_DEVICE_NODE_LIST_ATTEMPTS' undeclared (first use in this function)
 1336 |         for (unsigned i = 0; i < N_DEVICE_NODE_LIST_ATTEMPTS; i++) {
      |

Fixes:
 - http://autobuild.buildroot.org/results/67782c225c08387c1bbcbea9eee3ca12bc6577cd
(cherry picked from commit 28e2641a1aa506c5df93c7a0cb107aed8297b45e)

5 years agoanalyze: fix error handling in one case
Lennart Poettering [Thu, 27 Aug 2020 13:46:03 +0000 (15:46 +0200)]
analyze: fix error handling in one case

(cherry picked from commit 0f849d0af983922e1571b958c9ca42f51e799190)

5 years agounits: add missing usb-gadget.target
Kyle Russell [Fri, 28 Aug 2020 13:36:35 +0000 (09:36 -0400)]
units: add missing usb-gadget.target

(cherry picked from commit dd050420390c6557354b0e3aaecd52abc4bf906c)

5 years agoman: extend on the usec/sec discrepancy
Lennart Poettering [Thu, 27 Aug 2020 13:45:29 +0000 (15:45 +0200)]
man: extend on the usec/sec discrepancy

Let's document the discrepancy between the Sec and USec suffixing of
unit files and D-Bus properties at three places: in "systemctl show"
(where it already was briefly mentioned), in the D-Bus interface
description (at one place at least, i.e. the most prominent of
properties that encapsulate time values, there are many more) and in the
general man page explaining time values.

By documenting this at all three places I think we now do as much as we
can do about this highlighting the discrepancy of the naming and the
reasons behind it.

Fixes: #2047
(cherry picked from commit 3c719357dcd56d4c826ec6a4e6870111c2ee8a36)

5 years agologin/logind: Include sys/stat.h for struct stat usage
Ikey Doherty [Fri, 28 Aug 2020 13:23:44 +0000 (14:23 +0100)]
login/logind: Include sys/stat.h for struct stat usage

We need to include `<sys/stat.h>` for usage of the `struct stat` in
the Manager struct, much as we already include `<stdbool.h>` for C99
booleans.

This helps alleviate another minor build failure on non-glibc systems.

(cherry picked from commit 97207ac85cb8f8cba9459694255ff0396f020279)

5 years agopartition/makefs: Include missing sys/file.h header
Ikey Doherty [Thu, 27 Aug 2020 16:45:45 +0000 (17:45 +0100)]
partition/makefs: Include missing sys/file.h header

This file must be included on non-glibc systems to ensure
the `LOCK_EX` definition is available.

Signed-off-by: Ikey Doherty <ikey.doherty@lispysnake.com>
(cherry picked from commit 677bb0555a9b3b8accf1ecaa8e86d068eb679dda)

5 years agonetwork: dhcp6: logs only new address
Yu Watanabe [Sat, 15 Aug 2020 10:01:49 +0000 (19:01 +0900)]
network: dhcp6: logs only new address

Closes #16731.

(cherry picked from commit 876dc2b0141de38fdf7f1b02644b5f454c967f61)

5 years agoDon't run test-repart when loop devices are not available
Daan De Meyer [Wed, 26 Aug 2020 22:08:52 +0000 (23:08 +0100)]
Don't run test-repart when loop devices are not available

(cherry picked from commit f17bdf8264e231fa31c769bff2475ef698487d0b)

5 years agoman: clarify that several networkctl commands takes device names
Yu Watanabe [Thu, 27 Aug 2020 07:35:25 +0000 (16:35 +0900)]
man: clarify that several networkctl commands takes device names

(cherry picked from commit f2c676c6c016e24f246a21d70e359b9358a2f61d)

5 years agonetworkctl: label command does not take any argument
Yu Watanabe [Thu, 27 Aug 2020 07:32:13 +0000 (16:32 +0900)]
networkctl: label command does not take any argument

(cherry picked from commit df696b1413abfc66e780f96e40f8ad2213af9341)

5 years agomissing: Add new Linux capability
Michal Koutný [Wed, 26 Aug 2020 13:37:21 +0000 (15:37 +0200)]
missing: Add new Linux capability

Yet another new capability coming in Linux kernel v5.9.
Make sure we can recongize them even when built with older kernel headers.

(cherry picked from commit 94d21c2ef6cd6bb035d4c21c98ab001c0abd4cbe)

5 years agotty-ask-pw-agent: properly propagate error
Lennart Poettering [Wed, 26 Aug 2020 21:10:50 +0000 (23:10 +0200)]
tty-ask-pw-agent: properly propagate error

(cherry picked from commit a4fd6cd3f575eb7e1452a74c2e35548739e3b252)

5 years agotty-ask-pw-agent: the message string might not be set
Lennart Poettering [Wed, 26 Aug 2020 21:05:46 +0000 (23:05 +0200)]
tty-ask-pw-agent: the message string might not be set

(cherry picked from commit 66bff73b4f91f8d2fdd385f9f1e2b6339055c9e4)

5 years agotty-ask-pw-agent: make sure "--list" works correctly
Lennart Poettering [Wed, 26 Aug 2020 21:02:13 +0000 (23:02 +0200)]
tty-ask-pw-agent: make sure "--list" works correctly

Fixes: #16836
(cherry picked from commit 4c4a018caba30a58c3549924b8521074bbe5adad)

5 years agoadd "list" verb to autocompleted commands
Olivier Le Moal [Thu, 27 Aug 2020 08:01:36 +0000 (10:01 +0200)]
add "list" verb to autocompleted commands

(cherry picked from commit 50574ed1ac2e27d8f25894c9db75bb0b4c28978f)

5 years agoshell-completion/zsh: add missing verbs for networkctl
Olivier Le Moal [Wed, 26 Aug 2020 14:03:35 +0000 (16:03 +0200)]
shell-completion/zsh: add missing verbs for networkctl

(cherry picked from commit 6ff45bc1a18855cb9b0c43ba13843c11dd10728f)

5 years agopath: Improve $PATH search directory case
Chris Down [Wed, 26 Aug 2020 17:49:27 +0000 (18:49 +0100)]
path: Improve $PATH search directory case

Previously:

1. last_error wouldn't be updated with errors from is_dir;
2. We'd always issue a stat(), even for binaries without execute;
3. We used stat() instead of access(), which is cheaper.

This change avoids all of those, by only checking inside X_OK-positive
case whether access() works on the path with an extra slash appended.
Thanks to Lennart for the suggestion.

(cherry picked from commit 33e1a5d8d3f792e1d98377fe439e123231032ec7)

5 years agopath: Skip directories when finalising $PATH search v246.3
Chris Down [Tue, 25 Aug 2020 20:59:11 +0000 (21:59 +0100)]
path: Skip directories when finalising $PATH search

Imagine $PATH /a:/b. There is an echo command at /b/echo. Under this
configuration, this works fine:

    % systemd-run --user --scope echo .
    Running scope as unit: run-rfe98e0574b424d63a641644af511ff30.scope
    .

However, if I do `mkdir /a/echo`, this happens:

    % systemd-run --user --scope echo .
    Running scope as unit: run-rcbe9369537ed47f282ee12ce9f692046.scope
    Failed to execute: Permission denied

We check whether the resulting file is executable for the performing
user, but of course, most directories are anyway, since that's needed to
list within it. As such, another is_dir() check is needed prior to
considering the search result final.

Another approach might be to check S_ISREG, but there may be more gnarly
edge cases there than just eliminating this obviously pathological
example, so let's just do this for now.

(cherry picked from commit 8b5cb69bc8b70d1dcc39ed2165907723099bd9d8)

5 years agorules: don't install 80-drivers.rules when kmod is disabled
Alec Moskvin [Sat, 1 Aug 2020 13:25:05 +0000 (09:25 -0400)]
rules: don't install 80-drivers.rules when kmod is disabled

(cherry picked from commit dd47b25220f69f869679089da5cc848cf9cd0c78)

5 years agozsh: correct journalctl command completion parsing
Ronan Pigott [Tue, 25 Aug 2020 02:33:37 +0000 (19:33 -0700)]
zsh: correct journalctl command completion parsing

(cherry picked from commit 45b156c1559da468f1c12aa5170858574c9b5831)

5 years agobasic/missing_syscall: fix syscall numbers for arm64 :(
Zbigniew Jędrzejewski-Szmek [Sat, 22 Aug 2020 14:55:56 +0000 (16:55 +0200)]
basic/missing_syscall: fix syscall numbers for arm64 :(

(cherry picked from commit b6ce3d2c0152a17210bb7fd31bb92a289f181a57)

5 years agoshared/install: fix preset operations for non-service instantiated units
Zbigniew Jędrzejewski-Szmek [Sat, 22 Aug 2020 09:58:15 +0000 (11:58 +0200)]
shared/install: fix preset operations for non-service instantiated units

Fixes https://github.com/coreos/ignition/issues/1064.

(cherry picked from commit 47ab95fe4315b3f7ee5a3694460a744bb88c52fd)

5 years agonss-resolve: treat BUS_ERROR_NO_SUCH_UNIT the same as SD_BUS_ERROR_SERVICE_UNKNOWN too
Zbigniew Jędrzejewski-Szmek [Sat, 22 Aug 2020 16:48:43 +0000 (18:48 +0200)]
nss-resolve: treat BUS_ERROR_NO_SUCH_UNIT the same as SD_BUS_ERROR_SERVICE_UNKNOWN too

Seems safer to do so.

(cherry picked from commit 8e34f4cc62aaeaa8881a1d6cd9136de5a22777a1)

5 years agovarious: treat BUS_ERROR_NO_SUCH_UNIT the same as SD_BUS_ERROR_SERVICE_UNKNOWN
Zbigniew Jędrzejewski-Szmek [Sat, 22 Aug 2020 16:48:03 +0000 (18:48 +0200)]
various: treat BUS_ERROR_NO_SUCH_UNIT the same as SD_BUS_ERROR_SERVICE_UNKNOWN

We return BUS_ERROR_NO_SUCH_UNIT a.k.a. org.freedesktop.systemd1.NoSuchUnit
in various places. In #16813:
Aug 22 06:14:48 core sudo[2769199]: pam_systemd_home(sudo:account): Failed to query user record: Unit dbus-org.freedesktop.home1.service not found.
Aug 22 06:14:48 core dbus-daemon[5311]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.home1.service': Unit dbus-org.freedesktop.home1.service not found.
Aug 22 06:14:48 core dbus-daemon[5311]: [system] Activating via systemd: service name='org.freedesktop.home1' unit='dbus-org.freedesktop.home1.service' requested by ':1.6564' (uid=0 pid=2769199 comm="sudo su ")

This particular error comes from bus_unit_validate_load_state() in pid1:
  case UNIT_NOT_FOUND:
       return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s not found.", u->id);

It seems possible that we should return a different error, but it doesn't really
matter: if we change pid1 to return a different error, we still need to handle
BUS_ERROR_NO_SUCH_UNIT as in this patch to handle pid1 with current code.

(cherry picked from commit 73d3ac8e2440cda3b7f2310f329f0798de6c041c)

5 years agoman: drop reference to long gone .busname unit type
Lennart Poettering [Mon, 24 Aug 2020 17:41:09 +0000 (19:41 +0200)]
man: drop reference to long gone .busname unit type

Seems we missed one occurence.

(cherry picked from commit 68dd195c1b8fdba3fccf166a1c3c2d7ca5a912fe)

5 years agoman: fix a fix of a typo in systemd.service example
Jan Chren [Mon, 24 Aug 2020 14:40:11 +0000 (16:40 +0200)]
man: fix a fix of a typo in systemd.service example

The fix from cb263973acf83de22a86f08fe502a9cbd6c01d2b was made the other way around,
i.e. `SIGKILL` was changed to `SIGUSR1`, but the sentence is about a "termination signal", i.e. `SIGKILL`, not `SIGUSR1`.

(cherry picked from commit be3f62faf5d498aaab4cf6ceb3ca56e0d994ddf5)

5 years agonetwork: can: Fix CAN initialization
Clemens Gruber [Fri, 21 Aug 2020 14:03:23 +0000 (16:03 +0200)]
network: can: Fix CAN initialization

When introducing CAN-FD support, the .can_fd_mode was not initalized
with -1 and due to cm.mask containing the CAN_CTRLMODE_FD bit, it was
not ignored when FDMode was not configured but instead disabled.
The same thing happened when listen-only mode support was introduced.

On chips that do not support these features, this lead to an error:
can0: Failed to configure CAN link: Operation not supported

Fix it by intializing all the CAN related tristate variables
(.can_listen_only, .can_fd_mode and .can_non_iso) to -1.

(cherry picked from commit f594b5feabee38dded4b7ae288fba6c3b6c79a45)

5 years agoman: update autogenerated dbus api lists
Zbigniew Jędrzejewski-Szmek [Sat, 22 Aug 2020 10:25:44 +0000 (12:25 +0200)]
man: update autogenerated dbus api lists

We forgot to do this before the release :(
Relavant commits are:
4e11ddfdd3c1f93721b8ca534e33e16ced32ff06,
0bb007f7a23c41e23481373ded47ee3ddcf8f26b,
a3d19f5d99c44940831a33df8b5bece4aaf749f7,
bf760801804e55b045aed54bf9b1d0b0131be3f2,
4793c31083031e729e6eb17b87b540a3944bba3b.

Suitable for backporting.

(cherry picked from commit 9653108f1135ad5105fbe71ccf6f818aeb7aa5f8)

5 years agoman: fix invalid tag place
Yu Watanabe [Fri, 21 Aug 2020 06:30:05 +0000 (15:30 +0900)]
man: fix invalid tag place

(cherry picked from commit d91b9bbce881c7e0d2ee80208325be59924b0e8f)

5 years agoman: add conditionals to more man pages
Zbigniew Jędrzejewski-Szmek [Thu, 20 Aug 2020 15:41:19 +0000 (17:41 +0200)]
man: add conditionals to more man pages

Fixes #16701.

(cherry picked from commit bb5a34fb3eeef824afe02b679d391853244161b1)

5 years agomeson: add ENABLE_ANALYZE conditional
Zbigniew Jędrzejewski-Szmek [Thu, 20 Aug 2020 15:35:50 +0000 (17:35 +0200)]
meson: add ENABLE_ANALYZE conditional

(cherry picked from commit b3259a6e5f05ebaf5282e624f80ecf04b77a0adb)

5 years agocore: add missing conditions/asserts to unit file parsing
Lennart Poettering [Thu, 20 Aug 2020 11:44:12 +0000 (13:44 +0200)]
core: add missing conditions/asserts to unit file parsing

(cherry picked from commit 4f55a5b0bf1e68e4595120d8ac4b518654355fc3)

5 years agoanalyze: rework condition testing
Lennart Poettering [Thu, 20 Aug 2020 11:43:00 +0000 (13:43 +0200)]
analyze: rework condition testing

Let's drop the private table and just use the generic concepts we have
in place already that make the same information available.

Fixes: #16781
(cherry picked from commit 625a164069aff9efb61dcc5916c572f53c2a7ab0)

5 years agosd-bus: fix error handling on readv()
Lennart Poettering [Thu, 20 Aug 2020 10:59:23 +0000 (12:59 +0200)]
sd-bus: fix error handling on readv()

let's make sure we collect the right error code from errno, otherwise
we'll see EPERM (i.e. error 1) for all errors readv() returns (since it
returns -1 on error), including EAGAIN.

This is definitely backport material.

A fix-up for 3691bcf3c5eebdcca5b4f1c51c745441c57a6cd1.

Fixes: #16699
(cherry picked from commit c1093c34d7d81b5b13cc72d4d1941000813001da)

5 years agouser-runtime-dir: deal gracefully with missing logind properties
Lennart Poettering [Wed, 19 Aug 2020 15:05:44 +0000 (17:05 +0200)]
user-runtime-dir: deal gracefully with missing logind properties

Fixes: #16685
(cherry picked from commit 5d1e68b49489574ef57947c5f1adfc761547eea9)

5 years agoshared/seccomp: do not use ifdef guards around textual syscall names
Zbigniew Jędrzejewski-Szmek [Tue, 18 Aug 2020 14:10:47 +0000 (16:10 +0200)]
shared/seccomp: do not use ifdef guards around textual syscall names

It is possible that we will be running with an upgraded libseccomp, in which
case libseccomp might know the syscall name, even if the number is not known at
the time when systemd is being compiled. The guard only serves to break such
upgrades, by requiring that we also recompile systemd.

For s390-specific syscalls, use a define to exclude them, so that that we don't
try to filter them on other arches.

(cherry picked from commit 6da432fd542af5553742b905a0f87a825a28a399)

5 years agomachine-id-setup: don't use KVM or container manager supplied uuid if in chroot env
Lennart Poettering [Wed, 19 Aug 2020 15:07:41 +0000 (17:07 +0200)]
machine-id-setup: don't use KVM or container manager supplied uuid if in chroot env

Fixes: #16758
(cherry picked from commit 1f894e682cb34d8d713378d01dc0565b7b5a245f)

5 years agoman: Fix typo in systemd-tmpfiles
Phaedrus Leeds [Wed, 19 Aug 2020 16:36:32 +0000 (09:36 -0700)]
man: Fix typo in systemd-tmpfiles

(cherry picked from commit c2892a244c82ee142089f8fb7848547dada4ed32)

5 years agohomework: downgrade chattr failure log message
Lennart Poettering [Mon, 17 Aug 2020 20:07:55 +0000 (22:07 +0200)]
homework: downgrade chattr failure log message

NOCOW is a btrfs-only thing hence don't log louder than necessary if we
don't have it.

(cherry picked from commit 64dc138d1ebbe11eda7872522263a35237916183)

5 years agohomework: explicitly close cryptsetup context, to not keep loopback device busy
Lennart Poettering [Mon, 17 Aug 2020 20:09:04 +0000 (22:09 +0200)]
homework: explicitly close cryptsetup context, to not keep loopback device busy

The cryptsetup context pins the loop device even after deactivation.
Let's explicitly release the context to make sure the subsequent
loopback device detaching works cleanly.

(cherry picked from commit df14bda2b5de8ea022a915774c5a4e4660e421b6)

5 years agohomework: correct error passed into log message
Lennart Poettering [Mon, 17 Aug 2020 18:20:47 +0000 (20:20 +0200)]
homework: correct error passed into log message

(cherry picked from commit 6d7b47eb3eb71b37c768e588173f2c8169e953e7)

5 years agohomework: sync everything to disk before we rename LUKS loopback file into place
Lennart Poettering [Mon, 17 Aug 2020 17:54:38 +0000 (19:54 +0200)]
homework: sync everything to disk before we rename LUKS loopback file into place

This how this works on Linux: when atomically creating a file we need to
fully populate it under a temporary name and then when we are fully
done, sync it and the directory it is contained in, before renaming it
to the final name.

(cherry picked from commit a2a8a509cd56955c0ce42ba0650d163e0d3eeb82)

5 years agohomed: downgrade quota message in containers
Lennart Poettering [Mon, 17 Aug 2020 16:19:30 +0000 (18:19 +0200)]
homed: downgrade quota message in containers

quota syscalls and operations are typically prohibited in containers.
Let's not make noise about that, needlessly.

(cherry picked from commit 5e5e11b8744fbe9dcd87a2d165f342dc9bcd4008)

5 years agoanalyze-security: do not assign badness to filtered-out syscalls
Zbigniew Jędrzejewski-Szmek [Sat, 1 Aug 2020 09:28:09 +0000 (11:28 +0200)]
analyze-security: do not assign badness to filtered-out syscalls

Fixes #16451, https://bugzilla.redhat.com/show_bug.cgi?id=1856273.

(cherry picked from commit 01ecb3674ad3650bcbb14155b2dcbd4b9f4ed57e)

5 years agoNEWS: clarify two points
Zbigniew Jędrzejewski-Szmek [Fri, 31 Jul 2020 13:36:07 +0000 (15:36 +0200)]
NEWS: clarify two points

I was reading a summary of changes on Phoronix, and (while not incorrect)
those two points were rather misleading.

(cherry picked from commit c2cfb12641eb6d47c66ae14d916f0df86de5d8f8)

5 years agomeson: add min version for libfdisk
Anita Zhang [Tue, 18 Aug 2020 06:09:38 +0000 (23:09 -0700)]
meson: add min version for libfdisk

Was trying to run src/partition/test-repart.sh on CentOS 8 and the first
resize call kept failing with ERANGE. Turned out that CentOS 8 comes
with libfdisk-devel-2.32.1 which is missing
https://github.com/karelzak/util-linux/commit/2f35c1ead621f42f32f7777232568cb03185b473
(in libfdisk 2.33 and up).

(cherry picked from commit e71f5585b9b0580428f9530d0a485265c9c25165)

5 years agoload-fragment: fix grammar in error messages
Alyssa Ross [Tue, 18 Aug 2020 20:56:59 +0000 (20:56 +0000)]
load-fragment: fix grammar in error messages

(cherry picked from commit 556a7bbed607ec8cbbf4affc5d862ef92403418e)

5 years agoFix function description in logind man page
Nicolas Fella [Tue, 18 Aug 2020 20:36:47 +0000 (22:36 +0200)]
Fix function description in logind man page

Fix a presumed copy&paste error. SetLockedHint corresponds to the "locked hint", not the "idle hint".

(cherry picked from commit 07b4f4496868578e56932a292de0f0b1881ecc84)

5 years agonetwork: do not fail if UseMTU=yes on DHCP lease lost
Yu Watanabe [Tue, 18 Aug 2020 10:21:25 +0000 (19:21 +0900)]
network: do not fail if UseMTU=yes on DHCP lease lost

This fixes a bug introduced by 6906794dd1698954b349ec3ec84f1494ecd63cd3.

Fixes #16768.

(cherry picked from commit 46b875fb803ce8ee9bcb6a23ad6339db4f735d3a)

5 years agomissing_syscall: do not use function name that may conflict with glibc
Zbigniew Jędrzejewski-Szmek [Sun, 16 Aug 2020 14:19:29 +0000 (16:19 +0200)]
missing_syscall: do not use function name that may conflict with glibc

This was done for all replacements back in 5187dd2c403caf92d09f3491e41f1ceb3f10491f,
but some newer stuff didn't do this.

(cherry picked from commit faeae444ea452139519718ceb681e8b5831b6890)

5 years agomissing_syscall: fix pidfd_{send_signal,open} numbers for alpha
Zbigniew Jędrzejewski-Szmek [Sat, 15 Aug 2020 17:01:23 +0000 (19:01 +0200)]
missing_syscall: fix pidfd_{send_signal,open} numbers for alpha

Also order the syscalls by syscall number for easier comparisons with the
kernel headers.

Fixup for 5f152f43d04e5aad6a3f98f45f020a66e3aac717.

(cherry picked from commit 23654cee136862996d92e7f1e9887786ddb3dfe6)

5 years agonetwork: wait for previous address removal before configuring static addresses
Yu Watanabe [Sat, 8 Aug 2020 03:36:18 +0000 (12:36 +0900)]
network: wait for previous address removal before configuring static addresses

Fixes #16696.

(cherry picked from commit 9b966cee435fecfdee79f3e0aff0dec0a4e68f14)

5 years agonetwork: only process non-error message
Yu Watanabe [Sat, 8 Aug 2020 03:31:12 +0000 (12:31 +0900)]
network: only process non-error message

(cherry picked from commit fb282d4e256a79b19d3299999024e8fafd2ab0a0)

5 years agotest: accept that char device 0/0 can now be created witout privileges
Lennart Poettering [Fri, 14 Aug 2020 19:50:55 +0000 (21:50 +0200)]
test: accept that char device 0/0 can now be created witout privileges

Fixes: #16721
(cherry picked from commit 5b5ce6298e5a1c09beacd5c963e2350979cbf94a)

5 years agotools/make-man-index: fix purpose text that contains tags v246.2
Haochen Tong [Sun, 16 Aug 2020 01:28:46 +0000 (03:28 +0200)]
tools/make-man-index: fix purpose text that contains tags

(cherry picked from commit f3317336450e1145b97ae9e38bd626f3d4c88eb8)

5 years agotest-fs-util: skip encrypted path test if we get EACCES
Topi Miettinen [Mon, 17 Aug 2020 09:08:57 +0000 (12:08 +0300)]
test-fs-util: skip encrypted path test if we get EACCES

Unprivileged test-fs-util fails on my system since /sys/dev/block is
inaccessible for unprivileged users, so let's skip encrypted path test if we
get EACCES or similar.

(cherry picked from commit 209650b7200115d2cad9081cb97e22608fce41f8)

5 years agoNewer Glibc use faccessat2 to implement faccessat
Michael Scherer [Sat, 15 Aug 2020 16:12:02 +0000 (18:12 +0200)]
Newer Glibc use faccessat2 to implement faccessat

cf https://repo.or.cz/glibc.git/commit/3d3ab573a5f3071992cbc4f57d50d1d29d55bde2

This cause breakage on Fedora Rawhide: https://bugzilla.redhat.com/show_bug.cgi?id=1869030

(cherry picked from commit bcf08acbffdee0d6360d3c31d268e73d0623e5dc)

5 years agonamespace: fix minor memory leak
Lennart Poettering [Fri, 14 Aug 2020 09:07:18 +0000 (11:07 +0200)]
namespace: fix minor memory leak

(cherry picked from commit 3f181262f4aa746177ea311827c268652bdb1c33)

5 years agoman: fix incorrectly placed full stop
Lennart Poettering [Tue, 11 Aug 2020 12:50:32 +0000 (14:50 +0200)]
man: fix incorrectly placed full stop

(cherry picked from commit 6b49257f6b92c1bcdf02ca0e896009da36ed9bb0)

5 years agoman: fix typo
Zbigniew Jędrzejewski-Szmek [Wed, 5 Aug 2020 17:44:53 +0000 (19:44 +0200)]
man: fix typo

(cherry picked from commit d08a529518c37734e4e77540844373249589fb78)

5 years agobless-boot: add missing verb to --help
Zbigniew Jędrzejewski-Szmek [Wed, 5 Aug 2020 10:16:03 +0000 (12:16 +0200)]
bless-boot: add missing verb to --help

There is also "help" verb which duplicates the --help option. I don't
think we should advertise it.

(cherry picked from commit ddd8e23dc9d6ab33b3b3c243369042a325ba618d)

5 years agouser-record: deal with invalid GECOS fields gracefully
Lennart Poettering [Thu, 6 Aug 2020 15:00:07 +0000 (17:00 +0200)]
user-record: deal with invalid GECOS fields gracefully

Let's fix up invalid GECOS fields both when we convert from NSS to JSON
and the other way round.

Kinda sucks we have to do that, but NSS does it when writing data to
/etc/passwd, so let's do the same.

Fixes: #16668
(cherry picked from commit 5cd12abaa0c0f3a06c9ff2048941fbe6e8b3577e)

5 years agouser-util: add mangle_gecos() call for turning strings into fields suitable as GECOS...
Lennart Poettering [Thu, 6 Aug 2020 14:46:18 +0000 (16:46 +0200)]
user-util: add mangle_gecos() call for turning strings into fields suitable as GECOS fields

(cherry picked from commit b10fd796f56e4f16f7430cd22f59f544766d3bef)

5 years agofix typo in systemctl help v246.1
Matt Fenwick [Fri, 7 Aug 2020 14:43:11 +0000 (10:43 -0400)]
fix typo in systemctl help

(cherry picked from commit c1c28fe2f70573270b0544670dba38b3a2f06c13)

5 years agoman: clarify that LogNamespace= is for system services only
Lennart Poettering [Thu, 6 Aug 2020 13:27:00 +0000 (15:27 +0200)]
man: clarify that LogNamespace= is for system services only

Fixes: #16638
(cherry picked from commit a6991726f80c299ac7275f4570e310e1dd5bce96)

5 years ago_sd-common.h: avoid parsing errors with Coverity
Kamil Dudka [Wed, 5 Aug 2020 21:53:40 +0000 (23:53 +0200)]
_sd-common.h: avoid parsing errors with Coverity

The commit 1070d271fa8fa553d57dd5f74dd1e3f60732d0b9 which was supposed
too fix this does not seem to take effect any more.  We get again 34%
compilation success rate while scanning systemd itself.  Moreover, the
installed header file breaks compilation of programs that include it:

"/usr/include/systemd/_sd-common.h", line 23: error #35: #error directive: "Do
          not include _sd-common.h directly; it is a private header."
  #  error "Do not include _sd-common.h directly; it is a private header."
     ^

(cherry picked from commit 4191b3282afbca9f1ef333f91bb6566c374da1fe)

5 years agoanalyze: fix 'cat-config systemd/zram-generator.conf'
Zbigniew Jędrzejewski-Szmek [Sat, 1 Aug 2020 10:25:56 +0000 (12:25 +0200)]
analyze: fix 'cat-config systemd/zram-generator.conf'

Also makes this work for various systemd config files that support .d.

(cherry picked from commit 28365e88d0dfc6332b26120e23b2c39b7958f907)

5 years agoman: describe that changing Storage= does not move existing data
Zbigniew Jędrzejewski-Szmek [Mon, 3 Aug 2020 11:22:01 +0000 (13:22 +0200)]
man: describe that changing Storage= does not move existing data

Fixes #16384.

(cherry picked from commit f254abcd72b6ca6c4567c245a7dbaf739d02dfc2)

5 years agocore: reset bus error before reuse
Zbigniew Jędrzejewski-Szmek [Mon, 3 Aug 2020 09:39:25 +0000 (11:39 +0200)]
core: reset bus error before reuse

From a report in https://bugzilla.redhat.com/show_bug.cgi?id=1861463:
usb-gadget.target: Failed to load configuration: No such file or directory
usb-gadget.target: Failed to load configuration: No such file or directory
usb-gadget.target: Trying to enqueue job usb-gadget.target/start/fail
usb-gadget.target: Failed to load configuration: No such file or directory
Assertion '!bus_error_is_dirty(e)' failed at src/libsystemd/sd-bus/bus-error.c:239, function bus_error_setfv(). Ignoring.
sys-devices-platform-soc-2100000.bus-2184000.usb-ci_hdrc.0-udc-ci_hdrc.0.device: Failed to enqueue SYSTEMD_WANTS= job, ignoring: Unit usb-gadget.target not found.

I *think* this is the place where the reuse occurs: we call
bus_unit_validate_load_state(unit, e) twice in a row.

(cherry picked from commit 94efaa31812f664f0ad659f474db3da0f9c9bacd)

5 years agonspawn: Fix incorrect usage of putenv
Daan De Meyer [Sat, 1 Aug 2020 14:05:01 +0000 (15:05 +0100)]
nspawn: Fix incorrect usage of putenv

strv_env_get only returns the environment variable value. putenv expects
KEY=VALUE format strings. Use setenv instead to fix the use.

(cherry picked from commit 6f646e01755df587bb33dae4ca78cdaad5721f5e)

5 years agoman: fix typo in systemd.service
Etienne Doms [Sat, 1 Aug 2020 10:47:17 +0000 (12:47 +0200)]
man: fix typo in systemd.service

5 years agonetwork: fix DHCPv6 Prefix Delegation example after option rename
Florian Klink [Fri, 31 Jul 2020 09:35:15 +0000 (11:35 +0200)]
network: fix DHCPv6 Prefix Delegation example after option rename

99e015e28c8322bf714f45cd1defcf20ac2103c5 missed to update the example
below - DHCPv6.AssignAcquiredDelegatedPrefixAddress was moved to
DHCPv6PrefixDelegation.Assign.

As it already defaulted to true since it's introduction in
9efa8a3cff9948d3a78597b74dca75c805716de4, there's no need to explicitly
list it at all.

5 years agoNEWS: last rites v246
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 18:57:50 +0000 (20:57 +0200)]
NEWS: last rites

5 years agoloop-device: implicitly sync device on detach
Lennart Poettering [Thu, 30 Jul 2020 16:42:13 +0000 (18:42 +0200)]
loop-device: implicitly sync device on detach

Apparently, if IO is still in flight at the moment we invoke LOOP_CLR_FD
it is likely simply dropped (probably because yanking physical storage,
such as a USB stick would drop it too). Let's protect ourselves against
that and always sync explicitly before we invoke it.

5 years agoMerge pull request #16624 from keszybz/timesync-retry-interval
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 18:47:41 +0000 (20:47 +0200)]
Merge pull request #16624 from keszybz/timesync-retry-interval

Make timesyncd retry interval grow more slowly

5 years agoudev: fix codesonar warnings
Amitanand.Chikorde [Thu, 30 Jul 2020 13:18:48 +0000 (18:48 +0530)]
udev: fix codesonar warnings

Fixed below systemd codesonar warning.
isprint() is invoked here with an argument of signed
type char, but only has defined behavior for int arguments that are
either representable as unsigned char or equal to the value
of macro EOF(-1).

As per codesonar report, in a number of libc implementations, isprint()
function implemented using lookup tables (arrays): passing in a
negative value can result in a read underrun.

5 years agopid1: stop limiting size of /dev/shm
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 11:36:10 +0000 (13:36 +0200)]
pid1: stop limiting size of /dev/shm

The explicit limit is dropped, which means that we return to the kernel default
of 50% of RAM. See 362a55fc14 for a discussion why that is not as much as it
seems. It turns out various applications need more space in /dev/shm and we
would break them by imposing a low limit.

While at it, rename the define and use a single macro for various tmpfs mounts.
We don't really care what the purpose of the given tmpfs is, so it seems
reasonable to use a single macro.

This effectively reverts part of 7d85383edbab7. Fixes #16617.

5 years agopath-util: make use of TAKE_PTR() where we can
Lennart Poettering [Wed, 29 Jul 2020 17:09:48 +0000 (19:09 +0200)]
path-util: make use of TAKE_PTR() where we can

5 years agohwdb: Add EliteBook to use micmute hotkey
Kai-Heng Feng [Tue, 16 Jun 2020 05:24:27 +0000 (13:24 +0800)]
hwdb: Add EliteBook to use micmute hotkey

Like HP ZBooks, all EliteBooks use the same micmute scancode.

5 years agorepart: log fixes
Lennart Poettering [Wed, 29 Jul 2020 17:20:39 +0000 (19:20 +0200)]
repart: log fixes

5 years agotimesync: increase retry interval more slowly
Zbigniew Jędrzejewski-Szmek [Thu, 30 Jul 2020 13:15:11 +0000 (15:15 +0200)]
timesync: increase retry interval more slowly

The new retry intervals are [15, 20, 26, 34, 45, 60, 80, 106, 141, 188, 250,
333, 360, ...]. This should allow graceful response if a transient network
failure is encountered. Growth is exponential, but with a small power and
capped to a non-too-large value so that we resynchronize within a few minutes
after network is restored. I made the minimum 15 s to make sure that we never
send packets more often than that.

Fixes #16492.

5 years agoadded alternative version of SurfTab Twin
Benjamin Dahlhoff [Wed, 29 Jul 2020 18:02:55 +0000 (20:02 +0200)]
added alternative version of SurfTab Twin

5 years agonetwork: fix use of uninitialized value
Yu Watanabe [Thu, 30 Jul 2020 03:45:36 +0000 (12:45 +0900)]
network: fix use of uninitialized value

Follow-up for 6e537f62d71edea5bfcd2e2675c35ee840ffdc1f.

5 years agonetwork: Fix "Unknown section 'DHCPv6PrefixDelegation'." message
Michael Marley [Wed, 29 Jul 2020 19:13:35 +0000 (15:13 -0400)]
network: Fix "Unknown section 'DHCPv6PrefixDelegation'." message

Follow-up for https://github.com/systemd/systemd/commit/99e015e28c8322bf714f45cd1defcf20ac2103c5

5 years agoNEWS: mention about [DHCPv6PrefixDelegation] section
Yu Watanabe [Wed, 29 Jul 2020 16:02:52 +0000 (01:02 +0900)]
NEWS: mention about [DHCPv6PrefixDelegation] section

Follow-up for 99e015e28c8322bf714f45cd1defcf20ac2103c5.