systemd/.git
5 years agonetwork: use "FooOverUDP" as one word v245.5
Zbigniew Jędrzejewski-Szmek [Thu, 16 Apr 2020 15:23:41 +0000 (17:23 +0200)]
network: use "FooOverUDP" as one word

The whole thing is one name, and I think it's confusing to break it
up into separate words.

(cherry picked from commit fac216635916eee9aa2b08b978bf60d97ac95179)

5 years agonetwork: fix static assertion on IPPROTO_MAX range
Zbigniew Jędrzejewski-Szmek [Thu, 16 Apr 2020 14:49:30 +0000 (16:49 +0200)]
network: fix static assertion on IPPROTO_MAX range

Builds with recent glibc would fail with:
../src/network/netdev/fou-tunnel.c: In function ‘config_parse_ip_protocol’:
../src/basic/macro.h:380:9: error: static assertion failed: "IPPROTO_MAX-1 <= UINT8_MAX"
  380 |         static_assert(expr, #expr)
      |         ^~~~~~~~~~~~~
../src/network/netdev/fou-tunnel.c:161:9: note: in expansion of macro ‘assert_cc’
  161 |         assert_cc(IPPROTO_MAX-1 <= UINT8_MAX);
      |         ^~~~~~~~~

This is because f9ac84f92f151e07586c55e14ed628d493a5929d (present in
glibc-2.31.9000-9.fc33.x86_64) added IPPROTO_MPTCP=262, following
v5.5-rc5-1002-gfaf391c382 in the kernel.

(cherry picked from commit 3d58d7328a6ecbc61d3494803d705edd8a108d72)

5 years agoresolved: tone down comment in /run/systemd/{stub-,}resolve.conf
Lennart Poettering [Thu, 16 Apr 2020 13:06:58 +0000 (15:06 +0200)]
resolved: tone down comment in /run/systemd/{stub-,}resolve.conf

There are legitimate reasons to access the file directly, as currently
discussed on fedora-devel. Hence tone things down from "must" to "should
typically not".

Also, let's use fputs() instead of fputs_unlocked() here,
fopen_temporary_label() turns off stdio locking anyway for the whole
FILE*, hence no need to do this manually each time.

(cherry picked from commit ce416f425c509bac429b8c9971f5f4edf726a54f)

5 years agologind: skip polkit query with --no-wall
Zbigniew Jędrzejewski-Szmek [Thu, 16 Apr 2020 11:46:37 +0000 (13:46 +0200)]
logind: skip polkit query with --no-wall

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1800875.

(cherry picked from commit 5644d47b7c288c4126aab60d2d6a65923f7df4cc)

5 years agoverify: ignore nonexistent executables if required
Giedrius Statkevičius [Tue, 7 Apr 2020 21:38:16 +0000 (00:38 +0300)]
verify: ignore nonexistent executables if required

We provide a way via the '-' symbol to ignore errors when nonexistent
executable files are passed to Exec* parameters & so on. In such a case,
the flag `EXEC_COMMAND_IGNORE_FAILURE` is set and we go on happily with
our life if that happens. However, `systemd-analyze verify` complained
about missing executables even in such a case. In such a case it is not
an error for this to happen so check if the flag is set before checking
if the file is accessible and executable.

Add some small tests to check this condition.

Closes #15218.

(cherry picked from commit c90c597ee3b6b9d30ee86410e46939ba875e467a)

5 years agohwdb: optimize isatty()-per-line away
Lennart Poettering [Mon, 13 Apr 2020 09:26:15 +0000 (11:26 +0200)]
hwdb: optimize isatty()-per-line away

Fixes: #15407
(cherry picked from commit 648ba0ee8178105777502cfcd869d7c04511db96)

5 years agofileio: extend comment a bit
Lennart Poettering [Mon, 13 Apr 2020 09:25:43 +0000 (11:25 +0200)]
fileio: extend comment a bit

(cherry picked from commit 451fcbfc58d3ccb9855095666aa9ba4ae1327224)

5 years agofileio: optionally allow telling read_line_full() whether we are processing a tty...
Lennart Poettering [Mon, 13 Apr 2020 09:20:59 +0000 (11:20 +0200)]
fileio: optionally allow telling read_line_full() whether we are processing a tty or not

(cherry picked from commit 609ae0f59619619efe6db07e34f73a237e7f332b)

5 years agofileio: fileno() can realistically return -1
Lennart Poettering [Mon, 13 Apr 2020 08:09:44 +0000 (10:09 +0200)]
fileio: fileno() can realistically return -1

An stdio FILE* stream usually refers to something with a file
descriptor, but that's just "usually". It doesn't have to, when taking
fmemopen() and similar into account. Most of our calls to fileno()
assumed the call couldn't fail. In most cases this was correct, but in
some cases where we didn't know whether we work on files or memory we'd
use the returned fd as if it was unconditionally valid while it wasn't,
and passed it to a multitude of kernel syscalls. Let's fix that, and do
something reasonably smart when encountering this case.

(Running test-fileio with this patch applied will remove tons of ioctl()
calls on -1).

(cherry picked from commit 14f594b995bbaea85456a4c26e5c07446a4c446e)

5 years agocoredumpctl: support --file=PATH
Frantisek Sumsal [Sun, 12 Apr 2020 18:39:09 +0000 (20:39 +0200)]
coredumpctl: support --file=PATH

Let's match journalctl's functionality by throwing --file for
coredumpctl into the mix, so we can work on a single journal file
as well.

(cherry picked from commit aeb56450820f824785d1d2718064598293e3bd6c)

5 years agoFix pam_systemd_home's debug parameter to match man page description
Joel Shapiro [Sun, 12 Apr 2020 05:40:17 +0000 (00:40 -0500)]
Fix pam_systemd_home's debug parameter to match man page description

(cherry picked from commit 332f38d084c68c3d524c086f4d7843a2fd048ba8)

5 years agocore: make sure ProtectHostname= is handled gracefully in containers lacking seccomp
Lennart Poettering [Mon, 13 Apr 2020 09:38:34 +0000 (11:38 +0200)]
core: make sure ProtectHostname= is handled gracefully in containers lacking seccomp

Fixes: #15408
(cherry picked from commit daf8f72b4eba3702a5bdf109c82dc71d1483f1c6)

5 years agotest: wait a bit after stopping the test service
Frantisek Sumsal [Wed, 8 Apr 2020 10:12:46 +0000 (12:12 +0200)]
test: wait a bit after stopping the test service

Give systemd a chance to process the stop event before checking if the
PID has indeed leaked. This should fix the intermittent test fails in CI
even with a fixed systemd version, like this one:

```
Apr 08 10:22:09 testsuite-47.sh[345]: ++ cat /leakedtestpid
Apr 08 10:22:09 testsuite-47.sh[334]: + leaked_pid=342
Apr 08 10:22:09 testsuite-47.sh[334]: + systemctl stop testsuite-47-repro
Apr 08 10:22:10 testsuite-47.sh[334]: + ps -p 342
Apr 08 10:22:10 testsuite-47.sh[348]:     PID TTY          TIME CMD
Apr 08 10:22:10 testsuite-47.sh[348]:     342 ?        00:00:00 sleep
Apr 08 10:22:10 testsuite-47.sh[334]: + exit 42
```

Followup to 197298ff9fc930de450330095cc5b67d165d0801

(cherry picked from commit e00e2e0b50bbd120290572c8d1242703fb98b34e)

5 years agocatalog: add entry for SD_MESSAGE_UNSAFE_USER_NAME
Lennart Poettering [Tue, 7 Apr 2020 09:15:49 +0000 (11:15 +0200)]
catalog: add entry for SD_MESSAGE_UNSAFE_USER_NAME

(cherry picked from commit ad313ec33bb367624c25c9264994d6e43b8a7e2e)

5 years agodocs: hook up the new USER_NAMES document everywhere
Lennart Poettering [Tue, 7 Apr 2020 09:04:59 +0000 (11:04 +0200)]
docs: hook up the new USER_NAMES document everywhere

(Also correct the set of names we accept in User=, which was forgotten
to be updated in ae480f0b09aec815b64579bb1828ea935d8ee236.

(cherry picked from commit 887a8fa341d9b24a7c9cd3f1fce328f8e43a1b4f)

5 years agouser-util: rework how we validate user names
Lennart Poettering [Sat, 4 Apr 2020 10:23:02 +0000 (12:23 +0200)]
user-util: rework how we validate user names

This reworks the user validation infrastructure. There are now two
modes. In regular mode we are strict and test against a strict set of
valid chars. And in "relaxed" mode we just filter out some really
obvious, dangerous stuff. i.e. strict is whitelisting what is OK, but
"relaxed" is blacklisting what is really not OK.

The idea is that we use strict mode whenver we allocate a new user
(i.e. in sysusers.d or homed), while "relaxed" mode is when we process
users registered elsewhere, (i.e. userdb, logind, …)

The requirements on user name validity vary wildly. SSSD thinks its fine
to embedd "@" for example, while the suggested NAME_REGEX field on
Debian does not even allow uppercase chars…

This effectively liberaralizes a lot what we expect from usernames.

The code that warns about questionnable user names is now optional and
only used at places such as unit file parsing, so that it doesn't show
up on every userdb query, but only when processing configuration files
that know better.

Fixes: #15149 #15090
(cherry picked from commit 7a8867abfab10e5bbca10590ec2aa40c5b27d8fb)

5 years agouserdbctl: drop redundant user name validity check
Lennart Poettering [Fri, 3 Apr 2020 20:27:09 +0000 (22:27 +0200)]
userdbctl: drop redundant user name validity check

The userdb_by_name() invocation immediately following does the same check
anyway, no need to do this twice.

(Also, make sure we exit the function early on failure)

(cherry picked from commit 2aea5883f1d016ec7304acdb59516c30cae92452)

5 years agoman: explicitly note that ExecSt*Post does count for After/Before ordering
Luca Boccassi [Wed, 8 Apr 2020 14:39:20 +0000 (15:39 +0100)]
man: explicitly note that ExecSt*Post does count for After/Before ordering

(cherry picked from commit fe78538cab13fd8b6180dfdfab87d86bfdd1ac58)

5 years agosleep: improve log msg slightly
Lennart Poettering [Wed, 8 Apr 2020 17:54:44 +0000 (19:54 +0200)]
sleep: improve log msg slightly

Let's make the log msgs a bit longer, to make clearer what is going on
here...

Prompted bymy attempts to debug #15354

(cherry picked from commit 0ed4b54e05e8436685cab79177c64a5fe8a2d15c)

5 years agoman: correct the default slice for systemd-run units
Lennart Poettering [Wed, 8 Apr 2020 16:45:31 +0000 (18:45 +0200)]
man: correct the default slice for systemd-run units

As suggested in #15362

(cherry picked from commit ba45534917d5ac56bf621ab6e6f4ccb11d0eb269)

5 years agohwdb: Update database of Bluetooth company identifiers
Marcel Holtmann [Sun, 5 Apr 2020 08:01:14 +0000 (10:01 +0200)]
hwdb: Update database of Bluetooth company identifiers

(cherry picked from commit 9fac14980df8dcce922e1fe8856a88b09590d2c3)

5 years agodetect-virt: also detect "microsoft" as WSL
Zbigniew Jędrzejewski-Szmek [Fri, 3 Apr 2020 17:38:50 +0000 (19:38 +0200)]
detect-virt: also detect "microsoft" as WSL

From https://github.com/microsoft/WSL/issues/423#issuecomment-221627364:
> it's unlikely we'll change it to something that doesn't contain "Microsoft"
> or "WSL".

... but well, it happened. If they change it incompatibly w/o adding an stable
detection mechanism, I think we should not add yet another detection method.
But adding a different casing of "microsoft" is not a very big step, so let's
do that.

Follow-up for #11932.

(cherry picked from commit a2f838d59075a49b012f9b7056664f7ffeed44d2)

5 years agodbus-execute: show also ProtectClock
Topi Miettinen [Fri, 3 Apr 2020 13:32:10 +0000 (16:32 +0300)]
dbus-execute: show also ProtectClock

Show also `ProtectClock=` setting. This also lets `systemd-analyze security`
get the correct state for it.

(cherry picked from commit b8b7b838fd6e1ab36962a592838a59de30c32b98)

5 years agoman: add note that --no-hostname has limited effect
Zbigniew Jędrzejewski-Szmek [Tue, 31 Mar 2020 20:26:59 +0000 (22:26 +0200)]
man: add note that --no-hostname has limited effect

Clearly there is some confusion about the intent of this option, let's add
a short note.

https://bugzilla.redhat.com/show_bug.cgi?id=1819313
(cherry picked from commit e6a4e25a829470c055a1195a8e97834408138c32)

5 years agojournal-remote: fix description of option
Zbigniew Jędrzejewski-Szmek [Mon, 30 Mar 2020 20:02:13 +0000 (22:02 +0200)]
journal-remote: fix description of option

We use whatever compression is configured, most often not XZ.

(cherry picked from commit 82b2281dd54b2b83c53ccbaf73b6ca9b687e0b94)

5 years agocapability: don't skip ambient caps setup if we actually have something to set
Lennart Poettering [Thu, 2 Apr 2020 15:20:47 +0000 (17:20 +0200)]
capability: don't skip ambient caps setup if we actually have something to set

Follow-up for 7ea4392f1e444388caa706d6bd64fb7b30dc2903

Let's not hide errors needlessly aggressively.

(cherry picked from commit c4b23712634d020184393ba83451bd200a1e785f)

5 years agoshared/dissect-image: log messages from cryptsetup
Topi Miettinen [Thu, 2 Apr 2020 13:57:26 +0000 (16:57 +0300)]
shared/dissect-image: log messages from cryptsetup

Before:
```
write(2, "Device /dev/loop1p1 is too small.\n", 34) = -1 ENOTCONN (Transport
endpoint is not connected)
```

After:
```
$ journalctl -b -e | grep 'too small'
Apr 02 16:53:30 loora systemd[343579]: Device /dev/loop1p1 is too small.
```

(cherry picked from commit 1887032f71b00e51d04bb5ae1860d581da786154)

5 years agoresolve: reload /etc/hosts on inode change
Giedrius Statkevičius [Sun, 22 Mar 2020 20:40:18 +0000 (22:40 +0200)]
resolve: reload /etc/hosts on inode change

On certain distributions such as NixOS the mtime of `/etc/hosts` is
locked to a fixed value. In such cases, only checking the last mtime of
`/etc/hosts` is not enough - we also need to check if the st_ino/st_dev
match up. Thus, let's make sure make sure that systemd-resolved also
rereads `/etc/hosts` if the inode or the device containing `/etc/hosts` changes.

Test script:

```bash
hosts="/etc/hosts"
echo "127.0.0.1 testpr" > "hosts_new"
mv "hosts_new" "$hosts"
resolvectl query testpr || exit 1
mtime="$(stat -c %y "$hosts")"
echo "127.0.0.1 newhost" > "hosts_tmp"
touch -d "$mtime" "hosts_tmp"
install -p "hosts_tmp" "$hosts"
sleep 10
resolvectl query newhost || exit 1
rm -f "hosts_tmp"
```

Closes #14456.

(cherry picked from commit aa5408e2e8a66b71f38531f1dcb91252c586a23c)

5 years agostring-util: make sure we eat even half complete words in split()
Lennart Poettering [Thu, 2 Apr 2020 14:36:33 +0000 (16:36 +0200)]
string-util: make sure we eat even half complete words in split()

split() and FOREACH_WORD really should die, and everything be moved to
extract_first_word() and friends, but let's at least make sure that for
the remaining code using it we can't deadlock by not progressing in the
word iteration.

Fixes: #15305
(cherry picked from commit 29965a2a6e22c9f369e70cffd9ff780d1c1d31a1)

5 years agoudev: Fix SIGSEGV in AlternativeNamesPolicy handling
Lénaïc Huard [Wed, 1 Apr 2020 21:45:08 +0000 (23:45 +0200)]
udev: Fix SIGSEGV in AlternativeNamesPolicy handling

The function sd_device_get_property_value has some paths where it exits without
touching the n pointer. In those cases, n remained uninitialized until it was
eventually read inside isempty where it caused the segmentation fault.

Fixes #15078

(cherry picked from commit 61fd7d6720c562c88ab79062ff8d131e5e3c7b1b)

5 years agoman: mention that stdout logging works the same as stderr logging v245.4
Lennart Poettering [Tue, 31 Mar 2020 13:59:29 +0000 (15:59 +0200)]
man: mention that stdout logging works the same as stderr logging

Apparently people wondered about that:

https://lists.freedesktop.org/archives/systemd-devel/2020-March/044091.html
(cherry picked from commit 9e76a88fafcba7d5bd7736013b6cb2eb291a006f)

5 years agouserwork: fix signal worker sends to manager requesting more workers
Lennart Poettering [Mon, 30 Mar 2020 13:42:02 +0000 (15:42 +0200)]
userwork: fix signal worker sends to manager requesting more workers

That's what you get for changing these signals around, after checking
everything works, not before.

Bad, Lennart, bad!

Fixes: #15085
(cherry picked from commit e3028514aeb7feee67b4c4747a3af52d09a3e9fd)

5 years agounits: do not pull in home.mount from systemd-homed.service
Lennart Poettering [Tue, 31 Mar 2020 09:35:08 +0000 (11:35 +0200)]
units: do not pull in home.mount from systemd-homed.service

/home is posibly a remote file system. it makes sense to order homed
after it, so that we can properly enumerate users in it, but we probably
shouldn't pull it in ourselves, and leave that to users to configure
otherwise.

Fixes: #15102
(cherry picked from commit 286fe8ee2132b058c98051cd106c468b011f0418)

5 years agohome: fix several typos
Vito Caputo [Tue, 31 Mar 2020 10:50:13 +0000 (03:50 -0700)]
home: fix several typos

(cherry picked from commit 80ace4f25e08989c84302fdd8d38f000ded2eaee)

5 years agohomectl: fix a typo
Piero La Terza [Mon, 30 Mar 2020 19:21:21 +0000 (21:21 +0200)]
homectl: fix a typo

stroage -> storage

(cherry picked from commit 36e4a8f22a766345e433a74cfa3feeed1063e91a)

5 years agoimport: Only keep RO copy if ETag header is set
Kevin Kuehler [Sun, 15 Mar 2020 20:46:27 +0000 (13:46 -0700)]
import: Only keep RO copy if ETag header is set

We fix the case when the webserver servers container images without
setting the ETag header in the response.  When an image is downloaded to
image root, a read only copy is stored alongside it.  The filename has
the following form:
    .raw-<encoded-url-of-image>.\x22<ETAG-header>\22.raw.
This is so, if the same resource is fetched multiple times, importd can
avoid extra downloads by creating the new image using the local read-only copy.

The current code assumes the ETag header is set because, if the server
does not set the ETag header, the file is stored without the ETag value
in the filename. When importd fetches a duplicate image, it will run
rename_noreplace and fail:

  Failed to rename raw file to /var/lib/machines/.raw-http:\x2f\x2flocalhost:8000\x2fwalkthroughd.raw: File exists

This patch makes importd only store a read-only image if the webserver
has set the ETag header.

(cherry picked from commit 50dfca2eaf325835c2bd75565f65bfbe84d3cae5)

5 years agonss-systemd: add missing jump to unlock mutex
Zbigniew Jędrzejewski-Szmek [Sat, 28 Mar 2020 12:03:06 +0000 (13:03 +0100)]
nss-systemd: add missing jump to unlock mutex

CID#1412415.

(cherry picked from commit e7e9a9d0dce3fe1a133a42f69a2547749b5bcd46)

5 years agobasic: Fix capability_ambient_set_apply for kernels < 4.3
Kevin Kuehler [Fri, 27 Mar 2020 22:57:02 +0000 (15:57 -0700)]
basic: Fix capability_ambient_set_apply for kernels < 4.3

https://github.com/systemd/systemd/pull/14133 made
capability_ambient_set_apply() acquire capabilities that were explicitly
asked for and drop all others. This change means the function is called
even with an empty capability set, opening up a code path for users
without ambient capabilities to call this function. This function will
error with EINVAL out on kernels < 4.3 because PR_CAP_AMBIENT is not
understood. This turns capability_ambient_set_apply() into a noop for
kernels < 4.3

Fixes https://github.com/systemd/systemd/issues/15225

(cherry picked from commit 7ea4392f1e444388caa706d6bd64fb7b30dc2903)

5 years agosd-journal: remove the dead code and actually fix #14695
Michal Sekletár [Fri, 27 Mar 2020 16:01:59 +0000 (17:01 +0100)]
sd-journal: remove the dead code and actually fix #14695

journal_file_fstat() returns an error if we call it on already unlinked
journal file and hence we never reach remove_file_real() which is the
entire point.

I must have made some mistake while testing the fix that got me thinking
the issue is gone while opposite was true.

Fixes #14695

(cherry picked from commit 8581b9f9732d4c158bb5f773230a65ce77f2c292)

5 years agouser-util: switch order of checks in valid_user_group_name_or_id_full()
Lennart Poettering [Mon, 30 Mar 2020 19:46:01 +0000 (21:46 +0200)]
user-util: switch order of checks in valid_user_group_name_or_id_full()

When we are supposed to accept numeric UIDs formatted as string, then
let's check that first, before passing things on to
valid_user_group_name_full(), since that might log about, and not the
other way round.

See: #15201
Follow-up for: 93c23c9297e48e594785e0bb9c51504aae5fbe3e

(cherry picked from commit a85daa0dfb3eb03be9845760e90e54b9af8fb00e)

5 years agouser-util: Allow names starting with a digit
Balint Reczey [Wed, 18 Mar 2020 17:29:02 +0000 (18:29 +0100)]
user-util: Allow names starting with a digit

In 1a29610f5fa1bcb2eeb37d2c6b79d8d1a6dbb865 the change inadvertedly
disabled names with digit as the first character. This follow-up change
allows a digit as the first character in compat mode.

Fixes: #15141
(cherry picked from commit 93c23c9297e48e594785e0bb9c51504aae5fbe3e)

5 years agoRemove stale doc about PrivateNetwork and type
Zhu Li [Wed, 25 Mar 2020 16:11:52 +0000 (11:11 -0500)]
Remove stale doc about PrivateNetwork and type

(cherry picked from commit 9520a0308d45ad9c885f5413238ecc54c643d972)

5 years agoAdd `shell` to machinectl ZSH completion
Pieter Lexis [Fri, 27 Mar 2020 10:26:14 +0000 (11:26 +0100)]
Add `shell` to machinectl ZSH completion

(cherry picked from commit 72e1c0b308ac0947d625766a59d07336ee42ec31)

5 years agoSilence Wstring-plus-int warning when using clangd with GCC.
Daan De Meyer [Sat, 21 Mar 2020 21:23:19 +0000 (22:23 +0100)]
Silence Wstring-plus-int warning when using clangd with GCC.

(cherry picked from commit f455f8633e3d829bca46dae68e0fb5ca10e8e139)

5 years agopath-lookup: Use default value for XDG_CONFIG_DIRS if environment is not set
David Edmundson [Wed, 25 Mar 2020 22:49:35 +0000 (22:49 +0000)]
path-lookup: Use default value for XDG_CONFIG_DIRS if environment is not set

If XDG_CONFIG_DIRS is unset, the specification says we should assume
/etc/xdg.

(cherry picked from commit f0d0698f0b7d565e6eade043450f7f5557c8db48)

5 years agonetwork: DHCP lease load SIP copy paste error v245.3
Susant Sahani [Sat, 21 Mar 2020 17:32:51 +0000 (18:32 +0100)]
network: DHCP lease load SIP copy paste error

(cherry picked from commit be1af905852d25e11fdf0cb4f37be2a58567dd94)

5 years agodavfs is a network file system
pelzvieh [Mon, 23 Mar 2020 10:15:11 +0000 (11:15 +0100)]
davfs is a network file system

(cherry picked from commit 137d4487511b3221d3c9165326bf55f297dcd5a6)

5 years agounits: Don't mount tracefs in LXC
Balint Reczey [Sun, 22 Mar 2020 20:37:06 +0000 (21:37 +0100)]
units: Don't mount tracefs in LXC

Mounting tracefs fails in unprivileged LXC containers and latest LXD
(3.23) bind mounts tracefs already.

Fixes https://github.com/lxc/lxd/issues/7059

(cherry picked from commit cdc6c95737d26b1746b446dfe662872d593d23c6)

5 years agoswap: check p->what for NULL
Vito Caputo [Sat, 21 Mar 2020 05:47:38 +0000 (22:47 -0700)]
swap: check p->what for NULL

Commit 61f9cf4e4c introduced swap_get_parameters(s) but only
checked its return for NULL and not its ->what.

Fixes https://github.com/systemd/systemd/issues/15070

(cherry picked from commit d4a3494e65946ab78647b5277adcabed0ec43da3)

5 years agologin: allow non-console sessions to change vt
Arnaud Ferraris [Sat, 14 Mar 2020 01:08:50 +0000 (02:08 +0100)]
login: allow non-console sessions to change vt

When starting a wayland session through a systemd service for a non-root
user, the compositor (based on wlroots) is denied the authorization to
change vt.
Once the user logs in, either through a local console or via ssh, the
compositor can work properly.

This is related to the login polkit policy:
- `allow_inactive` has value `auth_admin_keep`, denying any non-root
  user session the authorization to change vt
- `allow_active` has value `yes`, which explains why the vt change
  becomes possible once the user logs in through another channel

By changing the `allow_inactive` value to `yes`, any user session setup
in a service file can switch vt, allowing wayland sessions for non-root
users.

(cherry picked from commit 19bb87fbfac8df67c0c8ff4714382a88733c61a2)

5 years agologind: log a more accurate error when we failed at session creation
Franck Bui [Tue, 17 Mar 2020 17:30:58 +0000 (18:30 +0100)]
logind: log a more accurate error when we failed at session creation

We used to log the following error:

  "Start job for unit user-1000.slice failed with 'canceled'"

which can be really misleading if the actual job failed at *stopping* a unit.

Indeed "Start" was hard coded but it was wrong since we can also fail with stop
jobs which are enqueued when a session is stopped.

(cherry picked from commit b39648ed47065202b343d1d4bde3232d81fdfecc)

5 years agocore: add support for setting CPUAffinity= to special "numa" value
Michal Sekletár [Mon, 17 Feb 2020 12:50:31 +0000 (13:50 +0100)]
core: add support for setting CPUAffinity= to special "numa" value

systemd will automatically derive CPU affinity mask from NUMA node
mask.

Fixes #13248

(cherry picked from commit e2b2fb7f566d13a3de61952b5356cd4d2eaee917)

5 years agoshared: split out NUMA code from cpu-set-util.c to numa-util.c
Michal Sekletár [Mon, 17 Feb 2020 12:04:08 +0000 (13:04 +0100)]
shared: split out NUMA code from cpu-set-util.c to numa-util.c

(cherry picked from commit 1808f76870d8368542f058b99df89cf0a4a2d011)

5 years agodocs: Add syntax for templated units to systemd.preset man page v245.2
Joerg Behrmann [Tue, 10 Mar 2020 15:34:13 +0000 (16:34 +0100)]
docs: Add syntax for templated units to systemd.preset man page

This documents the syntax

     enable template@.service foo bar baz

that was introduced in #9901 to preset templated units.

(cherry picked from commit 1f667d8a7cff4355cd23ebebeb4d7179e3498eb8)

5 years agoman: add a tiny bit of markup
Zbigniew Jędrzejewski-Szmek [Wed, 11 Mar 2020 08:10:22 +0000 (09:10 +0100)]
man: add a tiny bit of markup

(cherry picked from commit 0b1b0a01ab22c088046634c46c496022e7e60673)

5 years agohome: fix segfault when parsing arguments in PAM module
Haochen Tong [Sun, 15 Mar 2020 22:34:35 +0000 (23:34 +0100)]
home: fix segfault when parsing arguments in PAM module

(cherry picked from commit f12d19b30447a771ba6dd551ac05a4ba6de2a976)

5 years agotest: wait a bit after starting the test service
Frantisek Sumsal [Sat, 14 Mar 2020 09:36:17 +0000 (10:36 +0100)]
test: wait a bit after starting the test service

otherwise we might end up being faster than the unit itself, causing
unexpected fails, like:

```
testsuite.sh[297]: + systemctl start issue_14566_test
testsuite.sh[297]: + systemctl status issue_14566_test
testsuite.sh[304]: ● issue_14566_test.service - Issue 14566 Repro
testsuite.sh[304]:      Loaded: loaded (/etc/systemd/system/issue_14566_test.service; static; vendor preset: enabled)
testsuite.sh[304]:      Active: active (running) since Sat 2020-03-14 02:02:23 UTC; 417ms ago
testsuite.sh[304]:    Main PID: 301 ((repro.sh))
testsuite.sh[304]:       Tasks: 1 (limit: 535)
testsuite.sh[304]:      Memory: 180.0K
testsuite.sh[304]:         CPU: 122ms
testsuite.sh[304]:      CGroup: /system.slice/issue_14566_test.service
testsuite.sh[304]:              └─301 [(repro.sh)]
testsuite.sh[307]: ++ cat /leakedtestpid
testsuite.sh[307]: cat: /leakedtestpid: No such file or directory
testsuite.sh[297]: + leaked_pid=
```

(cherry picked from commit 197298ff9fc930de450330095cc5b67d165d0801)

5 years agofix journalctl regression (#15099)
Georg Müller [Thu, 12 Mar 2020 19:02:21 +0000 (20:02 +0100)]
fix journalctl regression (#15099)

This regression was introduced in #14913.

The current_file variable can be NULL, as, for example, with the
following commands:

* journalctl --list-boots
* journalctl -b -1 --no-pager

Since current_file is only checked for pointer equality with f, removing
the assertion is safe here.

(cherry picked from commit 8d0726fcd7b72f2a6f75dd731cbf7c8d4df107ef)

5 years agoNEWS: add late note about job trimming issue
Zbigniew Jędrzejewski-Szmek [Thu, 12 Mar 2020 14:21:42 +0000 (15:21 +0100)]
NEWS: add late note about job trimming issue

Closes #15091.

(cherry picked from commit 2ca17c7801b82bff793f4280cc8fa50cf9e0fc7c)

5 years agosystemctl: hide the 'glyph' column when --no-legend is requested
Frantisek Sumsal [Wed, 11 Mar 2020 12:28:51 +0000 (13:28 +0100)]
systemctl: hide the 'glyph' column when --no-legend is requested

Fixes: #15077
(cherry picked from commit d171e679e7d4f380dceff39611a125b096babf00)

5 years agoformat-table: allow hiding a specific column
Frantisek Sumsal [Wed, 11 Mar 2020 12:27:43 +0000 (13:27 +0100)]
format-table: allow hiding a specific column

without having to specify the whole display map

(cherry picked from commit 0080964cc87e8e2c9904816bf67198b9119ed473)

5 years agocore: transition to FINAL_SIGTERM state after ExecStopPost=
Anita Zhang [Sat, 25 Jan 2020 15:46:16 +0000 (16:46 +0100)]
core: transition to FINAL_SIGTERM state after ExecStopPost=

Fixes #14566

(cherry picked from commit c1566ef0d22ed786b9ecf4c476e53b8a91e67578)

5 years agojournalctl: show duplicate entries if they are from the same file (#14898)
Georg Müller [Thu, 20 Feb 2020 18:19:41 +0000 (19:19 +0100)]
journalctl: show duplicate entries if they are from the same file (#14898)

When having a service which intentionally outputs multiple equal lines,
all these messages might be inserted with the same timestamp.

journalctl has a mechanism to avoid duplicate lines, which might be in
different journal files.

This patch allows duplicate lines, if they are from the same file.

(cherry picked from commit b6849042d610da90d5821a03967d648d424f7864)

5 years agonamespace: ignore prefix chars when comparing paths
Topi Miettinen [Tue, 10 Mar 2020 14:43:10 +0000 (16:43 +0200)]
namespace: ignore prefix chars when comparing paths

Other callers of path_strv_contains() or PATH_IN_SET() don't seem to handle
paths prefixed with -+.

(cherry picked from commit de46b2be07538b55df0ba5e312a89eebb87c710a)

5 years agoudev: fix SECLABEL{selinux} issue (#15064)
Valery0xff [Wed, 11 Mar 2020 00:20:36 +0000 (02:20 +0200)]
udev: fix SECLABEL{selinux} issue (#15064)

Add SECLABEL{selinux}="some value" cause udevadm crash
systemd-udevd[x]: Worker [x] terminated by signal 11 (SEGV)

It happens since 25de7aa7b90 (Yu Watanabe 2019-04-25 01:21:11 +0200)
when udev rules processing changed to token model. Yu forgot store
attr to SECLABEL token so fix it.

(cherry picked from commit 0335d110afc08baf47d76b7011ce02510dfdd524)

5 years agodissect-image: avoid scanning partitions
Topi Miettinen [Mon, 9 Mar 2020 12:01:06 +0000 (14:01 +0200)]
dissect-image: avoid scanning partitions

In case the dissected image has a filesystem, don't scan for partitions. This
avoids problems with services using a `RootImage=` in early boot when udevd is
not yet started.

(cherry picked from commit 0108c42f59dd5848f6b561f260dc6ff3e19d651b)

5 years agotest: ignore IAB capabilities in `test-execute`
Frantisek Sumsal [Mon, 9 Mar 2020 10:00:58 +0000 (11:00 +0100)]
test: ignore IAB capabilities in `test-execute`

libcap v2.33 introduces a new capability set called IAB[0] which is shown
in the output of `capsh --print` and interferes with the test checks. Let's
drop the IAB set from the output, for now, to mitigate this.

This could be (and probably should be) replaced in the future by the
newly introduced testing options[1][2] in libcap v2.32, namely:
    --has-p=xxx
    --has-i=xxx
    --has-a=xxx

but this needs to wait until the respective libcap version gets a wider
adoption. Until then, let's stick with the relatively ugly sed.

Fixes: #15046

[0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=943b011b5e53624eb9cab4e96c1985326e077cdd
[1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=588d0439cb6495b03f0ab9f213f0b6b339e7d4b7
[2] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=e7709bbc1c4712f2ddfc6e6f42892928a8a03782

(cherry picked from commit e9cdcbed77971da3cb0b98b3eb91081142c91eb7)

5 years agotest: add a test case for migrating DynamicUser=yes to no
Yu Watanabe [Fri, 6 Mar 2020 08:34:55 +0000 (17:34 +0900)]
test: add a test case for migrating DynamicUser=yes to no

(cherry picked from commit abaaa79b22f48dac0b45737fcef730fc3471384c)

5 years agoexecute: Fix migration from DynamicUser=yes to no
Yu Watanabe [Fri, 6 Mar 2020 06:56:28 +0000 (15:56 +0900)]
execute: Fix migration from DynamicUser=yes to no

Closes #12131.

(cherry picked from commit 578dc69f2a60d6282acc2d06ce8a3bf8a9d8ada0)

5 years agohomed: replace "home directory" with "home area" in a few places
Zbigniew Jędrzejewski-Szmek [Wed, 11 Mar 2020 12:07:10 +0000 (13:07 +0100)]
homed: replace "home directory" with "home area" in a few places

(cherry picked from commit b5947b5b100f694c93857a82018fb0656d08be34)

5 years agoshared/ask-password-api: do not show hint on echo
Christian Hesse [Wed, 11 Mar 2020 19:39:07 +0000 (20:39 +0100)]
shared/ask-password-api: do not show hint on echo

Giving --echo to systemd-ask-password allows to echo the user input instead
of masking it. This is useful when querying for usernames or similar.

Showing "(press TAB for no echo)" does not make sense there, so do not.
Note that pressing TAB or ESC still disables echo.

(cherry picked from commit ddee0e815ed5500722019bcb807957ea6846212d)

5 years agoanalyze: fix table time output v245.1
Haochen Tong [Mon, 9 Mar 2020 09:43:09 +0000 (10:43 +0100)]
analyze: fix table time output

(cherry picked from commit 47cc458e97a3825d57462bad2ee854903364512e)

5 years agoSupport compiling with clang and gnu11 standard
Denis Pronin [Sun, 8 Mar 2020 20:57:07 +0000 (23:57 +0300)]
Support compiling with clang and gnu11 standard

Signed-off-by: Denis Pronin <dannftk@yandex.ru>
(cherry picked from commit 36e0d89a88c51ba879a2d7e2f90ea9b38333e2c0)

5 years agoTypo fix
bemarek [Sun, 8 Mar 2020 21:39:01 +0000 (22:39 +0100)]
Typo fix

(cherry picked from commit 1cee1c52833fb6e3829e510109404852a17e5bdd)

5 years agoUpdate Croatian translation (#15042)
gogogogi [Sun, 8 Mar 2020 21:06:12 +0000 (22:06 +0100)]
Update Croatian translation (#15042)

(cherry picked from commit 51915ca447027249b6decb8a3333ed388fdfcca7)

5 years agoboot: Ensure ARM UEFI binary does not contain FP/SIMD instructions
James T. Lee [Sat, 7 Mar 2020 23:05:34 +0000 (18:05 -0500)]
boot: Ensure ARM UEFI binary does not contain FP/SIMD instructions

ARM toolchains will sometimes optimize otherwise floating-point-free
code with floating point and SIMD instructions.  This was happening with
systemd-bootarm.efi and it was causing U-Boot to crash and reset the
CPU.  U-Boot does not support the ARM VFP floating point coprocessor,
which is an optional piece of hardware anyway [1].

Ensure the compiler does not generate FP/SIMD instructions by supplying
the `-mgeneral-regs-only` option when building for ARM [2].

The other option you often see to solve these problems is
`-msoft-float`, but that changes the ABI and prevents linking with
libgnuefi.

[1] https://lists.denx.de/pipermail/u-boot/2011-February/087736.html
[2] https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-mgeneral-regs-only-1

(cherry picked from commit 1ad6056239b70ce69ea70108cf4e49a05a9c2a1d)

5 years agocore: Fix resolution of nested DM devices for cgroups
Benjamin Berg [Thu, 5 Mar 2020 10:35:45 +0000 (11:35 +0100)]
core: Fix resolution of nested DM devices for cgroups

When using the cgroups IO controller, the device that is controlled
should always be the toplevel block device. This did not get resolved
correctly for an LVM volume inside a LUKS device, because the code would
only resolve one level of indirection.

Fix this by recursively looking up the originating block device for DM
devices.

Resolves: #15008

5 years agoFix typo on initrd-root-device.target
antznin [Fri, 6 Mar 2020 12:51:28 +0000 (13:51 +0100)]
Fix typo on initrd-root-device.target

5 years agoMerge pull request #15034 from keszybz/hwdb-update v245
Zbigniew Jędrzejewski-Szmek [Fri, 6 Mar 2020 12:38:52 +0000 (13:38 +0100)]
Merge pull request #15034 from keszybz/hwdb-update

5 years agoNEWS: final contributor update for v245
Zbigniew Jędrzejewski-Szmek [Fri, 6 Mar 2020 12:25:21 +0000 (13:25 +0100)]
NEWS: final contributor update for v245

5 years agoMerge pull request #15022 from keszybz/make-units-remain-after-exit
Yu Watanabe [Fri, 6 Mar 2020 12:14:36 +0000 (21:14 +0900)]
Merge pull request #15022 from keszybz/make-units-remain-after-exit

Make units remain after exit

5 years agohwdb: update for v245
Zbigniew Jędrzejewski-Szmek [Fri, 6 Mar 2020 11:41:29 +0000 (12:41 +0100)]
hwdb: update for v245

5 years agounits: skip modprobe@.service if the unit appears to be already loaded
Zbigniew Jędrzejewski-Szmek [Thu, 5 Mar 2020 06:20:49 +0000 (07:20 +0100)]
units: skip modprobe@.service if the unit appears to be already loaded

Possible alternative to #14819.

For me, setting RemainAfterExit=yes would be OK, but if people think that it
might cause issues, then this could be a reasonable alternative that still
let's us skip the invocation of the separate binary.

5 years agotreewide: more portable bash shebangs
Jörg Thalheim [Wed, 4 Mar 2020 09:35:06 +0000 (09:35 +0000)]
treewide: more portable bash shebangs

As in 2a5fcfae024ffc370bb780572279f45a1da3f946
and in 3e67e5c9928f8b1e1c5a63def88d53ed1fed12eb
using /usr/bin/env allows bash to be looked up in PATH
rather than being hard-coded.

As with the previous changes the same arguments apply
- distributions have scripts to rewrite shebangs on installation and
  they know what locations to rely on.
- For tests/compilation we should rather rely on the user to have setup
  there PATH correctly.

In particular this makes testing from git easier on NixOS where do not provide
/bin/bash to improve compose-ability.

5 years agoUse Finished instead of Started for Type=oneshot services (#14851)
Zbigniew Jędrzejewski-Szmek [Thu, 5 Mar 2020 16:24:19 +0000 (17:24 +0100)]
Use Finished instead of Started for Type=oneshot services (#14851)

UnitStatusMessageFormats.finished_job, if present,
will be called with the same arguments as
job_get_done_status_message_format() to provide a format string
appropriate for the context

This commit replaces "Started" with "Finished" for started oneshot
units, as mentioned in the referenced issue

Closes #2458.

5 years agounits: make systemd-network-generator.service stay around
Zbigniew Jędrzejewski-Szmek [Thu, 5 Mar 2020 07:08:31 +0000 (08:08 +0100)]
units: make systemd-network-generator.service stay around

Once done, its done, and shouldn't be run again.

5 years agoMerge pull request #15013 from systemd/systemctl-list-dependencies
Yu Watanabe [Thu, 5 Mar 2020 11:54:58 +0000 (20:54 +0900)]
Merge pull request #15013 from systemd/systemctl-list-dependencies

systemctl list-dependencies: fix duplicate output and take multiple arguments

5 years agoMerge pull request #15023 from keszybz/network-generator-man
Yu Watanabe [Thu, 5 Mar 2020 11:54:32 +0000 (20:54 +0900)]
Merge pull request #15023 from keszybz/network-generator-man

Man page for systemd-network-generator

5 years agosystemctl: make list-dependencies take multiple arguments
Zbigniew Jędrzejewski-Szmek [Wed, 4 Mar 2020 08:55:29 +0000 (09:55 +0100)]
systemctl: make list-dependencies take multiple arguments

Other similar commands do, no reason not to do this here too.

5 years agoman: mention networkctl in the networkd man page
Zbigniew Jędrzejewski-Szmek [Thu, 5 Mar 2020 07:20:31 +0000 (08:20 +0100)]
man: mention networkctl in the networkd man page

5 years agoman: add systemd-network-generator.service(8)
Zbigniew Jędrzejewski-Szmek [Thu, 5 Mar 2020 07:05:24 +0000 (08:05 +0100)]
man: add systemd-network-generator.service(8)

It's a bit bare-bones, but it should be enough to point the reader in the right
direction.

5 years agounits: restore RemainAfterExit=yes in systemd-vconsole-setup.service
Zbigniew Jędrzejewski-Szmek [Thu, 5 Mar 2020 06:11:09 +0000 (07:11 +0100)]
units: restore RemainAfterExit=yes in systemd-vconsole-setup.service

This reverts the second part of 8125e8d38e3aa099c7dce8b0161997b8842aebdc.
The first part was reverted in 750e550eba362096d56a35104c6a32631aa67b8e.
The problem starts when s-v-s.s is pulled in by something that is then pulled
in by sysinit.target. Every time a unit is started, systemd recursively checks
all dependencies, and since sysinit.target is pull in by almost anything, we'll
start s-v-s.s over and over. In particular, plymouth-start.service currently
has Wants=s-v-s.s and After=s-v-s.s.

5 years agopid1: remove unnecessary terminator
Zbigniew Jędrzejewski-Szmek [Thu, 5 Mar 2020 07:06:43 +0000 (08:06 +0100)]
pid1: remove unnecessary terminator

We specify the number of items as the first argument already.

5 years agoman: update list of supported controllers
Anita Zhang [Thu, 5 Mar 2020 01:31:36 +0000 (17:31 -0800)]
man: update list of supported controllers

5 years agounits: do not ignore return value from systemd --user
Zbigniew Jędrzejewski-Szmek [Wed, 4 Mar 2020 13:21:37 +0000 (14:21 +0100)]
units: do not ignore return value from systemd --user

This minus has been there since the unit was added in
d42d27ead91e470cb12986d928441e56c0f543ca. I think the idea was not cause things
to fail if the user instance doesn't work. But ignoring the return value
doesn't seem to be the right way to approach the problem. In particular, if
the program fails to run, we'll get a bogus fail state, see
https://bugzilla.redhat.com/show_bug.cgi?id=1727895#c1:

with the minus:
$ systemctl start user@1002
Job for user@1002.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status user@1002.service" and "journalctl -xe" for details.

without the minus:
$ systemctl start user@1002
Job for user@1002.service failed because the control process exited with error code.
See "systemctl status user@1002.service" and "journalctl -xe" for details.

5 years agopid1, nspawn: voidify loopback_setup()
Yu Watanabe [Wed, 4 Mar 2020 12:20:31 +0000 (21:20 +0900)]
pid1, nspawn: voidify loopback_setup()

5 years agotimesync, meson: allow statically linked build
Robert Scheck [Sat, 8 Feb 2020 13:02:09 +0000 (14:02 +0100)]
timesync, meson: allow statically linked build

Build option "link-timesyncd-shared" to build a statically linked
systemd-timesyncd by using

  -Dlink-udev-shared=false -Dlink-timesyncd-shared=false

on systems with full systemd stack except systemd-timesyncd, such
as RHEL/CentOS 8.

5 years agosystemctl: do not print items twice in list-dependencies
Zbigniew Jędrzejewski-Szmek [Wed, 4 Mar 2020 08:33:12 +0000 (09:33 +0100)]
systemctl: do not print items twice in list-dependencies

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1807485.

5 years agomake namespace_flags_to_string() not return empty string
Yu Watanabe [Tue, 3 Mar 2020 15:52:40 +0000 (00:52 +0900)]
make namespace_flags_to_string() not return empty string

This improves the following debug log.

Before:
systemd[1162]: Restricting namespace to: .

After:
systemd[1162]: Restricting namespace to: n/a.

5 years agoMerge pull request #15009 from keszybz/version-and-doc-updates
Zbigniew Jędrzejewski-Szmek [Tue, 3 Mar 2020 19:29:12 +0000 (20:29 +0100)]
Merge pull request #15009 from keszybz/version-and-doc-updates

Version and doc updates