systemd/.git
4 years agopager: set $LESSSECURE whenver we invoke a pager
Lennart Poettering [Mon, 31 Aug 2020 17:37:13 +0000 (19:37 +0200)]
pager: set $LESSSECURE whenver we invoke a pager

Some extra safety when invoked via "sudo". With this we address a
genuine design flaw of sudo, and we shouldn't need to deal with this.
But it's still a good idea to disable this surface given how exotic it
is.

Prompted by #5666

(cherry picked from commit 612ebf6c913dd0e4197c44909cb3157f5c51a2f0)

4 years agosystemctl: ignore invalid variables in import-environment
Zbigniew Jędrzejewski-Szmek [Mon, 28 Sep 2020 15:29:34 +0000 (17:29 +0200)]
systemctl: ignore invalid variables in import-environment

When doing import-environment, we shouldn't fail if some assignment is invalid.
OTOH, if the invalid assignment is specified as a positional argument, we should
keep failing.

This would also fix https://bugzilla.redhat.com/show_bug.cgi?id=1754395, by
ignoring certain variables which are not important in that scenario. It seems
like the right thing to do in general.

(cherry picked from commit a4ccce22d9552dc74b6916cc5ec57f2a0b686b4f)

4 years agoseccomp: allowlist close_range() by default in @basic-io
Lennart Poettering [Wed, 14 Oct 2020 07:40:37 +0000 (09:40 +0200)]
seccomp: allowlist close_range() by default in @basic-io

(cherry picked from commit 6ea0d25c573c6ef64f62333b7e850067a202c7ee)

4 years agoalloc-util: avoid allocating zero size memory blocks
Lennart Poettering [Wed, 14 Oct 2020 08:24:08 +0000 (10:24 +0200)]
alloc-util: avoid allocating zero size memory blocks

It's not clear what libc's make of this. We clamp to 1 byte allocations
in most cases already, let's add this for a few where this was missing.

(cherry picked from commit 562b01e99646a21ba8a0f4f52c578a38b3f7d03d)

4 years agosd-device: use trivial_hash_ops_free_free for managing match sysattrs or properties
Yu Watanabe [Tue, 13 Oct 2020 13:41:34 +0000 (22:41 +0900)]
sd-device: use trivial_hash_ops_free_free for managing match sysattrs or properties

This fixes an issue caused by eb1c1dc029c91750e6255c3fd844b4f4bf238fab.

Before the commit, multiple values can be specified for the same
sysattr or property.

Fixes #17259.

(cherry picked from commit a0887abbd8bd9f1a9a975af08e6b4a43960bb3e2)

4 years agoutil: introduce two trivial hash_ops
Yu Watanabe [Tue, 13 Oct 2020 13:40:19 +0000 (22:40 +0900)]
util: introduce two trivial hash_ops

Will be used in a later commit.

(cherry picked from commit 5e71868ced159355a25dc935b24c8e9b1d946bd7)

4 years agohashmap: introduce {hashmap,set}_put_strdup_full()
Yu Watanabe [Tue, 13 Oct 2020 13:39:02 +0000 (22:39 +0900)]
hashmap: introduce {hashmap,set}_put_strdup_full()

They can take hash_ops.

(cherry picked from commit 11e9fec2590d9726c57498d5c2ed9ea2860ad443)

4 years agotypo in systemd.network(5): IPv6PrefixDelegation=dhcpv6
Dmitry Borodaenko [Tue, 13 Oct 2020 21:35:59 +0000 (14:35 -0700)]
typo in systemd.network(5): IPv6PrefixDelegation=dhcpv6

(cherry picked from commit 5fad3913e2db5eda2339419e049af88953c17ff3)

4 years agounits: update serial-getty@.service to support 57600 baud rate
Bjørn Mork [Tue, 13 Oct 2020 15:07:07 +0000 (17:07 +0200)]
units: update serial-getty@.service to support 57600 baud rate

Fixes: #17306
(cherry picked from commit 7fe7547ba3b953c142f41a9931dba7b6ff78fe0b)

4 years agosysctl: set kernel.core_pipe_limit=16
Lennart Poettering [Mon, 12 Oct 2020 14:31:42 +0000 (16:31 +0200)]
sysctl: set kernel.core_pipe_limit=16

We need to make sure that our coredump pattern handler manages to read
process metadata from /proc/$PID/ before the kernel reaps the crashed
process. By default the kernel will reap the process as soon as it can.
By setting kernel.core_pipe_limit to a non-zero the kernel will wait for
userspace to finish before reaping.

We'll set the value to 16, which allows 16 crashes to be
processed in parallel. This matches the MaxConnections= setting in
systemd-coredump.socket.

See: #17301

(This doesn't close 17301, since we probably should also gracefully
handle if /proc/$PID/ vanished already while our coredump handler runs,
just in case people loclly set the sysctl back to zero. i.e. we should
collect what we can and rather issue an incomplete log record than
none.)

(cherry picked from commit 2a9b9323cd844baae3229e9dba67e478bee70654)

4 years agoxdg-autostart: Lower most info messages to debug level
Benjamin Berg [Mon, 12 Oct 2020 09:02:26 +0000 (11:02 +0200)]
xdg-autostart: Lower most info messages to debug level

It is expected for numerous autostart files to not be convertible to
corresponding units. The information is only useful for someone
debugging why a file might not be started, but it is not generally
useful for users in most situations.

As such, lower the warnings. Anyone wondering why an application is not
started will easily notice that the unit is not generated. From there it
will be somewhat harder to figure out why, but the overall trade-off is
still improved.

Fixes: #17305
(cherry picked from commit 47c1db6730b8a81b01e8505a648624fa6ad0bbd7)

