Wolfgang Müller [Mon, 24 Apr 2023 18:00:56 +0000 (20:00 +0200)]
cryptsetup-fido2: Depend on libcryptsetup
crypsetup-fido2 always depended on both libfido2 and libcryptsetup, but
0a8e026e825dda142a8f1552a4b45815cbfd0b48 forgot to make the then
implicit dependency on libcryptsetup explicit when moving it from
cryptsetup/ to shared/. This breaks builds when libfido2 is autodetected
but the system is missing libcryptsetup.
Introduce an explicit check for HAVE_LIBCRYPTSETUP such that
cryptsetup-fido2 is only built when both libraries are available.
Fixes #27374.
Lennart Poettering [Tue, 14 Mar 2023 21:48:25 +0000 (22:48 +0100)]
homed: rename make_userns() to avoid name conflict with mount-util.[ch]
This doesn't really matter too much as both are static functions. But
it's confusing as hell both when debugging and reading code, given that
homed actually uses mount-util.c
Hence, let's just rename one of the two, to minimize confusion.
No actual change in behaviour.
(and sooner or later we might want to export mount-util.c's version of
the function, since it's generically useful)
Zbigniew Jędrzejewski-Szmek [Mon, 24 Apr 2023 20:03:06 +0000 (22:03 +0200)]
Merge pull request #27113 from keszybz/variable-expansion-rework
Rework serialization of command lines in pid1 and make run not expand variables
Lennart Poettering [Thu, 20 Apr 2023 16:46:55 +0000 (18:46 +0200)]
parse-util: allow parse_pid() to work with NULL return parameter
That way the function becomes useful for validating pids formatted as
strings.
Daan De Meyer [Mon, 24 Apr 2023 11:21:21 +0000 (13:21 +0200)]
mkosi: Update to latest
This pulls in a fix for Debian rpmdb locations, which results in a
substantial speedup for centos/fedora builds.
Daan De Meyer [Mon, 24 Apr 2023 09:54:50 +0000 (11:54 +0200)]
nspawn: Don't follow /etc/resolv.conf symlinks
When we're checking if /etc/resolv.conf exists so we can bind mount
on top of it, we care about whether the symlink itself exists if
/etc/resolv.conf exists and not the file it points to, so add
CHASE_NOFOLLOW to make sure we check existence of the symlink and
not the file it points to.
Luca Boccassi [Mon, 24 Apr 2023 12:42:16 +0000 (13:42 +0100)]
man: fix LogControl1 manpage example
Follow-up for
c6b8fffdfaf1f7c9a1dac73e1e54993a06c766c0
Luca Boccassi [Sun, 16 Apr 2023 13:55:09 +0000 (14:55 +0100)]
pam: cache sd-bus separately per module
sd-bus connection is cached by the two pam modules globally, but this
can lead to issues due to hashmaps (used by sd-bus) using a global
static variable for the shared hash key, which is different per module
as both modules are loaded in the same process.
This happens because the sd-bus object is create in one module, but
used in the other, so global state does not match.
Use a different pam cache identifier for the sd-bus pointer, so that
each module uses a different sd-bus connection as a workaround.
Fixes https://github.com/systemd/systemd/issues/27216
Fixes https://github.com/systemd/systemd/issues/17266
Luca Boccassi [Thu, 20 Apr 2023 11:58:18 +0000 (12:58 +0100)]
pam_systemd_home: clean up sd-bus when called about something else's user
acquire_home() takes a reference to a sd-bus object, which the open_session
hook cleans on success. But only when handling a user actually owned by homed,
it did not clean it up when skipping because it is being invoked on a system
user.
We need to be careful with sd-bus here as pam_sm_open_session is the last
hook before forking, and we want to clean up sd-bus before that happens, or
we'll have a broken reference (FDs are cloexec) in the child process, which
will then assert when attempting to close them, or leak the bus connection
which causes dbus to complain loudly:
dbus-daemon[62]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30020ms)
Daan De Meyer [Mon, 24 Apr 2023 11:03:58 +0000 (13:03 +0200)]
Merge pull request #27367 from bluca/mkosi_resolve
mkosi: add tmpfiles to handle locale/resolve.conf in Debian
Zbigniew Jędrzejewski-Szmek [Mon, 24 Apr 2023 10:24:36 +0000 (12:24 +0200)]
Merge pull request #27357 from bluca/example_logcontrol
man: add working example to LogControl1 manpage
Luca Boccassi [Sun, 23 Apr 2023 17:33:24 +0000 (18:33 +0100)]
stub: add comment on measurement of io.systemd.stub.kernel-cmdline-extra
Luca Boccassi [Mon, 24 Apr 2023 09:47:29 +0000 (10:47 +0100)]
mkosi: add tmpfiles to create debian/ubuntu /etc/default/locale link
Luca Boccassi [Mon, 24 Apr 2023 09:46:39 +0000 (10:46 +0100)]
mkosi: move debian/ubuntu ignore preset to config directory
Luca Boccassi [Sun, 23 Apr 2023 11:54:20 +0000 (12:54 +0100)]
mkosi: move debian/ubuntu common conf under common directory
Luca Boccassi [Sun, 23 Apr 2023 12:02:06 +0000 (13:02 +0100)]
mkosi: delete /etc/resolv.conf to let tmpfiles handle it
In case the distribution creates or ships resolv.conf, delete it and let tmpfiles handle it
Daan De Meyer [Sun, 23 Apr 2023 12:53:11 +0000 (14:53 +0200)]
mkosi: Update to latest
Let's use the new support for matching against any distribution in
a list of distributions to start sharing most things between the
ubuntu/debian configs and centos/fedora configs.
Zbigniew Jędrzejewski-Szmek [Tue, 4 Apr 2023 19:18:33 +0000 (21:18 +0200)]
run: expand variables also with --scope
This makes syntax be the same for commands which are started by the manager and
those which are spawned directly (when --scope is used).
Before:
$ systemd-run -q -t echo '$TERM'
xterm-256color
$ systemd-run -q --scope echo '$TERM'
$TERM
Now:
$ systemd-run -q --scope echo '$TERM'
xterm-256color
Previous behaviour can be restored via --expand-environment=no:
$ systemd-run -q --scope --expand-environment=no echo '$TERM'
$TERM
Fixes #22948.
At some level, this is a compat break. Fortunately --scope is not very widely
used, so I think we can get away with this. Having different syntax depending
on whether --scope was used or not was bad UX.
A NEWS entry will be required.
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 06:26:56 +0000 (08:26 +0200)]
man/systemd-run: add examples explaining how variable expansion is performed
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 21:17:58 +0000 (23:17 +0200)]
run: add --expand-environment=no to disable server-side envvar expansion
This uses StartExecEx to get the equivalent of ExecStart=:. StartExecEx was
added in
b3d593673c5b8b0b7d781fd26ab2062ca6e7dbdb, so this will not work with
older systemds.
A hint is emitted if we get an error indicating lack of support. PID1 returns
SD_BUS_ERROR_PROPERTY_READ_ONLY, but I'm checking for
SD_BUS_ERROR_UNKNOWN_PROPERTY too for safety.
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 20:27:58 +0000 (22:27 +0200)]
run: split out creation of unit creation messages
Just refactoring, in preparation for future changes.
(Though I think it'd be reasonable to do anyway, those functions were
awfully long.)
'git diff' displays this badly. The middle part of start_transient_service()
is moved to make_transient_service_unit(), and the middle part of
start_transient_trigger() is moved to make_transient_trigger_unit().
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 19:50:19 +0000 (21:50 +0200)]
run: simplify returning of status
start_transient_service() would return two ints: one normally and one via
*retval. We can just return one int and propagate it directly, because we
use DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE().
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 11:56:18 +0000 (13:56 +0200)]
core: fix writing of ExecStartEx and friends
The property name is called ExecStartEx, but we have to write it as ExecStart=
in the unit file. :(
Bug introduced in
b3d593673c5b8b0b7d781fd26ab2062ca6e7dbdb when ex-properties
were initially added.
In addition, we cannot escape $ as $$, because when ":" is used, we wouldn't
unescape $$ back to $.
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 12:45:46 +0000 (14:45 +0200)]
core/unit: add UNIT_ESCAPE_EXEC_SYNTAX
Unfortunately we can't escape $ when ':' is used to prohibit variable expansion:
ExecStart=:echo $$
is not the same as
ExecStart=:echo $
This just adds the functionality and the unittests, without using it anywhere
for real yet.
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 12:50:12 +0000 (14:50 +0200)]
core/unit: rename UNIT_ESCAPE_EXEC_SYNTAX → *_ENV
In preparation for future changes.
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 10:43:53 +0000 (12:43 +0200)]
core/unit: fix shell-escaping of strings
Our escaping of '$' is '$$', not '\$'. We would write unit files that
were not valid:
$ systemd-run --user bash -c 'echo $$; sleep 1000'
Running as unit: run-r1c7c45b5b69f487c86ae205e12100808.service
$ systemctl cat --user run-r1c7c45b5b69f487c86ae205e12100808
# /run/user/1000/systemd/transient/run-r1c7c45b5b69f487c86ae205e12100808.service
...
ExecStart="/usr/bin/bash" "-c" "echo \$\$\; sleep 1000"
$ systemd-analyze verify /run/user/1000/systemd/transient/run-r1c7c45b5b69f487c86ae205e12100808.service
/run/user/1000/systemd/transient/run-r1c7c45b5b69f487c86ae205e12100808.service:7:
Ignoring unknown escape sequences: "echo \$\$\; sleep 1000"
Similarly, ';' cannot be escaped as '\;'. Only a handful of characters
listed in "Supported escapes" is allowed.
Escaping of "'" can be done, but it's not useful because we use double quotes
around the string anyway whenever we do escaping.
unit_write_setting() is called all over the place. In a great majority of
places we write either fixed strings or something that we generate ourselves,
so no escaping or quoting is needed. (And it's not allowed, e.g.
'Type="oneshot"' would not work.) But if we forgot to add escaping or quoting
for a free-style string, it would probably allow writing a unit file that would
be read completely wrong. I looked over various places where
unit_write_setting() is called, and I couldn't find any place where
quoting/escaping was forgotten. But trying to figure out the full
ramifications of this change is not easy.
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 12:32:39 +0000 (14:32 +0200)]
basic/logarithm: add popcount() wrapper
__builtin_popcount() is a bit of a mouthful, so let's provide a helper.
Using _Generic has the advantage that if a type other then the ones on
the list is given, compilation will fail. This is nice, because if by any
change we pass a wider type, it is rejected immediately instead of being
truncated.
log.h is also needed. It is included transitively, but let's include it
directly.
macro.h is *not* needed.
07416 [Sun, 23 Apr 2023 09:48:17 +0000 (12:48 +0300)]
a colloquial abbreviation 'btw' in TEMPORARY_DIRECTORIES.md (#27365)
* Update TEMPORARY_DIRECTORIES.md
Luca Boccassi [Sat, 22 Apr 2023 11:47:20 +0000 (12:47 +0100)]
man: clarify sd_bus_default
It picks the bus based on the cgroup slice.
Luca Boccassi [Fri, 21 Apr 2023 22:35:08 +0000 (23:35 +0100)]
man: add working example to LogControl1 manpage
Add fully working and documented example that can be copied and pasted
Daan De Meyer [Fri, 21 Apr 2023 11:01:24 +0000 (13:01 +0200)]
sulogin-shell: Start initrd.target on exit in the initrd
sulogin is documented to continue booting up on exit. To do that
in the initrd, we need to start initrd.target and not default.target.
Lennart Poettering [Fri, 21 Apr 2023 14:45:51 +0000 (16:45 +0200)]
Merge pull request #27352 from poettering/devnum-more
devnum-util: port more things over
Daan De Meyer [Thu, 20 Apr 2023 08:13:37 +0000 (10:13 +0200)]
mkosi: Use authselect minimal if authselect is installed
We dropped this logic from mkosi itself, so let's configure it in
our postinst script instead. We also enable the with-homed feature
if we can find it. It doesn't exist for the minimal profile yet,
but might be added in the future.
Luca Boccassi [Thu, 20 Apr 2023 22:48:58 +0000 (23:48 +0100)]
mkosi: remove ?priority(required) from debian pkg list
Requires apt 2.3.10 which is not available in stable, and also doesn't
seem necessary, same packages are installed anyway
Add tzdata manually, as that doesn't seem to be pulled in via the CI.
Lennart Poettering [Fri, 21 Apr 2023 10:39:28 +0000 (12:39 +0200)]
tre-wide: use FORMAT_DEVNUM() a bit more
Lennart Poettering [Fri, 21 Apr 2023 10:34:37 +0000 (12:34 +0200)]
tree-wide: convert more cases do DEVNUM_FORMAT_STR()/DEVNUM_FORMAT_VAL()
Let's use our nice macros a bit more.
(Not comprehensive)
Luca Boccassi [Thu, 20 Apr 2023 21:02:17 +0000 (22:02 +0100)]
Merge pull request #27349 from mrc0mmand/codespell
tree-wide: code spelling fixes
Frantisek Sumsal [Thu, 20 Apr 2023 20:06:28 +0000 (22:06 +0200)]
README: add a Weblate badge
Frantisek Sumsal [Thu, 20 Apr 2023 19:54:59 +0000 (21:54 +0200)]
tree-wide: code spelling fixes
As reported by Fossies.
Zbigniew Jędrzejewski-Szmek [Thu, 20 Apr 2023 15:42:57 +0000 (17:42 +0200)]
detect-virt: add message at debug level
Normal users do not have permissions to access /proc/1/root, so
'systemd-detect-virt -r' fails, but the output, even at debug level
is cryptic:
$ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r
Failed to check for chroot() environment: Permission denied
Let's make this a bit easier to figure out:
$ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r
Cannot stat /proc/1/root: Permission denied
Failed to check for chroot() environment: Permission denied
I looked over other users of files_same(), and I think in general the message
at debug level is OK for them too.
Gustavo Noronha Silva [Mon, 2 May 2022 17:02:23 +0000 (14:02 -0300)]
Apply known iocost solutions to block devices
Meta's resource control demo project[0] includes a benchmark tool that can
be used to calculate the best iocost solutions for a given SSD.
[0]: https://github.com/facebookexperimental/resctl-demo
A project[1] has now been started to create a publicly available database
of results that can be used to apply them automatically.
[1]: https://github.com/iocost-benchmark/iocost-benchmarks
This change adds a new tool that gets triggered by a udev rule for any
block device and queries the hwdb for known solutions. The format for
the hwdb file that is currently generated by the github action looks like
this:
# This file was auto-generated on Tue, 23 Aug 2022 13:03:57 +0000.
# From the following commit:
# https://github.com/iocost-benchmark/iocost-benchmarks/commit/
ca82acfe93c40f21d3b513c055779f43f1126f88
#
# Match key format:
# block:<devpath>:name:<model name>:
# 12 points, MOF=[1.346,1.346], aMOF=[1.249,1.249]
block:*:name:HFS256GD9TNG-62A0A:fwver:*:
IOCOST_SOLUTIONS=isolation isolated-bandwidth bandwidth naive
IOCOST_MODEL_ISOLATION=rbps=
1091439492 rseqiops=52286 rrandiops=63784 wbps=
192329466 wseqiops=12309 wrandiops=16119
IOCOST_QOS_ISOLATION=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00
IOCOST_MODEL_ISOLATED_BANDWIDTH=rbps=
1091439492 rseqiops=52286 rrandiops=63784 wbps=
192329466 wseqiops=12309 wrandiops=16119
IOCOST_QOS_ISOLATED_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00
IOCOST_MODEL_BANDWIDTH=rbps=
1091439492 rseqiops=52286 rrandiops=63784 wbps=
192329466 wseqiops=12309 wrandiops=16119
IOCOST_QOS_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00
IOCOST_MODEL_NAIVE=rbps=
1091439492 rseqiops=52286 rrandiops=63784 wbps=
192329466 wseqiops=12309 wrandiops=16119
IOCOST_QOS_NAIVE=rpct=99.00 rlat=8807 wpct=99.00 wlat=59023 min=75.00 max=100.00
The IOCOST_SOLUTIONS key lists the solutions available for that device
in the preferred order for higher isolation, which is a reasonable
default for most client systems. This can be overriden to choose better
defaults for custom use cases, like the various data center workloads.
The tool can also be used to query the known solutions for a specific
device or to apply a non-default solution (say, isolation or bandwidth).
Co-authored-by: Santosh Mahto <santosh.mahto@collabora.com>
Lennart Poettering [Thu, 20 Apr 2023 14:34:12 +0000 (16:34 +0200)]
Merge pull request #27327 from DaanDeMeyer/hotplug
kmod-setup: Add early loading for virtio_console
Daan De Meyer [Tue, 18 Apr 2023 11:20:37 +0000 (13:20 +0200)]
kmod-setup: Add early loading for virtio_console
getty-generator enables serial-getty@.service for virtualizer consoles
that it can find in /sys/class/tty. To make sure this works for
virtio consoles, let's make sure we load the module is loaded early
so that the /sys/class/tty/hvc0 exists before we run getty-generator.
Daan De Meyer [Tue, 18 Apr 2023 11:15:20 +0000 (13:15 +0200)]
core: Parse logging environment earlier
Let's make sure we parse the logging environment ASAP so that the
options apply to more code. e.g. to allow debugging kmod-setup.c
for example.
Daan De Meyer [Tue, 18 Apr 2023 08:47:13 +0000 (10:47 +0200)]
kmod-setup: Introduce match_modalias_recurse_dir_cb()
Let's make the logic around matching a modalias a bit more generic.
Daan De Meyer [Tue, 18 Apr 2023 11:11:45 +0000 (13:11 +0200)]
string-util: Add startswith_strv()
This is the function version of STARTSWITH_SET(). We also move
STARTSWITH_SET() to string-util.h as it fits more there than in
strv.h and reimplement it using startswith_strv().
Daan De Meyer [Thu, 20 Apr 2023 08:33:10 +0000 (10:33 +0200)]
mkosi: Disable kmsg ratelimiting
Daan De Meyer [Thu, 20 Apr 2023 08:43:21 +0000 (10:43 +0200)]
log: Log when kmsg is being ratelimited
Let's avoid confusing developers and users when log messages suddenly
stop getting logged to kmsg because of ratelimiting by logging an
additional message if we start ratelimiting log messages to kmsg.
Daan De Meyer [Thu, 20 Apr 2023 08:31:37 +0000 (10:31 +0200)]
log: Add knob to disable kmsg ratelimiting
This allows us to disable kmsg ratelimiting in the integration tests
and mkosi for easier debugging.
Lennart Poettering [Thu, 20 Apr 2023 09:14:50 +0000 (11:14 +0200)]
dissect: let's check for crypto_LUKS before fstype allowlist check
When trying to mount a partition that is encrypted without the
encryption first having been set up we want to return a
recognizable error (EUNATCH). This was broken by
80ce8580f5aa6b03fa13a0b3b30207bc9b5c5fe0 which added an allowlist check
for permissible file systems first. Let's reverse the check order, so
that we get EUNATCH again, as before. (And leave EIDRM as error for the
failed allowlist check).
Lennart Poettering [Thu, 20 Apr 2023 08:31:44 +0000 (10:31 +0200)]
ratelimit: handle counter overflows somewhat sanely
An overflow here (i.e. the counter reaching 2^32 within a ratelimit time
window) is not so unlikely. Let's handle this somewhat sanely
and simply stop counting, while remaining in the "limit is hit" state until
the time window has passed.
Lennart Poettering [Thu, 20 Apr 2023 08:03:18 +0000 (10:03 +0200)]
man: try to make clearer that /var/ is generally not available in /usr/lib/systemd/system-shutdown/ callouts
I made the mistake to look into what is installed into
/usr/lib/systemd/system-shutdown/ on Fedora. fwdupd among other things
assumes /var/ is available from these callouts, though it is not in the
general case.
Hence, let's emphasize this in the documentation a bit more.
Lennart Poettering [Thu, 20 Apr 2023 08:14:43 +0000 (10:14 +0200)]
dissect-image: issue BLKFLSBUF before probing an fs at block device offset != 0
See added code comment for a longer explanation. TLDR: Linux maintains
distinct block device caches for partition and "whole" block devices,
and a simply BLKFLSBUF should make the worst confusions this causes go
away.
Robert Meijers [Mon, 17 Apr 2023 20:16:05 +0000 (22:16 +0200)]
networkd: fallback to chaddr for static lease lookup when not found
DHCP static leases are looked up by the client identifier as send by
the client, while configured based on MAC. As RFC 2131 states the client
identifier is an opaque key and must not be interpreted by the server
this means that DHCP clients can (/will) also use a client identifier
which is not a MAC address. One of these clients actually is
systemd-networkd which uses an RFC 4361 by default to generate the
client identifier. For these kind of DHCP clients static leases thus
don't work because of this mismatch between configuring a MAC address
but the server matching based on client identifier. This adds a fallback
to try to look up a configured static lease based on the "chaddr" of the
DHCP message as this will always contain the MAC address of the client.
Fixes #21368
Yu Watanabe [Wed, 19 Apr 2023 18:20:34 +0000 (03:20 +0900)]
core/device: rewrite how device unit is removed from Manager.devices_by_sysfs
If the device unit is not the head of the list saved in
Manager.devices_by_sysfs, then it is not necessary to replace the
existing hashmap entry. This should not change any behavior, just
refactoring.
Yu Watanabe [Wed, 19 Apr 2023 19:04:03 +0000 (04:04 +0900)]
list: fix double evaluation
Daan De Meyer [Thu, 20 Apr 2023 07:19:22 +0000 (09:19 +0200)]
Merge pull request #27299 from yuwata/chase-absolute
chase: return absolute path when dir_fd points to the root directory
Yu Watanabe [Wed, 19 Apr 2023 13:05:43 +0000 (22:05 +0900)]
hwdb: disable entry for Logitech USB receiver used by G502 X
Fixes a bug introduced by
dede07d3d04007c70c78653a73e2bcd8616564a5.
Fixes #27118.
Yu Watanabe [Wed, 19 Apr 2023 11:27:29 +0000 (20:27 +0900)]
core: add one missing assertion for release_resource_queue
Follow-up for
6ac62d61db737b01ad3776a7688d8a4c57b3f7d9.
Quintin Hill [Wed, 19 Apr 2023 11:36:00 +0000 (12:36 +0100)]
dissect-image: fix log level in dissect_log_error
Actually use the log_level argument in this function!
Fixes
4953e39
Daan De Meyer [Tue, 18 Apr 2023 12:35:48 +0000 (14:35 +0200)]
mkosi: Update to latest
Yu Watanabe [Tue, 18 Apr 2023 19:04:40 +0000 (04:04 +0900)]
test: add regression tests for find_esp() and friend
Yu Watanabe [Mon, 17 Apr 2023 15:09:54 +0000 (00:09 +0900)]
chase: replace path_prefix_root_cwd() with chaseat_prefix_root()
The function path_prefix_root_cwd() was introduced for prefixing the
result from chaseat() with root, but
- it is named slightly generic,
- the logic is different from what chase() does.
This makes the name more explanative and specific for the result of the
chaseat(), and make the logic consistent with chase().
Fixes https://github.com/systemd/systemd/pull/27199#issuecomment-
1511387731.
Follow-up for #27199.
Yu Watanabe [Mon, 17 Apr 2023 14:37:12 +0000 (23:37 +0900)]
fd-util: skip to check mount ID if kernel is too old and /proc is not mounted
Now, dir_fd_is_root() is heavily used in chaseat(), which is used at
various places. If the kernel is too old and /proc is not mounted, then
there is no way to get the mount ID of a directory. In that case, let's
silently skip the mount ID check.
Fixes https://github.com/systemd/systemd/pull/27299#issuecomment-
1511403680.
Yu Watanabe [Mon, 17 Apr 2023 14:26:47 +0000 (23:26 +0900)]
mountpoint-util: check /proc is mounted on failure
Yu Watanabe [Mon, 17 Apr 2023 06:28:42 +0000 (15:28 +0900)]
chase: prefix with the root directory only when it is not "/"
Yu Watanabe [Mon, 17 Apr 2023 06:24:05 +0000 (15:24 +0900)]
chase: drop repeated call of empty_to_root()
Yu Watanabe [Sun, 16 Apr 2023 20:47:25 +0000 (05:47 +0900)]
chase: update outdated comment about result path
Yu Watanabe [Sun, 16 Apr 2023 20:19:07 +0000 (05:19 +0900)]
chase: make the result absolute when a symlink is absolute
As the path may be outside of the specified dir_fd.
Yu Watanabe [Sun, 16 Apr 2023 20:04:27 +0000 (05:04 +0900)]
chase: make chaseat() provides absolute path also when dir_fd points to the root directory
Usually, we pass the file descriptor of the root directory to chaseat()
when `--root=` is not specified. Previously, even in such case, the
result was relative, and we need to prefix the path with "/" when we
want to pass the path to other functions that do not support dir_fd, or
log or show the path. That's inconvenient.
Mike Yuan [Tue, 18 Apr 2023 18:06:06 +0000 (02:06 +0800)]
Merge pull request #27323 from keszybz/gpt-auto-generator-warning-cleanup
gpt-auto-generator: do not error out when no partitions are found
Frantisek Sumsal [Tue, 18 Apr 2023 09:45:56 +0000 (11:45 +0200)]
test: prefix the transient unit with test- to make coverage runs happy
See
9fd8226312 for more details.
Follow-up to
c9210b7470.
Mike Yuan [Tue, 18 Apr 2023 11:25:08 +0000 (19:25 +0800)]
Merge pull request #27320 from poettering/kmod-setup-tweaks
minor tweaks to kmod-setup.c
Zbigniew Jędrzejewski-Szmek [Tue, 18 Apr 2023 09:33:08 +0000 (11:33 +0200)]
gpt-auto-generator: "translate" errno codes into proper messages
E.g. in logs on jammy-ppc64el in https://github.com/systemd/systemd/pull/27294:
Apr 16 17:42:50 H systemd-gpt-auto-generator[300]: Failed to dissect partition table of block device /dev/sda: No message of desired type
Apr 16 17:42:50 H (sd-execu[295]: /usr/lib/systemd/system-generators/systemd-gpt-auto-generator failed with exit status 1.
ee0e6e476e61d4baa2a18e241d212753e75003bf made this particular condition not an
error. But for other errnos we want to print a better message too.
dissect_loop_device_and_warn() already does this, but it always prints the
error at error level. We want to suppress some of the errors, so let's make the
print helper public and do the error suppression in the caller.
Zbigniew Jędrzejewski-Szmek [Thu, 6 Apr 2023 09:57:27 +0000 (11:57 +0200)]
fstab-generator: add missing phrase in comment
Paolo Velati [Mon, 17 Apr 2023 20:27:28 +0000 (20:27 +0000)]
hwdb: Fix rotation for BMAX Y13
Lennart Poettering [Tue, 18 Apr 2023 08:48:54 +0000 (10:48 +0200)]
kmod-setup: bypass heavy virtio-rng check if we are not running in a VM anyway
detect_vm() is cheap, because cached, let's hence do that early before
we get out the big guns and sweep through sysfs.
Lennart Poettering [Tue, 18 Apr 2023 08:48:50 +0000 (10:48 +0200)]
kmod-setup: use STARTSWITH_SET() where appropriate
Lennart Poettering [Tue, 18 Apr 2023 07:47:10 +0000 (09:47 +0200)]
Revert "getty-generator: Use device hotplug to instantiate virtualizer consoles"
This reverts commit
e7e6ce5f8d467304731a98e8a140e69713f1bf07.
Lennart Poettering [Tue, 18 Apr 2023 08:38:15 +0000 (10:38 +0200)]
Merge pull request #27256 from medhefgo/boot-rdtsc
boot: Improve timer frequency detection
Yu Watanabe [Mon, 17 Apr 2023 21:36:42 +0000 (06:36 +0900)]
gpt-auto: do not fail when no suitable partitions found
Follow-up for
598fd4da1cf9665834110583fd9133073cc12481.
Daan De Meyer [Mon, 17 Apr 2023 22:46:11 +0000 (00:46 +0200)]
getty-generator: Use device hotplug to instantiate virtualizer consoles
If getty-generator runs in the initrd, the corresponding tty might not
have been instantiated yet in /dev, which means a serial getty is not
spawned on it. Instead, let's instantiate the serial-getty when the
device appears so that it always gets instantiated.
Lennart Poettering [Thu, 16 Mar 2023 16:56:23 +0000 (17:56 +0100)]
lsm-util: move detection of support of LSMs into a new lsm-util.[ch] helper
This makes the bpf LSM check generic, so that we can use it elsewhere.
it also drops the caching inside it, given that bpf-lsm code in PID1
will cache it a second time a stack frame further up when it checks for
various other bpf functionality.
Dominique Martinet [Sun, 16 Apr 2023 07:14:49 +0000 (16:14 +0900)]
bpf-firewall: give a name to maps used
Running systemd with IP accounting enabled generates many bpf maps (two
per unit for accounting, another two if IPAddressAllow/Deny are used).
Systemd itself knows which maps belong to what unit and commands like
`systemctl status <unit>` can be used to query what service has which
map, but monitoring these values all the time costs 4 dbus requests
(calling the .IP{E,I}gress{Bytes,Packets} method for each unit) and
makes services like the prometheus systemd_exporter[1] somewhat slow
when doing that for every units, while less precise information could
quickly be obtained by looking directly at the maps.
Unfortunately, bpf map names are rather limited:
- only 15 characters in length (16, but last byte must be 0)
- only allows isalnum(), _ and . characters
If it wasn't for the length limit we could use the normal unit escape
functions but I've opted to just make any forbidden character into
underscores for maximum brievty -- the map prefix is also rather short:
This isn't meant as a precise mapping, but as a hint for admins who want
to look at these.
(Note there is no problem if multiple maps have the same name)
Link: https://github.com/povilasv/systemd_exporter
Lennart Poettering [Fri, 14 Apr 2023 15:47:43 +0000 (17:47 +0200)]
process-util: be more careful with pidfd_get_pid() special cases
Let's be more careful with generating error codes for (expected) error
causes.
This does not introduce new error conditions, it just changes what we
return under specific cases, to make things nicely recognizable in each
case. Most importantly this detects if fdinfo reports a pid of "-1" for
pidfds with processes that are already reaped (and thus have no PID
anymore)
None of our current users care about these error codes, but let's get
this right for the future.
Florian Klink [Mon, 17 Apr 2023 12:46:05 +0000 (14:46 +0200)]
fsck: use execv_p_ and execl_p_
Instead of invoking find_executable on our own, use the variants of exec
provided by glibc which does this for us.
Luca Boccassi [Sat, 15 Apr 2023 02:01:52 +0000 (03:01 +0100)]
creds: make available to all ExecStartPre= and ExecStart= processes
Fixes https://github.com/systemd/systemd/issues/27275
jcg [Mon, 17 Apr 2023 12:41:00 +0000 (20:41 +0800)]
user-util:remove duplicate includes
Benjamin Herrenschmidt [Thu, 13 Apr 2023 03:51:31 +0000 (13:51 +1000)]
virt: Further improve detection of EC2 metal instances
Commit
f90eea7d18d9ebe88e6a66cd7a86b618def8945d
virt: Improve detection of EC2 metal instances
Added support for detecting EC2 metal instances via the product
name in DMI by testing for the ".metal" suffix.
Unfortunately this doesn't cover all cases, as there are going to be
instance types where ".metal" is not a suffix (ie, .metal-16xl,
.metal-32xl, ...)
This modifies the logic to also allow those new forms.
Signed-off-by: Benjamin Herrenschmidt <benh@amazon.com>
Daan De Meyer [Mon, 17 Apr 2023 08:18:42 +0000 (10:18 +0200)]
mkosi: Use kernel-core for Fedora and CentOS images
Let's reduce image size by using a smaller kernel package.
Hans de Goede [Sun, 16 Apr 2023 13:57:55 +0000 (15:57 +0200)]
hwdb: add accelerometer mount matrix for Lenovo Yoga Tablet 2 851F/L
Add an accelerometer mount matrix for Lenovo Yoga Tablet 2 851F/L, to fix
screen rotation now that the kernel has support for the LSM303D IMU.
Luca Boccassi [Sun, 16 Apr 2023 22:32:33 +0000 (23:32 +0100)]
Merge pull request #27298 from mrc0mmand/test-async-tweaks
test: modernize test-async a bit
Yu Watanabe [Sun, 16 Apr 2023 17:09:38 +0000 (02:09 +0900)]
process-util: make safe_fork() unset $NOTIFY_SOCKET
Propagating $NOTIFY_SOCKET is typically dangerous. Let's unset it unless
explicitly requested to keep it.
Fixes #27288.
Replaces #27291.
Frantisek Sumsal [Sun, 16 Apr 2023 18:29:41 +0000 (20:29 +0200)]
docs: add a missing $ sign
Addresses https://github.com/systemd/systemd/pull/27283#pullrequestreview-
1386816102.
Follow-up to
1a127aa02b.
Frantisek Sumsal [Sun, 16 Apr 2023 18:21:37 +0000 (20:21 +0200)]
test: modernize test-async a bit
Mainly to give it some debug output to, hopefully, see why it sometimes
gets stuck in CI when run with sanitizers.
Zbigniew Jędrzejewski-Szmek [Sun, 16 Apr 2023 10:34:49 +0000 (12:34 +0200)]
mkosi: default to Fedora 38
It'll be out this week. We can't update the man pages before it is realeased,
but we can use it for mkosi builds and do some very late testing.
Also, use filepath specification for /bin/pkg-config. We need it for meson, and
meson calls it directly by this path. pkgconfig is a virtual Provides on
pkgconf-pkg-config, and the indirection here just obfuscates things with no
benefit.
Add it explicitly for centos too. (I think it is pulled in by packages which
contain pkg-config modules anyway, but it's better to be explicit).
Yu Watanabe [Sun, 16 Apr 2023 06:31:10 +0000 (15:31 +0900)]
exec-util: make execute_strv() optionally take root directory
Preparation for rewriting kernel-install in C.
Yu Watanabe [Sun, 16 Apr 2023 10:39:58 +0000 (19:39 +0900)]
Merge pull request #27283 from mrc0mmand/assorted-test-tweaks
test: a bunch of assorted tweaks, Saturday edition
Yu Watanabe [Sun, 16 Apr 2023 07:28:26 +0000 (16:28 +0900)]
Merge pull request #27253 from yuwata/cmsg-find-and-copy-data
socket-util: introduce CMSG_FIND_AND_COPY_DATA()
Frantisek Sumsal [Sat, 15 Apr 2023 20:22:56 +0000 (22:22 +0200)]
test: add a couple of tests with invalid UTF-8 characters