Lennart Poettering [Wed, 27 Oct 2021 21:17:50 +0000 (23:17 +0200)]
scope: refuse activation of scopes if no PIDs to add are left
If all processes we are supposed to add are gone by the time we are
ready to do so, let's fail.
THis is heavily based on Cunlong Li's work, who thankfully tracked this
down.
Replaces: #20577
(cherry picked from commit
8d3e4ac7cd37200d1431411a4b98925a24b7d9b3)
(cherry picked from commit
7ecb1b82d9b55a081d81b2802695fd21293ce029)
Lennart Poettering [Wed, 27 Oct 2021 21:08:58 +0000 (23:08 +0200)]
core: normalize 'r' variable handling in unit_attach_pids_to_cgroup() a bit
The 'r' variable is our "go-to" variable for error return codes, all
across our codebase. In unit_attach_pids_to_cgroup() it was so far used
in a strange way for most of the function: instead of directly storing
the error codes of functions we call we'd store it in a local variable
'q' instead, and propagate it to 'r' only in some cases finally we'd
return the ultimate result of 'r'.
Let's normalize this a bit: let's always store error return values in
'r', and then use 'ret' as the variable to sometimes propagate errors
to, and then return that.
This also allows us to get rid of one local variable.
No actual codeflow changes, just some renaming of variables that allows
us to remove one.
(cherry picked from commit
db4229d12f48663400802171b336c7cadbbe04ef)
(cherry picked from commit
84ec6a0043f7a447157753fb12e991ebce6e14b7)
Lennart Poettering [Thu, 28 Oct 2021 09:05:22 +0000 (11:05 +0200)]
man: document that daemons can close fds they receive via sd_listen_fds() if they like
Fixes: #18872
(cherry picked from commit
c896eb7ad65f4dbe968fdf01fa51e9ef4d2d11ed)
(cherry picked from commit
04e07e55723a92bfc0cd4e84482cbef96604e706)
Lennart Poettering [Thu, 28 Oct 2021 08:53:55 +0000 (10:53 +0200)]
man: document how nss-resolve and systemd-resolved communicate
Fixes: #20925
(cherry picked from commit
1d697549887d68953058049fcd833fa93a74402a)
(cherry picked from commit
65aca93f2c64155b029388a69a768c37f0614e93)
Lennart Poettering [Thu, 28 Oct 2021 08:45:02 +0000 (10:45 +0200)]
man: clarify the situation of unit templates regarding "systemctl list-units" + "systemctl list-unit-files"
Fixes: #21075
(cherry picked from commit
7ea5e82f6ac78704f1554be9040b84bac75c2ec1)
(cherry picked from commit
37ade0494a2ca154b107b79766d45f242eacb1cf)
Yu Watanabe [Sat, 23 Oct 2021 15:16:57 +0000 (00:16 +0900)]
test: do not use alloca() in function call
(cherry picked from commit
4150584e63562616e16242f7b1016c0e642fb59e)
(cherry picked from commit
5f326b0388d4b0a7fcab8cedca255e93a6e311f4)
Bastien Nocera [Tue, 26 Oct 2021 09:57:30 +0000 (11:57 +0200)]
hwdb: Allow console users access to media* nodes
Newer webcams and video devices have controls only available through
/dev/media* nodes. Make sure they're accessible in the same way as
/dev/video* nodes.
Closes: #21054
(cherry picked from commit
63fbfc598f9f6d3ce34cc00a7687089dab24daff)
(cherry picked from commit
920d0d1b14dfb94788a5b2794860cac583b982c3)
Greg Zuro [Wed, 27 Oct 2021 04:02:37 +0000 (21:02 -0700)]
change indicator used for later versions of VirtualBox (#21127)
Detection of VirtualBox is accomplished in the existing code by *either* `innotek GmbH`
or `Oracle Corporation` existing in any of:
- /sys/class/dmi/id/product_name
- /sys/class/dmi/id/sys_vendor
- /sys/class/dmi/id/board_vendor
- /sys/class/dmi/id/bios_vendor
With Oracle's physical servers, both `/sys/class/dmi/id/sys_vendor` and
`/sys/class/dmi/id/board_vendor` contain `Oracle Corporation`, so those
servers are detected as `oracle` (VirtualBox).
VirtualBox has the following values in the latest versions:
- /sys/class/dmi/id/product_name: `VirtualBox`
- /sys/class/dmi/id/sys_vendor: `innotek GmbH`
- /sys/class/dmi/id/board_vendor: `Oracle Corporation`
- /sys/class/dmi/id/bios_vendor: `innotek GmbH`
Presumably the existing check for `innotek GmbH` is meant to detect
older versions of VirtualBox, while changing the second checked value
from `Oracle Corporation` to `VirtualBox` will reliably detect later and future
versions.
(cherry picked from commit
cfee6b955154c30be31ffcf0e3b7b89374a52fff)
(cherry picked from commit
7459b7f4a63de87a6e76e9187893c65291b7931f)
Lennart Poettering [Tue, 26 Oct 2021 13:45:49 +0000 (15:45 +0200)]
json: do something remotely reasonable when we see NaN/infinity
JSON doesn't have NaN/infinity/-infinity concepts in the spec.
Implementations vary what they do with it. JSON5 + Python simply
generate special words "NAN" and "Inifinity" from it. Others generate
"null" for it.
At this point we never actually want to output this, so let's be
conservative and generate RFC compliant JSON, i.e. convert to null.
One day should JSON5 actually become a thing we can revisit this, but in
that case we should implement things via a flag, and only optinally
process nan/infinity/-infinity.
This patch is extremely simple: whenever accepting a
nan/infinity/-infinity from outside it converts it to NULL. I.e. we
convert on input, not output.
(cherry picked from commit
8f1daefce6e952f2fad9510e5101b5fc675d363f)
(cherry picked from commit
06444b314b863facdb173f10f2d1ff11196755d2)
Lennart Poettering [Thu, 21 Oct 2021 16:07:06 +0000 (18:07 +0200)]
stat-util: specify O_DIRECTORY when reopening dir in dir_is_empty_at()
That way we can fail earlier if the specified fd is not actually a
directory.
(Also, it's not exactly according to standards to open things without
either O_RDONLY/O_RDWR...)
(cherry picked from commit
b9d06522631a22d242374dc44a74c3b6459e3cb3)
(cherry picked from commit
e1e32516f98a1f39ce763545de9a8664526d0b8a)
Lennart Poettering [Thu, 21 Oct 2021 15:29:48 +0000 (17:29 +0200)]
varlink: disconnect varlink link in one more case
Previously we'd possibly see POLLHUP on a varlink link, and continue to
run epoll on it even though we have nothing to read nor write anymore.
Let's fix that, and once we know that there's nothing to write anymore
(or we saw a write error already) we'll disconnect after POLLHUP.
Fixes: #20062
(cherry picked from commit
7c26a631ad8bf91016db156b7d299ca68fd7866e)
(cherry picked from commit
968f2f3f5a76b05142e1de447bb79f4f97868721)
Yu Watanabe [Fri, 15 Oct 2021 01:06:25 +0000 (10:06 +0900)]
network: route: fix possible overflow in conversion usec_t -> uint32_t
(cherry picked from commit
ff43dddab7260c9220eaea2a545514772c0e581f)
(cherry picked from commit
7a9b38919302e98cebc2c6233fd09d0c07ae41dc)
Vincent Bernat [Mon, 18 Oct 2021 18:58:43 +0000 (20:58 +0200)]
utmp: remove /dev from line
utmp(5) says `ut_line` is the device name minus the leading "/dev/". Therefore,
remove it. Without that, when using UtmpMode=user, we get `/dev/tty` in the
output of `last`/`w`.
(cherry picked from commit
33331d116db2eaf1189ea56ee4b36540179ac3dd)
(cherry picked from commit
09534e85b5c51c664077637e7e8c7c68dec52972)
Lennart Poettering [Fri, 15 Oct 2021 15:58:13 +0000 (17:58 +0200)]
homed,shutdown: call valgrind magic after LOOP_GET_STATUS64
valgrind doesn't understand LOOP_GET_STATUS64. We already work around
this in various placed, via VALGRIND_MAKE_MEM_DEFINE(), but we forgot
three places. Let's fix that.
(cherry picked from commit
48f462547d63e1d03bee612e1c77073263e71293)
(cherry picked from commit
bf6bd21f7c887ffa4591ed0cee00b234835ca2be)
Yu Watanabe [Fri, 15 Oct 2021 20:04:26 +0000 (05:04 +0900)]
userdb: fix type to pass to connect()
Fixes https://github.com/systemd/systemd/pull/20613#issuecomment-
944621275.
(cherry picked from commit
c14e57356f1e82c35bf3a3e8aaeac134b545801b)
(cherry picked from commit
667eab61d4c5520d7875de5df489ec68a4c9f123)
Tony Asleson [Wed, 13 Oct 2021 19:18:12 +0000 (14:18 -0500)]
dm-verity: Remove usage of integrity
There is a difference between dm-verity and dm-integrity. Remove
usage of integrity from verity documentation in man pages and
target files.
(cherry picked from commit
9a2a6ec4e31abe4b58b140767a82200f79c8645f)
(cherry picked from commit
884f5b748a5434946d4c9fbe39ba2c88371e0071)
Lennart Poettering [Fri, 15 Oct 2021 09:23:00 +0000 (11:23 +0200)]
homework: don't bother with BLKRRPART on images that aren't block devices
We currently call this ioctl even if we are backed by a regular file,
which is actually the common case. While this doesn't really hurt, it
does result in very confusing logs.
(cherry picked from commit
6a1301d8c97dc650e4355bb7c193f5821b3383a8)
(cherry picked from commit
7b3ff9a957630535ec58aeca7e41e6c63fa99114)
Lennart Poettering [Thu, 14 Oct 2021 13:40:59 +0000 (15:40 +0200)]
homework: fix incorrect error variable use
(cherry picked from commit
82fb0911fc0aa2aaf39428ef36e78898ece2b4ea)
(cherry picked from commit
3e9dbda7d5efbe642e6254cc086b4cf54c862618)
Lennart Poettering [Thu, 19 Aug 2021 16:12:56 +0000 (18:12 +0200)]
import: turn off weird protocols in curl
Let's lock things down a bit and now allow curl's weirder protocols to
be used with our use. i.e. stick to http:// + https:// + file:// and
turn everything else off. (Gopher!)
This is cde that interfaces with the network after all, and we better
shouldn't support protocols needlessly that are much less tested.
(Given that HTTP redirects (and other redirects) exist, this should give
us a security benefit, since we will then be sure that noone can forward
us to a weird protocol, which we never tested, and other people test
neither)
(cherry picked from commit
55b90ee00b78a449c8f187a5e8141f8ccb100bf4)
(cherry picked from commit
4d8fd88b9641fce81272f60f556543f713175403)
Daan De Meyer [Thu, 19 Aug 2021 12:37:41 +0000 (13:37 +0100)]
link: Stop prefixing features with "the"
(cherry picked from commit
f20710c74c08bf69472f62c886e5bdd5e38c87a5)
(cherry picked from commit
08c7dfd68e9d79edf4e9cfe405d7f234bcd12324)
Alfonso Sánchez-Beato [Thu, 19 Aug 2021 10:21:12 +0000 (12:21 +0200)]
src/boot/efi/linux: fix linux_exec prototype
Callers to linux_exec() are actually passing an EFI_HANDLE, not a pointer to
it. linux_efi_handover(), which is called by linux_exec(), also expects an
EFI_HANDLE.
(cherry picked from commit
d48f9174cf211a235193963a06b3d28537fc6529)
(cherry picked from commit
a825ced57fa8533ba54fec4c4476400e122ddbc3)
Lennart Poettering [Wed, 18 Aug 2021 20:41:08 +0000 (22:41 +0200)]
discover-image: pass the right fd to fd_getcrtime()
(cherry picked from commit
12a7f04a2b9135a4751dba71e2f688525d7c93e7)
(cherry picked from commit
64b025686f36ae4385811be6f81d5f7d94da3437)
Yu Watanabe [Tue, 17 Aug 2021 14:13:07 +0000 (23:13 +0900)]
shell-completion: add missing uevent actions for udevadm
(cherry picked from commit
74614801f6bd33dfb2c051fa6b6d7c899c695cf6)
(cherry picked from commit
0750673e02562f6c91f6875e99cc9163a05a5116)
Geass-LL [Fri, 2 Apr 2021 03:27:59 +0000 (11:27 +0800)]
unit: coldplug both job and nop_job if possible
Sometimes, both job and nop_job are deserialized. In this case,
if we only cold plug the job, the nop_job will also stuck in the
job list.
(cherry picked from commit
7dbd330c7ef28852db0fb044503ed6f072477d50)
(cherry picked from commit
213ae9db6274227636fdca6731511499ed933e61)
Tom Yan [Mon, 16 Aug 2021 10:00:42 +0000 (18:00 +0800)]
network: allow users to forbid passthru MACVLAN from putting its link into promiscuous mode
While we haven't implemented a key for users to set MACVLAN/MACVTAP flags,
we can at least allow them to make use of the Promiscuous= key of
the corresponding link to set the nopromisc flag.
(cherry picked from commit
17a6a4ae2e7104a1105a0cef0ba049799f3ef6bc)
(cherry picked from commit
1d1b7de63902e5fa8d1ba900e9bf608e2ccd2b23)
Milo Turner [Fri, 13 Aug 2021 14:28:58 +0000 (10:28 -0400)]
Don't open /var journals in volatile mode when runtime_journal==NULL
(cherry picked from commit
d64441b669932ab97fbbfc71cb143045f690039e)
(cherry picked from commit
00e7f0994a39852ab1adabfb7e19ff2634e916a0)
Steven Siloti [Sun, 11 Jul 2021 18:05:26 +0000 (11:05 -0700)]
resolved: retry on SERVFAIL before downgrading feature level
The SERVFAIL RCODE can be generated for many reasons which may not be related
to lack of feature support. For example, the Stubby resolver generates
SERVFAIL when a request times out. Such transient failures can cause
unnecessary downgrades to both the transaction and the server's feature level.
The consequences of this are especially severe if the server is in DNSSEC
strict mode. In this case repeated downgrades eventually cause the server to
stop resolving entirely with the error "incompatible-server".
To avoid unnecessary downgrades the request should be retried once with the
current level before the transaction's feature level is downgraded.
(cherry picked from commit
8a33aa199dc1cea14494469ac9d7d08dc6721df1)
(cherry picked from commit
8280bec34df8e35592f4a4a549127471a9199231)
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Rework console input handling
Fixes: #15847
Probably fixes: #19191
(cherry picked from commit
e98d271e57f3d0356e444b6ea2d48836ee2769b0)
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Fix possible null pointer dereference
Auto entries are showing garbage for the version in print_status()
because StrDuplicate does not expect null pointers.
(cherry picked from commit
b52fafb26d90b77cfc259fcbdab3c95a571bacb1)
(cherry picked from commit
872d101c2308e07c523fd6ca84bd774447f05b7e)
Jan Janssen [Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)]
sd-boot: Unify error handling
log_error_stall() and log_error_status_stall() will ensure the user has
a chance to catch an error message by stalling and also forcing a
lightred/black color on it. Also, convert several Print() calls to it
since they are actually error messages.
(cherry picked from commit
8aba0eec499b762657f528988c2f093ac490620d)
longpanda [Thu, 5 Aug 2021 01:31:44 +0000 (09:31 +0800)]
Fix the "Failed to open random seed ..." message.
When boot ArchLinux from Ventoy, it always print `Failed to open random seed file: write protected.`
As Ventoy emulate the ISO file as a read-only CDROM, I didn't test with a real physical CDROM drive, but maybe it also has such problem.
As we use `EFI_FILE_MODE_WRITE` to open the `loader\random-seed` file, so I think it's better to check the result with both `EFI_WRITE_PROTECTED` and `EFI_NOT_FOUND`.
(cherry picked from commit
2846007ecfb1fc84005b942167d394294c707d7b)
(cherry picked from commit
c1b4ee2e0fd28a0c802a3694107613e1689d1c96)
Yu Watanabe [Wed, 22 Sep 2021 07:35:56 +0000 (10:35 +0300)]
sd-dhcp6-client: ignore IAs whose IAID do not match client's IAID
But do not refuse whole message.
(cherry picked from commit
469fd57f181e2a8d93f01662418ca998e1239ea5)
Zbigniew Jędrzejewski-Szmek [Tue, 12 Oct 2021 17:46:25 +0000 (19:46 +0200)]
coredumpctl: stop truncating information about coredump
With the changes to limit that print 'Found module …' over and over, we were
hitting the journal field message limit, effectively truncating the info output.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
1998488.
(cherry picked from commit
384c6207669eb0d92aa0043dbc01957c6c7ff41e)
(cherry picked from commit
473627e1c9fcdf8f819ced2bb79cb7e9ff598b0c)
Zbigniew Jędrzejewski-Szmek [Wed, 13 Oct 2021 09:17:33 +0000 (11:17 +0200)]
Revert "core: Check unit start rate limiting earlier"
This reverts commit
1f77dbfaaedcb8bdecc6610fa96f7fed80bfb8d8.
This was causing problems during boot, see
https://bodhi.fedoraproject.org/updates/FEDORA-2021-
a1a52487e6,
https://bugzilla.redhat.com/show_bug.cgi?id=
2013386.
Lennart Poettering [Mon, 11 Oct 2021 11:56:22 +0000 (13:56 +0200)]
localed: use PROJECT_FILE rather than __FILE__ for logging
All our log.h code uses PROJECT_FILE for this, let's hence use it here
too.
(cherry picked from commit
11c8b1f1031d368358286f4bb26abebd73cd2868)
(cherry picked from commit
00b0393e65252bf631670604f58b844780b08c50)
Daan De Meyer [Wed, 6 Oct 2021 12:20:36 +0000 (13:20 +0100)]
coredump: Don't log an error if D-Bus isn't running
coredumpctl could be used in a chroot where D-Bus isn't running. If
that's the case, we shouldn't consider it an error if we can't connect
to the D-Bus daemon so let's reduce the severity of the error we log
when we can't connect to D-Bus because the socket doesn't exist.
(cherry picked from commit
414bd2e786f9912f51b82e5fe4a1126179a5652a)
(cherry picked from commit
6745eaa6308b835e2c5e68d49e9bece29fd37fa2)
Yu Watanabe [Tue, 5 Oct 2021 15:19:41 +0000 (00:19 +0900)]
core/service: also check path in exec commands
(cherry picked from commit
8688a389cabdff61efe187bb85cc1776de03c460)
(cherry picked from commit
b3978cf401306a793c7531299a5e9b3c63e53a27)
Henri Chain [Tue, 5 Oct 2021 11:10:31 +0000 (13:10 +0200)]
core: fix SIGABRT on empty exec command argv
This verifies that the argv part of any exec_command parameters that
are sent through dbus is not empty at deserialization time.
There is an additional check in service.c service_verify() that again
checks if all exec_commands are correctly populated, after the service
has been loaded, whether through dbus or otherwise.
Fixes #20933.
(cherry picked from commit
29500cf8c47e6eb0518d171d62aa8213020c9152)
(cherry picked from commit
7a58bf7aac8b2c812ee0531b0cc426e0067edd35)
Lennart Poettering [Tue, 5 Oct 2021 16:24:05 +0000 (18:24 +0200)]
user-record: disable two pbkdf fields that don't apply for pkbdf2
Fixes: #20830
(cherry picked from commit
8b4f88d13681c6dec839de06c668d32374d44724)
(cherry picked from commit
5ee578fd13809e08fbda1a9bca2256ffd24e9857)
Andrew Soutar [Wed, 6 Oct 2021 02:55:27 +0000 (22:55 -0400)]
basic/env-util: correctly parse extended vars after non-extended vars (#20941)
(cherry picked from commit
5ef97a712236f0ddddec52665c0aea7d4e6d3c13)
(cherry picked from commit
74583cad5a3bf4051b879b8b1ac53934027ef485)
Lennart Poettering [Tue, 5 Oct 2021 12:10:27 +0000 (14:10 +0200)]
repart: use right error variable
(cherry picked from commit
8ac04a65477b59c9143b635c0c0daa5152d9b466)
(cherry picked from commit
b57f76bff912de738a8da8feceb298160bebab26)
Egor [Sun, 3 Oct 2021 00:42:50 +0000 (03:42 +0300)]
sleep: don't skip resume device with low priority/available space
this fixes hibernation when there's a higher priority swap preceding
the resume swap in /proc/swaps.
fixes #19486
(cherry picked from commit
936a7cb66a0b423e75ceef87f02537067ad17002)
(cherry picked from commit
20c776c5e92201e01d4bfbea4ecbc4df758bcf09)
Franck Bui [Thu, 30 Sep 2021 12:05:36 +0000 (14:05 +0200)]
mount-util: fix fd_is_mount_point() when both the parent and directory are network fs
The second call to name_to_handle_at_loop() didn't check for the specific
errors that can happen when the parent dir is mounted by nfs and instead of
falling back like it's done for the child dir, fd_is_mount_point() failed in
this case.
(cherry picked from commit
964ccab8286a7e75d7e9107f574f5cb23752bd5d)
(cherry picked from commit
8de173ff933510200ac3db77f1ae713f2c4acdc3)
Benjamin Berg [Fri, 24 Sep 2021 11:35:34 +0000 (13:35 +0200)]
test: Add failing/non-failing syscall filter test setting architecture
This adds a high level test verifying that syscall filtering in
combination with a simple architecture filter for the "native"
architecture works fine.
(cherry picked from commit
e975a94559900f47a3a5cc333682992616877a67)
(cherry picked from commit
663e750998c78d81a758be860148dfe433669c88)
Benjamin Berg [Fri, 17 Sep 2021 12:00:39 +0000 (14:00 +0200)]
test: Check that "native" architecture is always filtered
(cherry picked from commit
08bf703cc1511817cdf67543c3b166dc8831ba8c)
(cherry picked from commit
ef92d7fc97a543d2b7e0730f2b78d8ef2a91959c)
Benjamin Berg [Fri, 17 Sep 2021 11:05:32 +0000 (13:05 +0200)]
seccomp: Always install filters for native architecture
The commit
6597686865ff ("seccomp: don't install filters for archs that
can't use syscalls") introduced a regression where filters may not be
installed for the "native" architecture. This means that setting
SystemCallArchitectures=native for a unit effectively disables the
SystemCallFilter= and SystemCallLog= options.
Conceptually, we have two filter stages:
1. architecture used for syscall (SystemCallArchitectures=)
2. syscall + architecture combination (SystemCallFilter=)
The above commit tried to optimize the filter generation by skipping the
second level filtering when it is not required.
However, systemd will never fully block the "native" architecture using
the first level filter. This makes the code a lot simpler, as systemd
can execve() the target binary using its own architecture. And, it
should be perfectly fine as the "native" architecture will always be the
one with the most restrictive seccomp filtering.
Said differently, the bug arises because (on x86_64):
1. x86_64 is permitted by libseccomp already
2. native != x86_64
3. the loop wants to block x86_64 because the permitted set only
contains "native" (i.e. "native" != "x86_64")
4. x86_64 is marked as blocked in seccomp_local_archs
Thereby we have an inconsistency, where it is marked as blocked in the
seccomp_local_archs array but it is allowed by libseccomp. i.e. we will
skip generating filter stage 2 without having stage 1 in place.
The fix is simple, we just skip the native architecture when looping
seccomp_local_archs. This way the inconsistency cannot happen.
(cherry picked from commit
f833df38488ea40fc3d601ccefd64cfa3fce8bb4)
(cherry picked from commit
ba8bce7b562f9ef83a4de697eae2f97cf1806e3d)
Lennart Poettering [Wed, 2 Jun 2021 19:38:44 +0000 (21:38 +0200)]
test-seccomp: tighten privilege check before seccomp()
geteuid() without CAP_SYS_ADMIN is not enough to do unrestricted
seccomp(). Hence tighten the check.
See: #19746
(cherry picked from commit
6da5d7de78dd6b98d42cbe177975887907ea6dc2)
Michael Biebl [Thu, 30 Sep 2021 23:00:28 +0000 (01:00 +0200)]
networkd-test: fix resolved_domain_restricted_dns
megasearch.net was meant to be a non-existing bogus domain, and had been
for a long time. But it seems some domain grabber recently registered
it, and it's an actual thing now:
$ host megasearch.net
megasearch.net has address 207.148.248.143
This causes the test to fail randomly.
Use search.example.com instead which yields
$ host search.example.com
Host search.example.com not found: 3(NXDOMAIN)
Fixes: #18357
(cherry picked from commit
528dd6a42389fcf4aa490c0fa0d858772e930d13)
(cherry picked from commit
974f94103908fd7f3221fb4e6fe9a590c35fc6f2)
Yu Watanabe [Sun, 29 Aug 2021 12:20:43 +0000 (21:20 +0900)]
core/mount: add implicit unit dependencies even if when mount unit is generated from /proc/self/mountinfo
Hopefully fixes #20566.
(cherry picked from commit
aebff2e7ce209fc2d75b894a3ae8b80f6f36ec11)
(cherry picked from commit
1bb8af46d1181a407cbc858025b85392f3af7812)
Hans de Goede [Tue, 31 Aug 2021 13:49:33 +0000 (15:49 +0200)]
hwdb: sensors: Fix some modalias matches no longer working with newer kernels
Kernels >= 5.8 have added new fields to the dmi/id/modalias file in the
middle of the modalias (instead of adding them at the end).
Specifically new ":br<value>:" and (optional) ":efr<value>:" fields have
been added between the ":bd<value>:" and ":svn<value>:" fields.
Note the 5.13.0 and 5.14.0 kernels also added a new ":sku<value>:" field
between the ":pvr<value>:" and ":rvn<value>:" fields, this has been fixed
in later 5.13.y and 5.14.y releases, by moving the sku field to the end:
https://lore.kernel.org/lkml/
20210831130508.14511-1-hdegoede@redhat.com/
Unfortunately the same cannot be done for the new br and efr fields since
those have been added more then a year ago and hwdb even already has some
newer entries relying on the new br field being there (and thus not working
with older kernels).
Fix the issue with the br and efr fields through the following changes:
1. Replace any matches on ":br<value>" from newer entries with an '*'
2. Replace "bd<value>:svn<value>" matches with: "bd<value>:*svn<value>"
inserting an '*' where newer kernels will have the new br + efr fields
This makes these matches working with old as well as new kernels.
Link: https://github.com/systemd/systemd/issues/20550
Link: https://github.com/systemd/systemd/pull/20562
(cherry picked from commit
f81351554285f1d4869fe842659b72797edfc899)
(cherry picked from commit
52c9bc1c449ecdadc4e98f0519799c80cb3a4463)
Lennart Poettering [Wed, 29 Sep 2021 08:30:17 +0000 (10:30 +0200)]
core: drop "const" from NeedsDaemonReload unit dbus property
It's not "const", it can change any time if people change the fs, and we
don#t send out notifications for it. Hence don't claim it was const.
(Otherwise clients might cache it, but they should not)
Prompted-by: #20792
(cherry picked from commit
e30a3ba16a5da4b46cd6c8bc363dbccb791fc45e)
(cherry picked from commit
3636724012003a2f9b45eb9f8991ae93661de462)
Lennart Poettering [Wed, 29 Sep 2021 08:48:24 +0000 (10:48 +0200)]
resolvconf-compat: make "-u" operation a NOP
According to the various man pages of "resolvconf" the -u switch is for:
"-u Just run the update scripts (if updating is enabled)."
"-u Force resolvconf to update all its subscribers. resolvconf does not
update the subscribers when adding a resolv.conf that matches what
it already has for that interface."
We have no "subscribers", we ourselves are the only "subscriber" we
support. Hence it's probably better to ignore such a request and make it
a NOP, then to fail.
Fixes: #20748
(cherry picked from commit
bee07a399572e0d60600c040a84099ecb418ed33)
(cherry picked from commit
4fe53426991e829c0add9378d91f3677a23076fd)
dann frazier [Mon, 27 Sep 2021 17:00:53 +0000 (11:00 -0600)]
Add remaining supported schemes as options for default-net-naming-scheme
(cherry picked from commit
aa0a23ec8629aa033a098ab55e9d97ccd9fbf39c)
(cherry picked from commit
879c3eed4293752210ce067206a2fadb862c6370)
Lennart Poettering [Mon, 27 Sep 2021 12:28:16 +0000 (14:28 +0200)]
resolved: suppress writing DNS server info into /etc/resolv.conf for non-standard UDP ports
glibc doesn't support this, hence don#t generate it.
Fixes: #20836
(cherry picked from commit
a50dadf2fd7413bbfc26af7e2ad2900b3e06af82)
(cherry picked from commit
2b2804757c8520b5cc133d9a3078f6fbec4a69cb)
Anssi Hannula [Fri, 24 Sep 2021 12:26:21 +0000 (15:26 +0300)]
man: fix a reference in timedatectl man page
timedatectl(1) says the synchronization service list generation is
described "below", but in reality it is documented in
systemd-timedated.service(8).
Fix the sentence to reference the correct man page.
(cherry picked from commit
9376b2aab3692d26de60a93e396f84fa2799b80b)
(cherry picked from commit
b7c6b9d4a71e38cb5ac33423a9e41a43c833d45e)
Anssi Hannula [Thu, 23 Sep 2021 09:08:05 +0000 (12:08 +0300)]
bootctl: Fix update not adding EFI entry if Boot IDs are non-consecutive
"bootctl update" tries to add sd-boot to the EFI boot loader list if it
is not already there. To do so, it uses find_slot() which finds the
proper BootXXXX slot ID to use and also returns 1 if an existing sd-boot
entry was found at this ID or 0 if it is a new unused ID. In "update"
case install_variables() only writes the entry in case 0 (no existing
entry).
However, find_slot() erroneously returns 1 if it finds a gap in the Boot
IDs (i.e. when not resorting to max(ids) + 1). This causes
"bootctl update" to not add a missing systemd-boot boot entry if the
existing BootXXXX entry IDs are not consecutive.
Fix that by returning 0 in find_slot() when an empty gap ID is selected
to make it match the behavior when selecting an empty non-gap ID.
(cherry picked from commit
26d54e1263dcb58daa6578595cc6ab1037315593)
(cherry picked from commit
0028a3eb976dfa7209433dfa3a24b785f05fd352)
Lennart Poettering [Wed, 15 Sep 2021 13:43:42 +0000 (15:43 +0200)]
watchdog: pass right error code to log function so that %m works
(cherry picked from commit
a4588af942af976c55f72869340c24d5017db278)
(cherry picked from commit
11d5f109b04cd61c8bf437065b5e178c485a49b4)
Daan De Meyer [Wed, 15 Sep 2021 12:05:46 +0000 (13:05 +0100)]
sd-journal: Ignore data threshold if set to zero in sd_journal_enumerate_fields()
According to the documentation, Setting the data threshold to zero disables the
data threshold alltogether. Let's make sure we actually implement this behaviour
in sd_journal_enumerate_fields() by only applying the data threshold if it exceeds
zero.
(cherry picked from commit
adbd80f51088058d55e703abe0ac11476cfe0ba4)
(cherry picked from commit
99ae9b83b42abbe54c059ae964b737b64ae17df9)
Franck Bui [Wed, 4 Aug 2021 09:20:07 +0000 (11:20 +0200)]
journalctl: never fail at flushing when the flushed flag is set
Even if journald was not running, flushing the volatile journal used to work if
the journal was already flushed (ie the flushed flag
/run/systemd/journald/flushed was created).
However since commit
4f413af2a0a, this behavior changed and now '--flush' fails
because it tries to contact journald without checking the presence of the
flushed flag anymore.
This patch restores the previous behavior since there's no reason to fail when
journalctl can figure out that the flush is not necessary.
(cherry picked from commit
f6fca35e642a112e80cc9bddb9a2b4805ad40df2)
(cherry picked from commit
dc331f4c9268d17a66f4393cfd0dba14c7022d41)
Daan De Meyer [Tue, 14 Sep 2021 14:08:46 +0000 (15:08 +0100)]
sd-journal: Don't compare hashes from different journal files
In sd_journal_enumerate_fields(), we check if we've already handled
a field by checking if we can find it in any of the already processed
journal files. We do this by calling
journal_file_find_field_object_with_hash(), which compares the size,
payload and hash of the given field against all fields in a journal file,
trying to find a match. However, since we now use per file hash functions,
hashes for the same fields will differ between different journal files,
meaning we'll never find an actual match.
To fix the issue(), let's use journal_file_find_field_object() when one
or more of the files we're comparing is using per file keyed hashes.
journal_file_find_field_object() only takes the field payload and size
as arguments and calculates the hash itself using the hash function from
the journal file we're searching in.
(cherry picked from commit
27bf0ab76e13611dce10210f2a22fb5fba05adbb)
(cherry picked from commit
2f5b486edfdb6dc3d5465fe7569c19560208813c)
Marcus Harrison [Wed, 15 Sep 2021 01:55:07 +0000 (03:55 +0200)]
Fix error building repart with no libcryptsetup (#20739)
(cherry picked from commit
2709d02906dd3ab5ecc2b3e19e2846b1714a7e5a)
(cherry picked from commit
d3dfc9afa2297e2e15019adf974da8fb0ab7270c)
Yu Watanabe [Mon, 13 Sep 2021 17:50:37 +0000 (02:50 +0900)]
test-network: kernel treats the lowest IP address as unicast since 5.14
See kernel's
94c821c74bf5fe0c25e09df5334a16f98608db90.
(cherry picked from commit
8be102f8b8019a9bd7e445532cad632cbc6986d3)
(cherry picked from commit
64c59740ca21f47718c69b9c68ca28e6fab68741)
Yu Watanabe [Sat, 11 Sep 2021 11:56:15 +0000 (20:56 +0900)]
unit: systemd-oomd.service requires cgroup memory controller
(cherry picked from commit
ca589b1b4139c85e2ae55b62be0a2a6d3eb4db90)
(cherry picked from commit
82ce34f42b4f5648416cc2ef8f78e722e1771114)
Daan De Meyer [Tue, 7 Sep 2021 15:13:56 +0000 (16:13 +0100)]
core: Parse log environment settings again after applying manager environment
Currently, SYSTEMD_LOG_LEVEL set in the ManagerEnvironment property in system.conf
or user.conf doesn't affect the manager's logging level. Parsing the logging environment
variables again after pushing the manager environment into the process environment
block makes sure any new environment changes also get taken into account for logging.
(cherry picked from commit
a4303b4096d9a75acd09c5b897ed3d20c9bca6de)
(cherry picked from commit
b246b5370e95756e9597d8ec967ae030b442e73f)
Michael Catanzaro [Wed, 8 Sep 2021 21:51:16 +0000 (16:51 -0500)]
nss-systemd: ensure returned strings point into provided buffer
Jamie Bainbridge found an issue where glib's g_get_user_database_entry()
may crash after doing:
```
error = getpwnam_r (logname, &pwd, buffer, bufsize, &pw);
// ...
pw->pw_name[0] = g_ascii_toupper (pw->pw_name[0]);
```
in order to uppercase the first letter of the user's real name. This is
a glib bug, because there is a different codepath that gets the pwd from
vanilla getpwnam instead of getpwnam_r as shown here. When the pwd
struct is returned by getpwnam, its fields point to static data owned by
glibc/NSS, and so it must not be modified by the caller. After much
debugging, Jamie Bainbridge has fixed this in https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2244
by making a copy of the data before modifying it, and that resolves all
problems for glib. Yay!
However, glib is crashing even when getpwnam_r is used instead of
getpwnam! According to getpwnam_r(3), the strings in the pwd struct are
supposed to be pointers into the buffer passed by the caller, so glib
should be able to safely edit it directly in this case, so long as it
doesn't try to increase the size of any of the strings.
Problem is various functions throughout nss-systemd.c return synthesized
records declared at the top of the file. These records are returned
directly and so contain pointers to static strings owned by
libsystemd-nss. systemd must instead copy all the strings into the
provided buffer.
This crash is reproducible if nss-systemd is listed first on the passwd
line in /etc/nsswitch.conf, and the application looks up one of the
synthesized user accounts "root" or "nobody", and finally the
application attempts to edit one of the strings in the returned struct.
All our synthesized records for the other struct types have the same
problem, so this commit fixes them all at once.
Fixes #20679
(cherry picked from commit
47fd7fa6c650d7a0ac41bc89747e3b866ffb9534)
(cherry picked from commit
055ba736e12255cf79acc81aac382344129d03c5)
Michael Catanzaro [Wed, 8 Sep 2021 18:42:16 +0000 (13:42 -0500)]
nss-systemd: pack pw_passwd result into supplied buffer
getpwnam_r() guarantees that the strings in the struct passwd that it
returns are pointers into the buffer allocated by the application and
passed to getpwnam_r(). This means applications may choose to modify the
strings in place, as long as the length of the strings is not increased.
So it's wrong for us to return a static string here, we really do have
to copy it into the application-provided buffer like we do for all the
other strings.
This is only a theoretical problem since it would be very weird for an
application to modify the pw_passwd field, but I spotted this when
investigating a similar crash caused by glib editing a different field.
See also:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2244
(cherry picked from commit
92b264676ccd79c89da270aabc1ec466fa18cd0d)
(cherry picked from commit
84313bc5a262e87f49d176db169e1562d7060b33)
Lennart Poettering [Wed, 5 May 2021 13:32:43 +0000 (15:32 +0200)]
user-util: add generic definition for special password hash values in /etc/passwd + /etc/shadow
Let's add three defines for the 3 special cases of passwords.
Some of our tools used different values for the "locked"/"invalid" case,
let's settle on using "!*" which means the password is both locked *and*
invalid.
Other tools like to use "!!" for this case, which however is less than
ideal I think, since the this could also be a considered an entry with
an empty password, that can be enabled again by unlocking it twice.
(cherry picked from commit
53c25ac968ab8b868506c3a1820d8c76beb0cd88)
Michal Sekletar [Wed, 8 Sep 2021 13:42:11 +0000 (15:42 +0200)]
sd-event: take ref on event loop object before dispatching event sources
Idea is that all public APIs should take reference on objects that get
exposed to user-provided callbacks. We take the reference as a
protection from callbacks dropping it. We used to do this also here in
sd_event_loop(). However, in cleanup portion of
f814c871e6 this was
accidentally dropped.
(cherry picked from commit
9f6ef467818f902fe5369c8e37a39a3901bdcf4f)
(cherry picked from commit
a93ddddd00860bda05df72cfd5b80be9b3a93023)
Dan Streetman [Fri, 3 Sep 2021 16:43:33 +0000 (12:43 -0400)]
meson.build: change operator combining bools from + to and
upstream meson stopped allowing combining boolean with the plus
operator, and now requires using the logical and operator
reference:
https://github.com/mesonbuild/meson/commit/
43302d3296baff6aeaf8e03f5d701b0402e37a6c
Fixes: #20632
(cherry picked from commit
c29537f39e4f413a6cbfe9669fa121bdd6d8b36f)
(cherry picked from commit
7f16b730c80b017ad381eba918c066a911b5943f)
Lennart Poettering [Wed, 1 Sep 2021 12:41:37 +0000 (14:41 +0200)]
nspawn: fix type to pass to connect()
It expects a generic "struct sockaddr", not a "struct sockaddr_un".
Pass the right member of the union.
Not sure why gcc/llvm never complained about this...
(cherry picked from commit
32b9736a230d47b73babcc5cfa27d672bb721bd0)
(cherry picked from commit
caa0827ca920617dc54e62be1ff8422ad9ce2d3a)
Yu Watanabe [Fri, 27 Aug 2021 08:27:26 +0000 (17:27 +0900)]
udev: fix potential memleak
(cherry picked from commit
4154524d47d24bcee3ebfed939912a847ebeb1b3)
(cherry picked from commit
f4a8e2c2115fc901e588a1672f129e7e3371f5d7)
Alvin Šipraga [Tue, 31 Aug 2021 12:17:33 +0000 (14:17 +0200)]
network: print Ethernet Link-Layer DHCP client ID with leading 0's
This is a small cosmetic change.
Before:
Offered DHCP leases: 192.168.0.183 (to 0:9:a7:36:bc:89)
After:
Offered DHCP leases: 192.168.0.183 (to 00:09:a7:36:bc:89)
(cherry picked from commit
8e664ab6ecc9c420d2151f14b36824aecc76d8ac)
(cherry picked from commit
133354a3b9fc7b88fb143f241cfc4565b943ae87)
Lennart Poettering [Mon, 30 Aug 2021 11:21:55 +0000 (13:21 +0200)]
run/mount/systemctl: don't fork off PolicyKit/ask-pw agent when in --user mode
When we are in --user mode there's no point in doing PolicyKit/ask-pw
because both of these systems are only used by system-level services.
Let's disable the two agents for that automaticlly hence.
Prompted by: #20576
(cherry picked from commit
966f3a246c8c804d8a9c9d393f03c5c3fe0dd393)
(cherry picked from commit
fb999b918462361fefa435f86884f81edff503c5)
Thomas Mühlbacher [Mon, 30 Aug 2021 14:16:30 +0000 (16:16 +0200)]
man: Don't leak memory in path-documents example
The `sd_path_lookup(3)` man page states that the returned string shall be
`free(3)`'d but then doesn't do so in the example code.
Also add basic error handling as well.
(cherry picked from commit
fee1863c83d04aa06d50a90ff42f5d4f4f2b9178)
(cherry picked from commit
010770bbbe45e1c381f4db4f81b35872569a3944)
Lennart Poettering [Mon, 30 Aug 2021 11:20:59 +0000 (13:20 +0200)]
hwdb: remove double empty line in --help text
(cherry picked from commit
aecc04f1800c87e0479e74e0225e288a403ba77e)
(cherry picked from commit
da61fe147e40ba26ed8cf405dbf0a0e71e060d0b)
Yu Watanabe [Sun, 22 Aug 2021 21:16:48 +0000 (06:16 +0900)]
path-util: make find_executable() work without /proc mounted
Follow-up for
888f65ace6296ed61285d31db846babf1c11885e.
Hopefully fixes #20514.
(cherry picked from commit
93413acd3ef3a637a0f31a1d133b103e1dc81fd6)
(cherry picked from commit
727d0b55f46468d6171f4a326bd3139bab3c93ab)
Daan De Meyer [Tue, 24 Aug 2021 15:46:47 +0000 (16:46 +0100)]
core: Check unit start rate limiting earlier
Fixes #17433. Currently, if any of the validations we do before we
check start rate limiting fail, we can still enter a busy loop as
no rate limiting gets applied. A common occurence of this scenario
is path units triggering a service that fails a condition check.
To fix the issue, we simply move up start rate limiting checks to
be the first thing we do when starting a unit. To achieve this,
we add a new method to the unit vtable and implement it for the
relevant unit types so that we can do the start rate limit checks
earlier on.
(cherry picked from commit
9727f2427ff6b2e1f4ab927cc57ad8e888f04e95)
(cherry picked from commit
ed8fbbf1745c6a2dc0b8cd560ac8a3353f72e979)
Daan De Meyer [Tue, 24 Aug 2021 15:19:03 +0000 (16:19 +0100)]
core: Remove circular include
service.h includes socket.h and socket.h includes service.h. Move
service.h include from socket.h to socket.c to remove the circular
dependency.
(cherry picked from commit
a243128d1fcfc378df9fce1b4997148a17ef23a5)
(cherry picked from commit
a203879ae5914fa1a676dbd480a7ad41ca0d8e40)
Sho Iizuka [Wed, 25 Aug 2021 04:00:03 +0000 (13:00 +0900)]
NEWS: net.ipv4.tcp_ecn = 1 was reverted at v240
Turning on ECN was reverted by
1e190df.
(cherry picked from commit
e447ffe4daca1d0beb57242f079125669e4e1c3c)
(cherry picked from commit
d69732ea03f2f4e71d0f0952cd0aaf71ceda4240)
pedro martelletto [Wed, 8 Sep 2021 08:42:56 +0000 (10:42 +0200)]
explicitly close FIDO2 devices
FIDO2 device access is serialised by libfido2 using flock().
Therefore, make sure to close a FIDO2 device once we are done
with it, or we risk opening it again at a later point and
deadlocking. Fixes #20664.
(cherry picked from commit
b6aa89b0a399992c8ea762e6ec4f30cff90618f2)
(cherry picked from commit
d6e4920b10c3da1665cb44f4686893b865003d12)
Zbigniew Jędrzejewski-Szmek [Wed, 15 Sep 2021 14:33:05 +0000 (16:33 +0200)]
Drop bundled copy of linux/if_arp.h
As far as I can see, we use this to get a list of ARPHRD_* defines (used in
particular for Type= in .link files). If we drop our copy, and build against
old kernel headers, the user will have a shorter list of types available. This
seems OK, and I don't think it's worth carrying our own version of this file
just to have newest possible entries.
7c5b9952c4f6e2b72f90edbe439982528b7cf223 recently updated this file, but we'd
have to update it every time the kernel adds new entries. But if we look at
the failure carefully:
src/basic/arphrd-from-name.gperf:65:16: error: ‘ARPHRD_MCTP’ undeclared (first use in this function); did you mean ‘ARPHRD_FCPP’?
65 | MCTP, ARPHRD_MCTP
| ^~
| ARPHRD_FCPP
we see that the list we were generating was from the system headers, so it was
only as good as the system headers anyway, without the newer entries in our
bundled copy, if there were any. So let's make things simpler by always using
system headers.
And if somebody wants to fix things so that we always have the newest list,
then we should just generate and store the converted list, not the full header.
(cherry picked from commit
e7f46ee3ae1cc66a94b293957721d68dc09d7449)
Chris Packham [Thu, 9 Sep 2021 21:51:36 +0000 (09:51 +1200)]
basic/linux: Sync if_arp.h with Linux 5.14
ARPHRD_MCTP was added in 5.14. Sync if_arp.h to pick up the definition
Fixes #20694
(cherry picked from commit
7c5b9952c4f6e2b72f90edbe439982528b7cf223)
Anatol Pomozov [Fri, 10 Sep 2021 18:52:55 +0000 (11:52 -0700)]
tpm-util: fix TPM parameter handling
cryptenroll allows to specify a custom TPM driver separated from
parameters with colon e.g. `systemd-cryptenroll --tpm2-device=swtpm:`
tells to load swtpm tss driver and use it as a device.
Unfortunately it does not work, swtpm driver init() fails with
```
debug:tcti:src/tss2-tcti/tcti-swtpm.c:570:Tss2_Tcti_Swtpm_Init() Dup'd conf string to: 0x562f91cbc000
debug:tcti:src/util/key-value-parse.c:85:parse_key_value_string() parsing key/value: swtpm:
WARNING:tcti:src/util/key-value-parse.c:50:parse_key_value() key / value string is invalid
Failed to initialize TCTI context: tcti:A parameter has a bad value
```
It turns out that cryptenroll suppose to use the driver name internally
and strip it before passing the rest of parameters to init() function.
Without doing it swtpm receives incorrect key-value property and gets
confused.
Fix it by passing the correct parameter (without driver name) to the
init() function.
Fixes #20708
(cherry picked from commit
8889564a8da574e4b956e2b6ced34354dee54cd7)
Yu Watanabe [Wed, 15 Sep 2021 14:29:11 +0000 (23:29 +0900)]
journal,network,timesync: fix segfault on 32bit timeval/timespec systems
Fixes #20741.
(cherry picked from commit
f782eee68aea996c68b8cfeba5f288dae7fc876f)
Yu Watanabe [Sun, 29 Aug 2021 11:55:44 +0000 (20:55 +0900)]
timesync: check cmsg length
(cherry picked from commit
37df6d9b8d3a8b34bec5346766ab8093c0f0fc26)
Yu Watanabe [Sun, 29 Aug 2021 11:50:49 +0000 (20:50 +0900)]
socket-util: introduce CMSG_SPACE_TIMEVAL/TIMESPEC macro to support additional 64bit timeval or timespec
Fixes #20482 and #20564.
(cherry picked from commit
9365e296fe281da45797af89a97627e872fc019d)
Yu Watanabe [Thu, 19 Aug 2021 23:44:27 +0000 (08:44 +0900)]
Yu Watanabe [Thu, 19 Aug 2021 23:40:11 +0000 (08:40 +0900)]
timesync: fix wrong type for receiving timestamp in nanoseconds
(cherry picked from commit
6f96bdc58746b1698bf8b3430a6c638f8949daec)
Yu Watanabe [Tue, 7 Sep 2021 12:46:50 +0000 (21:46 +0900)]
network: fix wrong flag: manage_foreign_routes -> manage_foreign_rules
Fixes a bug in
d94dfe7053d49fa62c4bfc07b7f3fc2227c10aff.
(cherry picked from commit
771a36439e955906290afc16a6fb3b10401892cf)
Yu Watanabe [Tue, 13 Apr 2021 03:23:31 +0000 (12:23 +0900)]
man: update description for ManageForeignRoutes=
(cherry picked from commit
3fe23a96d66e82ff8b08e6573093e391d62f5bd1)
Yu Watanabe [Sun, 11 Apr 2021 12:33:51 +0000 (21:33 +0900)]
network: introduce ManageForeignRoutingPolicyRules= boolean setting in networkd.conf
The commit
0b81225e5791f660506f7db0ab88078cf296b771 makes that networkd
remove all foreign rules except those with "proto kernel".
But, in some situation, people may want to manage routing policy rules
with other tools, e.g. 'ip' command. To support such the situation,
this introduce ManageForeignRoutingPolicyRules= boolean setting.
Closes #19106.
(cherry picked from commit
d94dfe7053d49fa62c4bfc07b7f3fc2227c10aff)
David Tardon [Wed, 31 Mar 2021 08:38:00 +0000 (10:38 +0200)]
test-install-root: add test for unknown WantedBy= target
(cherry picked from commit
8adbad370f522831dd9246fe272caf37ce748d4a)
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 16:41:17 +0000 (18:41 +0200)]
shared/install: ignore enablement of template units w/o instance when presetting
When we have a unit which cannot be enabled:
# foo@.service:
...
[Install]
WantedBy=foo.target # there is no instance, so we don't know what to enable
we should throw an error when invoked directly with 'enable', but
not when doing 'preset' or 'preset-all'.
Fixes #19856.
(cherry picked from commit
ad5fdd391248432e0c105003a8a13f821bde0b8e)
Fixes https://github.com/systemd/systemd-stable/issues/108
Zbigniew Jędrzejewski-Szmek [Thu, 10 Jun 2021 08:00:16 +0000 (10:00 +0200)]
shared/install: pass UnitFileFlags down into the call chain
This just propagates the parameter down into leaf functions,
without any functional change.
(cherry picked from commit
9b69770a495a170bd6efd5b0c7a89a3ad093a021)
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 15:24:52 +0000 (17:24 +0200)]
shared/install: improve message about template mismatch
$ systemctl enable --root=/ serial-getty@.service
Failed to enable unit, unit getty.target is a non-template unit.
↓
Failed to enable serial-getty@.service, destination unit getty.target is a non-template unit.
(cherry picked from commit
e1f2f7f194bf8687e19e74ac703923e4c107b46e)
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 14:34:20 +0000 (16:34 +0200)]
shared/install: remove custom error handling in unit_file_preset_all()
This had some purpose back in the day, but right now I cannot see what
difference this makes. It's hard to keep the list of all possible errors up to
date. So let's remove this, hopefully nothing breaks.
(cherry picked from commit
4a203a5177b7d9aa499221c315bc0e327a23b5cf)
Zbigniew Jędrzejewski-Szmek [Wed, 9 Jun 2021 14:33:23 +0000 (16:33 +0200)]
shared/install: ignore failures for auxiliary files
If Also= fails, warn, but otherwise ignore the failure.
Fixes #19407.
(cherry picked from commit
3aa96361ed32b4084cdd59caaebca9cbdc66db0f)
Zbigniew Jędrzejewski-Szmek [Tue, 4 May 2021 16:40:02 +0000 (18:40 +0200)]
Make unit_name_to_instance() return UnitNameFlags
The function returns non-negative UnitNameFlags on success, and negative
errno on error. In the past we kept the return type as int because of those
negative return values. But nowadays _UNIT_NAME_INVALID == -EINVAL. And if
we tried to actually return something that doesn't fit in the return type,
the compiler would throw an error. By changing to the "real" return type,
we allow the debugger to use symbolic representation for the variables.
(cherry picked from commit
73ce91a05a63f44367b48a7ef3ca1ce4e85205b3)
David Tardon [Wed, 31 Mar 2021 08:08:31 +0000 (10:08 +0200)]
test-install-root: create referenced targets
(cherry picked from commit
cd228002ccedb927b4531a4b7dd9ea7015fdb657)
Jan Synacek [Wed, 3 Jun 2020 08:33:21 +0000 (10:33 +0200)]
install: warn if WantedBy targets don't exist
Currently, if [Install] section contains WantedBy=target that doesn't exist,
systemd creates the symlinks anyway. That is just user-unfriendly.
Let's be nice and warn about installing non-existent targets.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
1835351.
Replaces: #15834
(cherry picked from commit
8ae27441c2dcf585f58242991302b09778d4d710)