4 years agologind: print what action is ignored
Zbigniew Jędrzejewski-Szmek [Sat, 10 Oct 2020 07:49:28 +0000 (09:49 +0200)]
logind: print what action is ignored

My logs have lines like this:
Oct 10 09:38:38 krowka systemd-logind[1889]: External (2) displays connected.
Oct 10 09:38:38 krowka systemd-logind[1889]: Refusing operation, as it is turned off.
Without some hint *what* operation is ignored, this is not very informative.

(I remember this came up before, but I don't remember why we didn't change this
log line back then...)

(cherry picked from commit bf135d82585f9a6356fa818fe4c130d3e3524918)

4 years agoresolved: don't append RFC6975 data to stub replies
Lennart Poettering [Fri, 9 Oct 2020 14:47:34 +0000 (16:47 +0200)]
resolved: don't append RFC6975 data to stub replies

We previously checked the QR bit to decide whether the RFC6975 algorithm
data in our packets. But that doesn't work in many cases, since we
initialize the QR flags along with the other flags usually only after
appending OPT (since success to do so propagates into flags). Hence,
let's add an explicit parameter that controls whether to include RFC6975
data in DNS packets, and set it to false for stub reply, and on true for
upstream queries.

Fixes: #17217
(cherry picked from commit c36d5b5be900315b113a62199274c37fe47a37cd)

4 years agoxdg-autostart: Ignore more common XDG Desktop Entry fields
Benjamin Berg [Thu, 8 Oct 2020 13:58:37 +0000 (15:58 +0200)]
xdg-autostart: Ignore more common XDG Desktop Entry fields

It makes sense to ignore all the common fields that are expected and
that we can safely ignore. Note that it is fine to ignore URL as we will
already warn about the type= being wrong in that case.

Closes: #17276
(cherry picked from commit 51ac77d58c03f337e1347263eb4995e1f9947a9d)

4 years agoxdg-autostart: Add support for Path= in XDG Desktop File
Benjamin Berg [Thu, 8 Oct 2020 13:58:08 +0000 (15:58 +0200)]
xdg-autostart: Add support for Path= in XDG Desktop File

This sets the working directory of the application.

(cherry picked from commit d5273f51a1f452575eccfb855a8dc383c8d23f3a)

4 years agomissing_syscall: fixup syscall numbers for x32 vs. amd64
Zbigniew Jędrzejewski-Szmek [Tue, 8 Dec 2020 14:11:01 +0000 (15:11 +0100)]
missing_syscall: fixup syscall numbers for x32 vs. amd64

Ported from 356e9c668732895c2887e48fa618367683dd9fff.

4 years agosd-event: check return value of syscals directly, avoid redundant variable assignment
Lennart Poettering [Thu, 8 Oct 2020 16:50:36 +0000 (18:50 +0200)]
sd-event: check return value of syscals directly, avoid redundant variable assignment

And while we are at it, fix one incorrect error propagation.

(cherry picked from commit 15c689d77f9d8d46a39be39ed5acfdaed794301c)

4 years agomissing-syscall: fix copypasta
Lennart Poettering [Thu, 8 Oct 2020 08:27:30 +0000 (10:27 +0200)]
missing-syscall: fix copypasta

As noticed by @mbiebl:

https://github.com/systemd/systemd/commit/5134e18eedc30bfe5397ed31f94903d984a60cfc#r43033443
(cherry picked from commit ba28df775d451edfcca9f996d60ed34c1dde2ac5)

4 years agobasic/missing_syscall: fix syscall numbers for mips*
Zbigniew Jędrzejewski-Szmek [Tue, 8 Dec 2020 14:03:03 +0000 (15:03 +0100)]
basic/missing_syscall: fix syscall numbers for mips*

Based on cd2065989163a5b6f71c8f1e4a8d73f1be63a52b.

4 years agopretty-print: don't abbreviate needlessly in user-facing string
Lennart Poettering [Wed, 7 Oct 2020 14:38:29 +0000 (16:38 +0200)]
pretty-print: don't abbreviate needlessly in user-facing string

(cherry picked from commit e2d839d316b006fe86b1f156d90da35fa0857bfb)

4 years agobasic: include stddef.h since we use NULL in header
Lennart Poettering [Wed, 7 Oct 2020 14:38:07 +0000 (16:38 +0200)]
basic: include stddef.h since we use NULL in header

(cherry picked from commit 0f2219bb8f19f0e3afb479e9c8f2ca6cbd1d9608)

4 years agounit: don't emit PropertiesChanged signal if adding a dependency to a unit is a no-op
Renaud Métrich [Fri, 2 Oct 2020 15:30:35 +0000 (17:30 +0200)]
unit: don't emit PropertiesChanged signal if adding a dependency to a unit is a no-op

(cherry picked from commit 5177cb0a9add4ae568cff6e6f7c2b3c77760c343)

4 years agosystemctl: drop unsused variable original_stdout_is_tty
Lennart Poettering [Wed, 7 Oct 2020 09:30:32 +0000 (11:30 +0200)]
systemctl: drop unsused variable original_stdout_is_tty

Unused since de9a8fe18e0168b65ae50b6dde2865f647fc92a2.

(cherry picked from commit b8aaceb9b599ab61843165f0c162844f5499bcb4)

4 years agosocket-proxy: close correct fd, log at right log level
Lennart Poettering [Thu, 1 Oct 2020 20:20:42 +0000 (22:20 +0200)]
socket-proxy: close correct fd, log at right log level

(cherry picked from commit 76c59537f3fef708109f90f6a728a8252d65e420)

4 years agoDocument some reasonable DNS servers in the example config file
Zbigniew Jędrzejewski-Szmek [Tue, 6 Oct 2020 11:59:25 +0000 (13:59 +0200)]
Document some reasonable DNS servers in the example config file

