1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

59403 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
4ccde410a3 tree-wide: change --kill-who to --kill-whom
getopt allows non-ambiguous abbreviations, so backwards-compat is maintained, and
people can use --kill-who (or even shorter abbreviations). English is flexible,
so in common speach people would use both forms, even if "whom" is technically
more correct. The advantage of using the longer form in the code is that we
effectively allow both forms, so we stop punishing people who DTGCT¹, but still
allow people to use the spoken form if they prefer.

1. Do the gramatically correct thing
2022-08-26 11:15:44 +09:00
Yu Watanabe
2f968def11
Merge pull request #24454 from bluca/ci
Fix Ubuntu/SUSE mkosi
2022-08-26 11:13:53 +09:00
Luca Boccassi
a26e6bf8bf mkosi: add back packages removed from OpenSUSE build
Some packages were removed from the OpenSUSE build, which broke the
unit tests. Add them back.

Fixes: 37d35150cbb5 ("mkosi: Ensure we build all features/components in mkosi")
2022-08-26 00:12:55 +01:00
Luca Boccassi
255963ec3a mkosi: disable isc-dhcp-server again
It's still failing in Ubuntu:

● isc-dhcp-server.service  loaded failed failed ISC DHCP IPv4 server
● isc-dhcp-server6.service loaded failed failed ISC DHCP IPv6 server

Just disable them via the kernel command line masking.
2022-08-25 23:02:29 +01:00
Lennart Poettering
abd6faae80 journal: rename special journal field _SYSTEM_CONTEXT= → _RUNTIME_SCOPE=
Previously the field "_SYSTEM_CONTEXT" knew he values "initrd" + "main". Let's change
this to "_RUNTIME_SCOPE" and "initrd" + "system".

Why? The sysext logic has a very similar concept of "scopes", declaring
whether a sysext image is intended for the initrd or the main system.
Let's thus use the same naming for both.

sysext's extension-release files hence know SYSEXT_SCOPE=initrd|system,
and the journal messages know _RUNTIME_SCOPE=initrd|system, which makes
this reasonably systematic.

Follow-up for: cae8edd93ca2ef90c41cb9b6322b6908d12947b5

(This is not an API break, since no version with this commit has ever
been released.)
2022-08-25 22:27:26 +01:00
Daniel Braunwarth
bf07a12516 pid1: extend "ConditionFirmware=" for checking SMBIOS system identification information 2022-08-25 21:44:21 +01:00
Jan Janssen
de9b57a130 mkosi: Print logs of failing tests 2022-08-25 21:42:57 +01:00
Yu Watanabe
039f42842a core/mount: voidify unit_acquire_invocation_id()
Follow-up for 01400460ae16c6522d11d08dd9a4b0928e7980d9.

Fixes CID#1491960.
2022-08-25 19:58:35 +00:00
Frantisek Sumsal
81d7682af7
Merge pull request #24442 from yuwata/udev-retry-event
udev: make requeued event actually restarted
2022-08-25 19:57:19 +00:00
Yu Watanabe
72715f3d13 virt: fix alignment
Follow-up for f5558306746c0791dab666e76d51e7ef1ce38362.
2022-08-25 16:23:05 +00:00
Frantisek Sumsal
0f1f562974 test: make TEST-63 more reliable on slower machines
Otherwise we might never hit the trigger limit and wait indefinitely.

Found when trying to run the test on an EC2 xen machine without a nested
virt in CentOS CI (in preparations for some ... unforseseen consequences).
2022-08-25 16:21:39 +00:00
Yu Watanabe
5fab6b7b18 udev: drop unnecessary calls of event_queue_start()
As the subsequent call of on_post() will call it if necessary.

This also drop unnecessary call of event_source_disable() for killing
idle workers, as the event source is disabled in event_queue_start().
2022-08-26 00:40:57 +09:00
Yu Watanabe
4f294ffdf1 udev: certainly restart event for previously locked device
If udevd receives a uevent for a locked block device, then the event
is requeued. However, the queued event will be processed only when at
least one sd_event_source is processed. Hence, if udevd has no event
under processing, or receives no new uevent, etc., then the requeued
event will be never processed.