We have an option to set the fallback list, so we don't know what the contents
are. It may in fact be empty. Let's add some examples to make it easy for a user
stranded without any DNS to fill in something that would work. As a bonus, this
also gives names to the entries we provide by default.
(I added google and cloudflare because that's what we have currently, and quad9
because it seems to be a good privacy-concious and fast choice and was requested
in #12499. As a minimum, things we should include should be well-known global
services with a documented privacy policy and both IPv4 and IPv6 support and
decent response times.)

(cherry picked from commit 206178a9d22f5dc60f15decd8fe879326cbf4c25)

4 years agoboot/efi: Explicitly specify void in parameter list
Marco Wang [Tue, 6 Oct 2020 17:07:55 +0000 (01:07 +0800)]
boot/efi: Explicitly specify void in parameter list

Functions that accept no arguments should be
explicitly declared a void parameter in their parameter list.

Signed-off-by: Marco Wang <m.aesophor@gmail.com>
(cherry picked from commit ee85122987decae4f9f3b1dad6f7bc3b08b92526)

4 years agoudevadm: ignore -ENODEV on trigger
Yu Watanabe [Mon, 5 Oct 2020 21:39:22 +0000 (06:39 +0900)]
udevadm: ignore -ENODEV on trigger

The commit 88da55e28b467999da005591d3252a98f4436522 erroneously makes
`udevadm trigger` treat -ENODEV error critical.
This makes -ENODEV ignored again.

Fixes #17250.

(cherry picked from commit 1b97c5cba58fdd1138e7622d7edef9a48309b0e2)

4 years agobasic/virt: Detect PowerVM hypervisor
Michal Suchanek [Fri, 2 Oct 2020 09:05:23 +0000 (11:05 +0200)]
basic/virt: Detect PowerVM hypervisor

Currently systemd-detect-virt fails to detect running under PowerVM.

Add code to detect PowerVM based on code in util-linux.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
(cherry picked from commit 3224e38bb6b3287ca253cbafb460a150544d5818)

4 years agoman: reword description of KillOnlyUsers=/KillExcludeUsers=
Zbigniew Jędrzejewski-Szmek [Mon, 5 Oct 2020 12:27:04 +0000 (14:27 +0200)]
man: reword description of KillOnlyUsers=/KillExcludeUsers=

Fixes #17177.

(cherry picked from commit 41b6ae4da3d3e1360a9f78ca3e1176a3bfe2ec2d)

4 years agoman: reword the descriptions of VXLAN DestinationPort= and PortRange=
Zbigniew Jędrzejewski-Szmek [Mon, 5 Oct 2020 12:23:19 +0000 (14:23 +0200)]
man: reword the descriptions of VXLAN DestinationPort= and PortRange=

The usual: "empty string" is meaningless in this context. We are not assigning
DestinationPort="". Just say "unset".

Fixes #17240.

(cherry picked from commit e6fd398d61a9810d53a2a5a30294500718e43286)

4 years agoman: reword of fido2 key derivation
Zbigniew Jędrzejewski-Szmek [Mon, 5 Oct 2020 12:11:02 +0000 (14:11 +0200)]
man: reword of fido2 key derivation

"keyed by" is indeed a bit jargony. Say " a HMAC hash of the salt combined with
an internal secret key" instead.

For #17177.

(cherry picked from commit e0c60bf6a0065ba447b50fcb1bb171725e8bd00d)

4 years agoman: fix table alignment
Lennart Poettering [Mon, 5 Oct 2020 15:45:58 +0000 (17:45 +0200)]
man: fix table alignment

(cherry picked from commit ddd6dd9f2398c01f69acf163bfdedf161d7cea0d)

4 years agoshell-completion: add missing completions to meson.build
Lucas Werkmeister [Sun, 4 Oct 2020 13:39:24 +0000 (15:39 +0200)]
shell-completion: add missing completions to meson.build

Completions for systemd-id128 and homectl have been available for a
while, but weren’t being installed.

(cherry picked from commit 7c57a030e0d654ce0e4d557da826170fb5ac5bc2)

4 years agoseccomp-util: fix typo in help message
Samanta Navarro [Sat, 3 Oct 2020 11:56:40 +0000 (11:56 +0000)]
seccomp-util: fix typo in help message

(cherry picked from commit 7b121df640475a3c8b9891a307f562abc754293d)

4 years agocryptsetup-generator: drop unused fstat()
Zbigniew Jędrzejewski-Szmek [Thu, 24 Sep 2020 08:45:25 +0000 (10:45 +0200)]
cryptsetup-generator: drop unused fstat()

The result stopped being used in 71e4e1258436e7e81d772aed52a02bb5d9c87cb8.

(cherry picked from commit 115a7fb624091a431e834f82c0633b00598eb510)

4 years agonspawn: give better message when invoked as non-root without arguments
Zbigniew Jędrzejewski-Szmek [Wed, 23 Sep 2020 10:20:14 +0000 (12:20 +0200)]
nspawn: give better message when invoked as non-root without arguments

When invoked as non-root, we would suggest re-running as root without any
further hint. But this immediately spawns a machine from the local directory,
which can be rather surprising. So let's give a better hint.

(In general, I don't think commandline programs should do "significant" things
when invoked without any arguments. In this regard it would be better if
systemd-nspawn would not spawn a machine from the current directory if called
with no arguments and at least "-D ." would be required.)

(cherry picked from commit 38ee19c04b1a7a9f8858d791c68c8a9b711a4e3d)

4 years agobootspec: don't fail with EIO if searching for ESP and finding one without an envelop...
Lennart Poettering [Wed, 30 Sep 2020 09:04:08 +0000 (11:04 +0200)]
bootspec: don't fail with EIO if searching for ESP and finding one without an enveloping partition table

If this happens this should just mean: we couldn't find the ESP.

Fixes: #17122
(cherry picked from commit 7ea3024b508ac7166851bd8728ac31802586d614)

4 years agoman: mention that sd_bus_send() buffers locally, and sd_bus_process() is needed to...
Lennart Poettering [Wed, 23 Sep 2020 08:09:53 +0000 (10:09 +0200)]
man: mention that sd_bus_send() buffers locally, and sd_bus_process() is needed to flush it out

Prompted-by: #17128
(cherry picked from commit 533ee38b56e881a49481bdc095793c294acce121)

4 years agoresolvectl: show resolv.conf mode in resolvectl output
Lennart Poettering [Tue, 29 Sep 2020 15:28:31 +0000 (17:28 +0200)]
resolvectl: show resolv.conf mode in resolvectl output

(cherry picked from commit 147a5046aadc2909647be32194c65d67eb42d9ce)

4 years agoresolved: expose a new bus property that informs about the /etc/resolv.conf mode
Lennart Poettering [Tue, 29 Sep 2020 15:25:15 +0000 (17:25 +0200)]
resolved: expose a new bus property that informs about the /etc/resolv.conf mode

It can be one of "foreign", "missing", "stub", "static", "uplink",
depending on how /etc/resolv.conf is set up:

foreign → someone/something else manages /etc/resolv.conf,
    systemd-resolved is just the consumer

missing → /etc/resolv.conf is missing altogether

stub/static/uplink → the file is managed by resolved, with the
    well-known modes

Fixes: #17159
(cherry picked from commit 4261ab654c0df009b5a37a30593d58d47fec617f)

4 years agologinctl: add -P as short for --value --property=
Ronan Pigott [Wed, 30 Sep 2020 06:51:08 +0000 (23:51 -0700)]
loginctl: add -P as short for --value --property=

(cherry picked from commit 60b254ca1a4ac81b71dd5de8c396c663bafa64a7)

4 years agosysusers: use "!*" instead of "!!" as an invalid group password
nl6720 [Wed, 30 Sep 2020 05:09:25 +0000 (08:09 +0300)]
sysusers: use "!*" instead of "!!" as an invalid group password

This basically implements fc58c0c7bf7e4f525b916e3e5be0de2307fef04e for gshadow.
gpasswd may not have a lock/unlock that behaves the same as passwd, but
according to gshadow(5) the logic of the password field is the same.

(cherry picked from commit bbbfe49b5eb0c571c10fa7991c10bac620f3c453)

4 years agoseccomp-util: add cacheflush() syscall to @default syscall set
Lennart Poettering [Tue, 29 Sep 2020 13:59:28 +0000 (15:59 +0200)]
seccomp-util: add cacheflush() syscall to @default syscall set

This is like membarrier() I guess and basically just exposes CPU
functionality via kernel syscall on some archs. Let's whitelist it for
everyone.

Fixes: #17197
(cherry picked from commit 8e24b1d23f5fa711bfdfd38bcfef525de04cd3c1)

4 years agozsh: loginctl: complete alias 'self'
Ronan Pigott [Wed, 30 Sep 2020 07:11:48 +0000 (00:11 -0700)]
zsh: loginctl: complete alias 'self'

(cherry picked from commit 0fb8f025065ddaf3d197cce6776962ff64de5300)

4 years agopath-lookup: Correct order of XDG_CONFIG_HOME and XDG_CONFIG_DIRS
Pass Automated Testing Suite [Mon, 28 Sep 2020 15:49:55 +0000 (17:49 +0200)]
path-lookup: Correct order of XDG_CONFIG_HOME and XDG_CONFIG_DIRS

According to the XDG Base Directory Specification [1] XDG_CONFIG_HOME
should take precedence over XDG_CONFIG_DIRS.

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