Follow-up for 400e3d21f8cae53a8ba9f9567f244fbf6f3e076c.

Fixes #24439.
2022-08-26 00:40:47 +09:00
Luca Boccassi
80c2f3e4cf mkosi: use the just built systemd-sysusers instead of groupadd
It disappeared again from SUSE Tumbleweed. Just use sysusers since we
just built it.
2022-08-25 13:52:00 +00:00
Lennart Poettering
13be736d1f
Merge pull request #24408 from keszybz/execstart-escape
Properly escape ExecStart= commandlines in transient units
2022-08-25 11:40:57 +02:00
Lennart Poettering
5b9ae04c65
Merge pull request #24242 from msekletar/terminate-idle-sessions
Add option to stop idle sessions after specified timeout
2022-08-25 11:39:42 +02:00
Jan Janssen
13d9616c56 shutdown: Fix last try detection
This was missed in 5125b67742567de79c12e31f434a11d787b4f6b1.
2022-08-25 11:38:33 +02:00
Lennart Poettering
2220ef8972
Merge pull request #24429 from poettering/selinux-code-improv
minor selinux-util.c modernization
2022-08-25 11:35:14 +02:00
Devendra Tewari
aa181897cf systemd-growfs: remove dependency on udev symlinks
systemd-growfs currently requires that udev ran first to work (because
/dev/block/ symlinks must exist) but that is not what happens when
we're not using initrd and systemd is PID1.
2022-08-24 21:42:16 +01:00
Lennart Poettering
782c6e5c90 time-util: fix overflow condition in usec_sub_signed()
If the delta specified is INT64_MIN, and we negate that we'd end up at
INT64_MAX+1 which is outside of the int64_t type. Hence let's treat this
case specifically to avoid unintended overflows.
2022-08-24 21:41:40 +01:00
Franck Bui
2306b4656a core: allow disabling system time correction if rtc returns time far in the future
There might be (embedded) systems that get never updated (things like
e.g. entertainment systems of trains, for example) and where the adjustment of
the system clock (introduced by b10abe4bba61aebe4c667c412741193f11886298) would
do the wrong thing even if the difference between the systemd build time and
the rtc is 15 years or more.

This patch allows disabling the adjustment by setting
'clock-valid-range-usec-max' meson option to 0 or to a negative value.
2022-08-24 21:39:46 +01:00
Richard Phibel
34683dbdd0 journald: use rate-limited logging to log 'Failed to write entry' message 2022-08-24 21:39:20 +01:00
Luca Boccassi
298b3de6d4
Merge pull request #24370 from keszybz/sysusers-equivs
Use /bin/bash for root shell and suppress some warnings from sysusers
2022-08-24 21:35:28 +01:00
Lennart Poettering
073597665a selinux-util: add safety size check before doing strdupa() 2022-08-24 17:32:43 +02:00
Lennart Poettering
09f7e8d603 selinux-util: modernizations
Let's no bother with reading return value of libselinux API calls into
r, if the actual error is in errno anyway.

Let's remove one unnecessary strdup()

Let's rename a return parameter ret_xyz
2022-08-24 17:32:12 +02:00
Lennart Poettering
771fe73c75
Merge pull request #24072 from poettering/remove-cgroupsv1-docs
decgroupsv1ification: first steps – remove from docs, and generate warnings
2022-08-24 17:00:53 +02:00
Michal Sekletar
5aa633db22 tests: add test for StopIdleSessionSec= option 2022-08-24 14:50:52 +02:00
Michal Sekletar
82325af3ae logind: add option to stop idle sessions after specified timeout
Thanks to Jan Pazdziora <jpazdziora@redhat.com> for providing a patch
which implemeted a PoC of this feature.
2022-08-24 14:50:48 +02:00
Lennart Poettering
98f3e84342
Merge pull request #24420 from keszybz/mouse-power
Rework on_ac_power()
2022-08-24 10:16:14 +02:00
Zbigniew Jędrzejewski-Szmek
8795d9bacd basic/user-util: rename output param to ret, shorten code 2022-08-24 10:02:46 +02:00
Zbigniew Jędrzejewski-Szmek
36bac2dcba basic/user-util: avoid filesystem access check
The check of u==UID_NOBODY is just a register comparison, but
synthesize_nobody() requires a system call, so let's invert the order in the
condition. Since most calls into this module are not for nobody, we should
save one syscall in the common case.
2022-08-24 10:02:46 +02:00
Zbigniew Jędrzejewski-Szmek
4c795066b6 sysusers: report the original error when writing fails
We have fairly nice error messages for specific operations, but only at debug
level. Instead, we'd print a fairly useless generic message:

Before:
Failed to write files: Invalid argument

After:
Failed to add existing group "users" to temporary group file: Invalid argument

Fixes #10241.
2022-08-24 10:02:46 +02:00
Zbigniew Jędrzejewski-Szmek
8a7adccbdb various: try to use DEFAULT_USER_SHELL for root too
/bin/sh as a shell is punishing. There is no good reason to make
the occasional root login unpleasant.

Since /bin/sh is usually /bin/bash in compat mode, i.e. if one is
available, the other will be too, /bin/bash is almost as good as a default.
But to avoid a regression in the situation where /bin/bash (or
DEFAULT_USER_SHELL) is not installed, we check with access() and fall back
to /bin/sh. This should make this change in behaviour less risky.

(FWIW, e.g. Fedora/RHEL use /bin/bash as default for root.)

This is a follow-up of sorts for 53350c7bbade8c5f357aa3d1029ef9b2208ea675,
which added the default-user-shell option, but most likely with the idea
of using /bin/bash less ;)

Fixes #24369.
2022-08-24 10:02:46 +02:00
Zbigniew Jędrzejewski-Szmek
5f465fda4e sysusers: do not warn about values that equivalent
We'd warn that "-" and "/sbin/nologin" are different, even even though
"/sbin/nologin" is the default we'd use. So let's stop warning in all cases
where the config would lead to the same file, also under different paths,
or when both shells are nologin shells.

The general idea is to avoid warnings when sysusers config is moved between
packages (and not exactly the same), or when it is generated from some template
and the details change in an unimportant way.

We try to chase symlinks. This means that on unmerged-usr systems we'll find
that e.g. /usr/bin/bash and /bin/bash are equivalent if the basic fs structure
is already in place (bash doesn't actually have to be installed, enough that
the /bin symlink exists). I think this is a good result: after all, /bin/bash
and /usr/bin/bash *may* be different things on an unmerged-usr system.

Fixes #24215.
2022-08-24 10:02:46 +02:00
Zbigniew Jędrzejewski-Szmek
24536bebe0 core: escape ExecStart command-line received over d-bus
When some transient unit setting is received over D-Bus, we write it it to a
transient unit file. We escape backslashes and specifiers. For most settings
this is enough, because most settings only do parsing and interpolation of
specifiers. When systemd-run is called (or something equivalent that gives us a
command strv), we write ExecStart=, but when reading it, we not only do parsing
and interpolation of specifiers, but also split on semicolons and do variable
substitution. This results in an ugly situation where the commandline is
interpolated twice, once on the caller side, and once in the manager.

I think we need to treat this as a bug: current behaviour seems to be an
accident of implementation and hard to explain in a reasonable way. If we
*were* doing specifier expansion, then it'd be somewhat reasonable so say that
"the commandline is handled the same as ExecStart=". But since we explicitly
prevent specifier expansion, we best we could say is "the commandline has some
subset of features of ExecStart=". I think this is not useful, and unexpected
by users. Since most people use use a shell to call systemd-run, one level of
variable expansion is already done on the caller side, and having to take into
account another level of expansion (with slightly different rules), creates a
big mental overhead when the commandline needs to include a dollar character or
such. Not doing any expansion is much cleaner and easier to explain or use.
Thus I think it's better to change behaviour here, even though in principle
some people could be relying on current behaviour. I think it's more likely
that nobody noticed, because people generally don't use systemd-run for
complicated commandlines.