[1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

(cherry picked from commit e3820eeaf11f3b4614cbdfbc85675bc16a486e21)

4 years agodocs: update old documentation links
nl6720 [Tue, 29 Sep 2020 13:10:08 +0000 (16:10 +0300)]
docs: update old documentation links

(cherry picked from commit f856778b9c87d2dc9a6924db0cf26374aa7235c3)

4 years agoudevadm: do not ignroe error caused by unpriviledged user invoking the command
Yu Watanabe [Tue, 29 Sep 2020 04:44:28 +0000 (13:44 +0900)]
udevadm: do not ignroe error caused by unpriviledged user invoking the command

This effectively reverts commit 67acde4869a9505f9721e31fa5167c82445e0e12.

After commits 569ad251adde02dc0915758fe027e0346e50738a and
67acde4869a9505f9721e31fa5167c82445e0e12, -EACCES errors are ignored,
and thus 'udevadm trigger' succeeds even when it is invoked by non-root
users. Moreover, on -EACCES error, log messages are shown in debug
level, so usually we see no message, and users are easily confused
why uevents for devices are not triggered.

(cherry picked from commit 88da55e28b467999da005591d3252a98f4436522)

4 years agoman: fix reference to unit file
Lennart Poettering [Mon, 28 Sep 2020 14:29:36 +0000 (16:29 +0200)]
man: fix reference to unit file

It' "systemd-tmpfiles-clean" not "systemd-tmpfiles-cleanup"

Fixes: #17171
(cherry picked from commit 6457e88902a9e2cf0b7f184a8e50a7ef666bcc78)

4 years agocore: move reset_arguments() to the end of main's finish
Anita Zhang [Thu, 17 Sep 2020 08:49:17 +0000 (01:49 -0700)]
core: move reset_arguments() to the end of main's finish

Fixes #16991

fb39af4ce42d7ef9af63009f271f404038703704 replaced `free_arguments()` with
`reset_arguments()`, which frees arg_* variables as before, but also resets all
of them to the default values. `reset_arguments()` was positioned
in such a way that it overrode some arg_* values still in use at shutdown.

To avoid further unintentional resets, I moved `reset_arguments()`
right before the return, when nothing else will be using the arg_* variables.

(cherry picked from commit 7d9eea2bd3d4f83668c7a78754d201b226acbf1e)

4 years agocore: ensure that namespace tmp directories always get the correct label
bauen1 [Fri, 25 Sep 2020 16:45:29 +0000 (18:45 +0200)]
core: ensure that namespace tmp directories always get the correct label

If a namespace with PrivateTmp=true is constructed we need to restore
the context of the namespaces /tmp directory (i.e.
/tmp/systemd-private-XXXXX/tmp) to the (default) context of /tmp .
Otherwise filetransitions might result in the namespaces tmp directory
having the wrong context.

(cherry picked from commit 19cd4e1967ddb0a576688793a050a9f01e714928)

4 years agoRemoving unused n_fields in journal-gatewayd
Samuel BF [Sun, 27 Sep 2020 20:01:44 +0000 (22:01 +0200)]
Removing unused n_fields in journal-gatewayd

(cherry picked from commit d99d1aaa21e216b2c2f520b58f847248407ba768)

4 years agoloop-util: apparently opening a loop device sometimes results in ENXIO, handle this
Lennart Poettering [Thu, 24 Sep 2020 13:08:22 +0000 (15:08 +0200)]
loop-util: apparently opening a loop device sometimes results in ENXIO, handle this

(cherry picked from commit 77ad674b51ceb598aae1adaa7abe572ad0262f39)

4 years agocryptsetup-generator: use "/proc/cmdline" as source when appropriate
Jonathan Lebon [Wed, 23 Sep 2020 19:23:58 +0000 (15:23 -0400)]
cryptsetup-generator: use "/proc/cmdline" as source when appropriate

Right now, we always say `/etc/crypttab` even if the source was fully
derived from the kargs.

Let's match what `systemd-fstab-generator` does and use `/proc/cmdline`
when that's the case.

(cherry picked from commit 62ca7d3b38dbbfbffa0aa0d3746b6be2916530b5)

4 years agotest-seccomp: accept ENOSYS from sysctl(2) too
Zbigniew Jędrzejewski-Szmek [Tue, 22 Sep 2020 17:05:17 +0000 (19:05 +0200)]
test-seccomp: accept ENOSYS from sysctl(2) too

It seems that kernel 5.9 started returning that.

(cherry picked from commit 0af05e485a3a88f454c714901eb6109307dc893e)

4 years agotest/run-integration-tests: do not run the tests if only "clean" is passed
Zbigniew Jędrzejewski-Szmek [Mon, 21 Sep 2020 22:00:59 +0000 (00:00 +0200)]
test/run-integration-tests: do not run the tests if only "clean" is passed

(cherry picked from commit abf6346c5e65ec1ab1f83841e9bd07a2e301dde8)

4 years agosd-dhcp6-client: Fix sending prefix delegation request (#17136)
mog422 [Thu, 24 Sep 2020 15:04:52 +0000 (00:04 +0900)]
sd-dhcp6-client: Fix sending prefix delegation request (#17136)

SD_DHCP6_OPTION_IA_NA does not exist in DHCP6_ADVERTISE packet if DHCP server only provides prefix delegation. So the attempt to send the DHCP6_REQUEST packet fails on r = dhcp6_option_append_ia(&opt, &optlen, &client->lease->ia); forever.

(cherry picked from commit 26a63b81322a3bd8b9fbd43f75897c391708de2c)

4 years agocatalog: add missing @ to German catalog file
Lennart Poettering [Wed, 23 Sep 2020 11:56:51 +0000 (13:56 +0200)]
catalog: add missing @ to German catalog file

(cherry picked from commit 3142135098ed625fd79966c86338e2bbc8f134b2)

4 years agomachine: fix error code propagation in two cases
Lennart Poettering [Wed, 23 Sep 2020 08:21:27 +0000 (10:21 +0200)]
machine: fix error code propagation in two cases

(cherry picked from commit d5bc4e68987a527448ee5a00cc433fc5abec4028)

4 years agoman: sd_bus_message_new: fix typo
Roy Chen (陳彥廷) [Wed, 23 Sep 2020 09:52:22 +0000 (17:52 +0800)]
man: sd_bus_message_new: fix typo

(cherry picked from commit f280aecd38bb1a62ac02fb1033644a97993860b2)

4 years agozsh: add systemd-path completions
Ronan Pigott [Wed, 23 Sep 2020 00:52:53 +0000 (17:52 -0700)]
zsh: add systemd-path completions

(cherry picked from commit cf18af825aa4a55debcf2ed88a5b930dfbc0d23f)

4 years agohomed: in images that lack mkfs.btrfs automatically fall back to ext4
Lennart Poettering [Mon, 21 Sep 2020 15:30:03 +0000 (17:30 +0200)]
homed: in images that lack mkfs.btrfs automatically fall back to ext4

It's better to tweak suboptimal defaults than to just fail with
compiled-in defaults.

(cherry picked from commit a512e330ce3eb7150c28664e17603df2ef876a2a)

4 years agohomed: show actual file system in messages about file systems
Lennart Poettering [Mon, 21 Sep 2020 15:21:12 +0000 (17:21 +0200)]
homed: show actual file system in messages about file systems

(cherry picked from commit f2ba663ea5135419a0b69d3748975a74dbb88a87)

4 years agouser-record: don't refuse login when last pw change time is in the future
Lennart Poettering [Wed, 2 Sep 2020 14:37:42 +0000 (16:37 +0200)]
user-record: don't refuse login when last pw change time is in the future

The RTC is like just off, it's a weird system state, let's continue
without requiring pw change.

(cherry picked from commit 3e0b54867e22523cffda3b80e179df89b6d81bcd)

4 years agohomed: ignore ratelimiting counters when timestamp is from future
Lennart Poettering [Wed, 2 Sep 2020 14:36:27 +0000 (16:36 +0200)]
homed: ignore ratelimiting counters when timestamp is from future

This likely indicates that the system clock is simply wrong, hence allow
access in this case.

Fixes: #15917
(cherry picked from commit 61a29a020c5c6611a22a84c1456e8da7aa656194)

4 years agohomed: don't block logins into accounts with future change time
Lennart Poettering [Wed, 2 Sep 2020 14:35:22 +0000 (16:35 +0200)]
homed: don't block logins into accounts with future change time

This might happen if the system clock is wrong, and we should allow
access in this case (though certainly log about it).

(cherry picked from commit 51a95db6dcb720608eccaac01328b66ef7cc0d30)

4 years agounits: pass CAP_SYS_RESOURCE to homed
Lennart Poettering [Fri, 18 Sep 2020 20:01:49 +0000 (22:01 +0200)]
units: pass CAP_SYS_RESOURCE to homed

The ext4 fs resize ioctl needs CAP_SYS_RESOURCE, irritatingly. Let's
grant it to homed hence.

Fixes: #15115
(cherry picked from commit c9ef77ec5ff5e7e283181e9dcfb93acfb0656ae6)

4 years agotmpfiles: properly prefix paths in debug outputs
Lennart Poettering [Tue, 28 Jul 2020 15:53:21 +0000 (17:53 +0200)]
tmpfiles: properly prefix paths in debug outputs

This is otherwise very confusing...

(cherry picked from commit b8e35011f726925d4c1640c5b721c18f7da9bd97)

4 years agounits: order systemd-user-sessions.service after home.mount
Lennart Poettering [Thu, 6 Aug 2020 21:33:29 +0000 (23:33 +0200)]
units: order systemd-user-sessions.service after home.mount

This should make /home as automount work reasonably well.

If /home is an automount this has little effect at boot, because if the
automount is not triggered it doesn't matter how the associated mount is
ordered.

It does matter at shutdown however, where home.mount is likely active
now. There the ordering means we'll end sessions first, and only then
deactivate home.mount.

Fixes: #16291
(cherry picked from commit bbac7da2b379dfe951db23278ebe8a728ecce7a5)

4 years agoUpdate DISCOVERABLE_PARTITIONS.md
Marc Kleine-Budde [Wed, 5 Aug 2020 12:10:21 +0000 (14:10 +0200)]
Update DISCOVERABLE_PARTITIONS.md

This patch fixes a typo in the link to the systemd-id128 documentation.

(cherry picked from commit 3f449f2106b2e9335d17ebac0410f6a548345c57)

5 years agodocs: spelling fixes
Joerg Behrmann [Tue, 4 Aug 2020 09:31:44 +0000 (11:31 +0200)]
docs: spelling fixes

(cherry picked from commit c90b6abc91fdf2c7d39b886581e3b277b0e6fe5b)

5 years agodhcp6: remove assertions in dhcp6_option_parse_domainname()
Beniamino Galvani [Wed, 22 Jul 2020 03:03:47 +0000 (05:03 +0200)]
dhcp6: remove assertions in dhcp6_option_parse_domainname()

Assertions are for programming errors; here the input comes directly
from the DHCP response packet.

(cherry picked from commit af710b535b4ceacd0aecec6748a4f8ee57742e99)

5 years agodoc: Put proot under "container" section
Chris Down [Mon, 3 Aug 2020 10:35:11 +0000 (11:35 +0100)]
doc: Put proot under "container" section

Missed in #15426. Otherwise, it ends up only taking the first two rows
of the table, in no section.

(cherry picked from commit 45ba6a585321cc655ce53d22d631747961330d69)

5 years agonetwork: directly compare with in_addr element for IPv4 case
Yu Watanabe [Mon, 12 Oct 2020 00:06:28 +0000 (09:06 +0900)]
network: directly compare with in_addr element for IPv4 case

When peer address is set, address_compare() (or address_equal()) mostly
does not work in link_is_static_address_configured(), as an Address object
stored in a Link does not contain peer addresses. So, we need to also
compare with in_addr element for IPv4 case.

Fixes #17304.

(Based on 9b9c5fff16784b007f6ec313adafd29f4f737ab5)

5 years agokernel-install/90-loaderentry: fix when /boot is not mountpoint v246.6
Kir Kolyshkin [Sat, 1 Aug 2020 02:24:15 +0000 (19:24 -0700)]
kernel-install/90-loaderentry: fix when /boot is not mountpoint

I happen to have a machine where /boot is not a separate mountpoint,
but rather just a directory under /. After upgrade to recent Fedora,
I found out that grub2 can't find any new kernels.

This happens because loadentry script generates kernel and initrd file
paths relative to /boot, while grub2 expects path to be relative to the
root of filesystem on which they are residing.

This commit fixes this issue by using stat's %m to find the mount point
of a partition holding the images, and using it as a prefix to be
removed from ENTRY_DIR_ABS.

Note that %m for stat requires coreutils 8.6, released in Oct 2010.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 1cdbff1c844ce46f1d84d8feeed426ebfd550988)

5 years agohomed: make clean that --storage=directory --image-path=/dev/some-block-device is...
Lennart Poettering [Fri, 18 Sep 2020 17:37:05 +0000 (19:37 +0200)]
homed: make clean that --storage=directory --image-path=/dev/some-block-device is not supported

The directory backend needs a file system path, and not a raw block
device. That's only supported for the LUKS2 backend.

Let's make this clearer in the man page and also generate a better error
message if attempted anyway.

Fixes: #17068
(cherry picked from commit f9d525ae558105bf7fd77ad76e4fdb135bb9f634)

5 years agohomed: make sure our worker processes finish before we exit
Lennart Poettering [Fri, 18 Sep 2020 16:53:12 +0000 (18:53 +0200)]
homed: make sure our worker processes finish before we exit

When exiting, let's explicitly wait for our worker processes to finish
first. That's useful if unmounting of /home/ is scheduled to happen
right after homed is down, as we then can be sure that the home
directories are properly unmounted and detached by the time homed is
fully terminated (otherwise it might happen that our worker gets killed
by the service manager, thus leaving the home directory and its backing
devices up/left for auto-clean which might be async).

Likely fixes #16842

(cherry picked from commit 9796a9fbad5bae4d66bb40d848f6245d1ee327d8)

5 years agonspawn: fix fd leak on failure path
Lennart Poettering [Wed, 16 Sep 2020 20:16:10 +0000 (22:16 +0200)]
nspawn: fix fd leak on failure path

(cherry picked from commit 2fef50cd9eee59cea6145639f6bd464939fac624)

5 years agonspawn: check return of setsid()
Lennart Poettering [Wed, 16 Sep 2020 20:11:48 +0000 (22:11 +0200)]
nspawn: check return of setsid()

Let's verify that everything works the way we expect it to work, hence
check setsid() return code.

(cherry picked from commit efe426624046089b74b70708e61f304f3cd414a7)

5 years agodissect: is_loop_device() returns negative on error, don't mistake that is true
Lennart Poettering [Thu, 17 Sep 2020 15:24:33 +0000 (17:24 +0200)]
dissect: is_loop_device() returns negative on error, don't mistake that is true

(cherry picked from commit 3afda7c7976c25db786948a961873fa5c2c8e0e9)

5 years agodissect: always invalidate secondary arch partitions if we found primary arch
Lennart Poettering [Thu, 17 Sep 2020 15:32:34 +0000 (17:32 +0200)]
dissect: always invalidate secondary arch partitions if we found primary arch

Let's suppress the secondary arch data, since we never ever want to
mount it if we found the primary arch.

Previously we only suppressed in the Verity case, but there's little
reason to entertain the idea of a secondary arch in non-Verity
environments either, we are not going to use them, and should not do
decryption or anything like that.

(cherry picked from commit 74cb2db9f403dfe17cabc6dac48b0f49a84eb03f)

5 years agoutil: wireguard is merged into upstream kernel
Yu Watanabe [Thu, 17 Sep 2020 05:49:47 +0000 (14:49 +0900)]
util: wireguard is merged into upstream kernel

(cherry picked from commit e29e5db7dff1442ef73cbcd0c898e11078e1042d)

5 years agorepart: don't mark image files generated with --empty=create executable
Lennart Poettering [Wed, 16 Sep 2020 15:51:25 +0000 (17:51 +0200)]
repart: don't mark image files generated with --empty=create executable

(cherry picked from commit 5332d7c6ff3c56340c7477e1e7604f61092a2868)

5 years agoman: substitute path to rc.local in the man page
Zbigniew Jędrzejewski-Szmek [Tue, 15 Sep 2020 15:56:32 +0000 (17:56 +0200)]
man: substitute path to rc.local in the man page

Different systems use different paths for it and users are confused when the
man page has a path different than the one on the local system.

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

5 years agomeson: RC_LOCAL_SCRIPT_PATH_START to RC_LOCAL_PATH
Zbigniew Jędrzejewski-Szmek [Tue, 15 Sep 2020 15:44:26 +0000 (17:44 +0200)]
meson: RC_LOCAL_SCRIPT_PATH_START to RC_LOCAL_PATH

RC_LOCAL_SCRIPT_PATH_START and RC_LOCAL_SCRIPT_PATH_STOP were was originally
added in the conversion to meson based on the autotools name. In
44508946534eee032927c263b79464832656dd6e RC_LOCAL_SCRIPT_PATH_STOP was dropped.
We don't need to use such a long name.

(cherry picked from commit 452d2dfd52f1cc686395663a6cd4c778306bd309)

5 years agosocket-proxy: allow localhost addresses
Zbigniew Jędrzejewski-Szmek [Tue, 15 Sep 2020 12:52:47 +0000 (14:52 +0200)]
socket-proxy: allow localhost addresses

With this change, only manager_connect() in timesync.d uses AI_ADDRCONFIG. There
we are connecting to a remove server, so the flag is appropriate.

(cherry picked from commit 7e5f1d4b3fb02075762a55063edf9e510142e4c9)

5 years agosd-bus: allow localhost addresses
Zbigniew Jędrzejewski-Szmek [Tue, 15 Sep 2020 12:49:36 +0000 (14:49 +0200)]
sd-bus: allow localhost addresses

By settings AI_ADDRCONFIG in hints we cannot for example resolve "localhost"
when the local machine only has a loopback interface. This seems like an
unnecessary restriction, drop it.

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1839007.

(cherry picked from commit d0e5db44d9e1cf61ca75c8a86ffed19cc1b7fe5f)

5 years agofstab-generator: add 'nofail' when NFS 'bg' option is used
Franck Bui [Tue, 15 Sep 2020 09:49:09 +0000 (11:49 +0200)]
fstab-generator: add 'nofail' when  NFS 'bg' option is used

Otherwise a 'Before=remote-fs.target' dependency is added to the mount unit
which defeats the purpose of 'bg' option.

(cherry picked from commit e66d2eeeeb4332ca94aeb62e95ec76f1f17ee9b7)

5 years agobusctl: add missing shortopt -l
Juergen Hoetzel [Tue, 15 Sep 2020 06:09:51 +0000 (08:09 +0200)]
busctl: add missing shortopt -l

(cherry picked from commit 150c430fd499082164b6ddbd2f501e2333261a78)

5 years agosocket-util: reset length argument for second getsockopt call in fd_[gs]et_rcvbuf
Christian Göttsche [Mon, 14 Sep 2020 17:40:42 +0000 (19:40 +0200)]
socket-util: reset length argument for second getsockopt call in fd_[gs]et_rcvbuf

In case the first getsockopt() call changes the value.

(cherry picked from commit 67f5ae2d6986d0271fa6223a68fe0104957de863)

5 years agotest: use pclose() for popen()
Zbigniew Jędrzejewski-Szmek [Mon, 14 Sep 2020 20:32:52 +0000 (22:32 +0200)]
test: use pclose() for popen()

Coverity CID#1432701.

(cherry picked from commit 649bde89caccdb1187ac744bd76051fdcd687218)

5 years agocore: propagate unit start limit hit state to triggering path unit
Lennart Poettering [Fri, 11 Sep 2020 17:57:09 +0000 (19:57 +0200)]
core: propagate unit start limit hit state to triggering path unit

We already do this for socket and automount units, do it for path units
too: if the triggered service keeps hitting the start limit, then fail
the triggering unit too, so that we don#t busy loop forever.

(Note that this leaves only timer units out in the cold for this kind of
protection, but it shouldn't matter there, as they are naturally
protected against busy loops: they are scheduled by time anyway).

Fixes: #16669
(cherry picked from commit 47ab8f73e3468b6e5a48218eacdb830e978d2cfd)

5 years agocore: propagate triggered unit in more load states
Lennart Poettering [Fri, 11 Sep 2020 17:49:33 +0000 (19:49 +0200)]
core: propagate triggered unit in more load states

In 4c2ef3276735ad9f7fccf33f5bdcbe7d8751e7ec we enabled propagating
triggered unit state to the triggering unit for service units in more
load states, so that we don't accidentally stop tracking state
correctly.

Do the same for our other triggering unit states: automounts, paths, and
timers.

Also, make this an assertion rather than a simple test. After all it
should never happen that we get called for half-loaded units or units of
the wrong type. The load routines should already have made this
impossible.

(cherry picked from commit 0377cd2936ae5cac0c9d76a4b58889f121c097c4)

5 years agobootctl: handle if LoaderSystemToken is invalid for some reason
Lennart Poettering [Mon, 14 Sep 2020 10:35:19 +0000 (12:35 +0200)]
bootctl: handle if LoaderSystemToken is invalid for some reason

This points to some firmware issue, but we should still be able to
correct things if this happens. Hence log about this and fix it.

Fixes: #17041
(cherry picked from commit ad0b610b0c1c2595c32b6235e7ac5ad7fba6e0aa)

5 years agotest-fileio: test test strings with shell, too
Lennart Poettering [Fri, 11 Sep 2020 15:43:05 +0000 (17:43 +0200)]
test-fileio: test test strings with shell, too

(cherry picked from commit df8b14b59119c61f660037710bbb3899db441ef7)

5 years agotest-env-file: add test that tests our env file read + writer + shell against each...
Lennart Poettering [Fri, 11 Sep 2020 13:18:07 +0000 (15:18 +0200)]
test-env-file: add test that tests our env file read + writer + shell against each other

Should hopefully make regressions on this unlikely.

(cherry picked from commit 55f99c26c678b4bf4fb697a57d540b0266aa3f49)

5 years agoenv-file: bring our decoding of double-quoted strings in env files in line with shell
Lennart Poettering [Fri, 11 Sep 2020 13:14:03 +0000 (15:14 +0200)]
env-file: bring our decoding of double-quoted strings in env files in line with shell

In shell, inside of double quotes only a select few chars should be
escaped. If other chars are escaped this has no effect. Correct the list
of chars that need such escaping.

Also, make sure we can read back the stuff we wrote out without loss.

Fixes: #16788
(cherry picked from commit de008e537dc6e3504f988fa9bd358f783016df8a)

5 years agotest-fileio: use test strings that are actually valid in shell
Lennart Poettering [Fri, 11 Sep 2020 15:42:46 +0000 (17:42 +0200)]
test-fileio: use test strings that are actually valid in shell

(cherry picked from commit 6fe3196350fdb8715aabd315f8252c307da6661c)

5 years agoman: document that RemainAfterElapse=no means that also the triggered unit needs...
Lennart Poettering [Thu, 10 Sep 2020 17:08:45 +0000 (19:08 +0200)]
man: document that RemainAfterElapse=no means that also the triggered unit needs to deactivate

Fixes: #16378
(cherry picked from commit 415f8a5bfed4604e4a1bc275682d51af3ad3b611)

5 years agosd-path: use ROOTPREFIX without suffixed slash v246.5
Lennart Poettering [Thu, 10 Sep 2020 16:20:05 +0000 (18:20 +0200)]
sd-path: use ROOTPREFIX without suffixed slash

We already have rootprefix_noslash as meson variable, export it so that
we can also use it in C code.

Fixes: #16773
(cherry picked from commit b612c26ceb9f56af0271fc9f07c1724d2d260a8a)

5 years agohashmap: make sure to initialize shared hash key atomically
Lennart Poettering [Fri, 11 Sep 2020 22:09:07 +0000 (00:09 +0200)]
hashmap: make sure to initialize shared hash key atomically

if we allocate a bunch of hash tables all at the same time, with none
earlier than the other, there's a good chance we'll initialize the
shared hash key multiple times, so that some threads will see a
different shared hash key than others.

Let's fix that, and make sure really everyone sees the same hash key.

Fixes: #17007
(cherry picked from commit ae0b700a856c0ae460d271bb50dccfaae84dbcab)