Thus this commit adds an additional mode of escaping that prevents variable
explansion and other elements of ExecStart= syntax. I looked over all the
places where unit_escape_setting() is called, and I think that only two need to
be changed to use the new flag.

Fixes #23631.
2022-08-24 09:54:48 +02:00
Zbigniew Jędrzejewski-Szmek
6a6707ce85 man/run: we accept relative paths for run
I think this is a left-over from before we changed ExecStart= to allow
non-absolute paths, *and* changed systemd-run itself to resolve paths too.
2022-08-24 09:54:45 +02:00
Lennart Poettering
e820ca0193
Merge pull request #24071 from bluca/path_trigger_report
path/timer units: export env vars and D-Bus properties with reason that triggered the job
2022-08-24 09:35:59 +02:00
Zhaofeng Li
f555830674 virt: Support detection of Apple Virtualization.framework guests 2022-08-24 09:34:54 +02:00
David Jaša
ce0a056abc check-os-release.py compatible with Python < 3.8
The ":=" operator was only added in Python 3.8 so splitting the line with it into two makes check-os-release.py actually fulfill its claim of working with any python version.
2022-08-24 12:08:17 +09:00
Luca Boccassi
c8bc7519c8 service: set TRIGGER_UNIT= and TRIGGER_TIMER_REALTIME_USEC/MONOTONIC_USEC on activation by timer unit
Same as path unit, best effort.
2022-08-23 21:19:54 +01:00
Luca Boccassi
4c42032854 service: set TRIGGER_UNIT= and TRIGGER_PATH= on activation by path unit
When a service is triggered by a path unit, pass the
path unit name and the path that triggered it via env vars
to the spawned processes.
Note that this is best-effort, as there might be many triggers
at the same time, but we only get woken up by one.
2022-08-23 20:38:08 +01:00
Luca Boccassi
48b92b37ac core: add basic infrastructure to record unit activation information
Not wired in by any unit type yet, just the basic to allocate,
ref, deref and plug in to other unit types.
Includes recording the trigger unit name and passing it to the
triggered unit as TRIGGER_UNIT= env var.
2022-08-23 20:38:08 +01:00
Luca Boccassi
f52faaf923 glob: add glob_first(), returns first match
Note that which match is returned depends on the system and is
not guaranteed to be stable
2022-08-23 20:04:41 +01:00
Luca Boccassi
d4f38ff036 test-63: convert to full shell script and generalize
Will add more path unit tests later
2022-08-23 20:04:41 +01:00
Sonali Srivastava
1afe3d712e sleep: support acpi_btp and suspend system if enabled, skipping custom timer 2022-08-23 19:36:51 +01:00
Daan De Meyer
cae8edd93c journal: Add new _INITRD field
The _INITRD field is a boolean field (0 or 1) that specifies whether
a message was processed by systemd-journald in the initrd or not.
2022-08-23 19:35:04 +01:00
Luca Boccassi
5e98346220
Merge pull request #24254 from medhefgo/mold
ci: Add mold to build tests
2022-08-23 19:33:47 +01:00
Luca Boccassi
4a515c5bd6
Merge pull request #24396 from poettering/no-more-dirname
stop using dirname()/dirname_malloc()
2022-08-23 19:32:52 +01:00
Lennart Poettering
3a21f51c58 measure: fix minor memory leak
When using --current switch, copy in current hash, don't just reassign
buffers forgetting about the old.

While we are at it, allocate the local copy buffer later, in
measure_pcr() as we won#t need it in the --current case.
2022-08-23 19:31:58 +01:00
Frantisek Sumsal
bca762ce1a test: wait for the lodev to get properly initialized
Otherwise we might start writing to one of its partition before the
respective node is created under /dev, resulting in... interesting
stuff.

Resolves: #24390
2022-08-23 17:38:43 +00:00