1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-11 21:57:53 +03:00

67182 Commits

Author SHA1 Message Date
Lennart Poettering
894a30ef3f core: don't manually destroy timer when we can't spawn a child
Let's stop manually destroying the timers when we fail to spawn a child.
We don't do this in any of the similar codepaths in any of the unit
types, only in two specific ones in socket/swap. Destroying the timer is
unnecessary, since this is done anyway in the _set_state() call of each
unit type if not appropriate, and every failure path here runs through
that anyway.

This brings all these similar codepaths into sync.
2023-09-09 14:10:54 +02:00
Lennart Poettering
436cdf0a07 core: also port swap units to PidRef 2023-09-09 14:10:41 +02:00
Lennart Poettering
360f384fd9 core: also port mount units to PidRef 2023-09-09 14:03:31 +02:00
Lennart Poettering
43a19142cb core: convert Socket logic to PidRef too
Just like the previous commit, but for socket rather than service units.
2023-09-09 14:03:31 +02:00
Lennart Poettering
c79ab77cd3 core: reference main/control pid of .service units via PidRef
The first conversion to PidRef. It's mostly an excercise of
search/replace, but with some special care taken for life-cycle (i.e. we
need to destroy the structure properly once done, to release the pidfd).

It also uses pidfd based killing for some of the killing but leaves most
as it is to make the conversion minimal.
2023-09-09 14:03:31 +02:00
Lennart Poettering
3bda3f17fa pidref: add structure that can reference a pid via both pidfd and pid_t
Let's start with the conversion of PID 1 to pidfds. Let's add a simple
structure with just two fields that can be used to maintain a reference
to arbitrary processes via both pid_t and pidfd.

This is an embeddable struct, to keep it in line with where we
previously used a pid_t directly to track a process.

Of course, since this might contain an fd on systems where we have pidfd
this structure has a proper lifecycle.

(Note that this is quite different from sd_event_add_child() event
source objects as that one is only for child processes and collects
process results, while this infra is much simpler and more generic and
can be used to reference any process, anywhere in the tree.)
2023-09-09 14:03:31 +02:00
Daan De Meyer
1e1441d796 mkosi: Allow configuring whether to do secure boot and pcrs from CLI 2023-09-09 10:42:07 +01:00
Luca Boccassi
9aa642d4e9
Merge pull request #29127 from YHNdnzj/wall-followup
shared/wall: several cleanups
2023-09-09 01:30:51 +01:00
Luca Boccassi
2d17808200
Merge pull request #29116 from yuwata/network-sriov-debug
network/sr-iov: ignore EINVAL in reading dev_port sysfs attribute
2023-09-09 01:28:35 +01:00
Ronan Pigott
47f20650b7 zsh: busctl: fix flags parsing for properties
I'm not quite sure what the original intent of this line was, but it
doesn't work in the one call-site the "required" argument is actually
used. The "writable" flag was indexed as a scalar leaving only the
"e" to compare against.

Instead, let's just sort the parsed flags and compare the whole thing.
Also substitute "required" as a pattern, so that pattern based
comparisons may be supported.
2023-09-09 01:28:07 +01:00
Lennart Poettering
7b9da3861a Revert "tree-wide: Mount file descriptors via /proc/<pid>/fd" 2023-09-08 22:13:09 +01:00
Lennart Poettering
0df7d52576 serialize: add common deserialize_read_line() helper and use it everywhere
This introduces a common helper replacing three very similar uses.

Prompted by review of: #27890
2023-09-08 20:59:44 +01:00
Mike Yuan
7af442cf63
TODO: switch the default wall implementation to sd-login 2023-09-09 03:24:52 +08:00
Mike Yuan
560f15fc8f
shared/wall: fall back to logind if utmpx database doesn't exist 2023-09-09 03:22:25 +08:00
Mike Yuan
056aff96b9
shared/wall: several cleanups
Follow-up for 53c0397b1dbc95f144d9a551c2086d132933e8ce

* Split do_wall into wall_utmp and wall_logind
* Don't pass unused arguments
* Add missing asserts
* Modernize error handling
* Don't do anything if neither utmp nor logind is enabled
2023-09-09 03:19:22 +08:00
Mike Yuan
8b2d219316
utmp-wtmp: remove unneeded include 2023-09-09 01:33:32 +08:00
Mike Yuan
93f1da4556 conf-parser: parse main config first only if not symlinked to/as drop-in
Otherwise we'll skip parsing main config directly.

Replaces #27152
Replaces #28956:
chase() is an overkill for determining whether
two files are the same. We only need to check
if the inodes are the same.
2023-09-08 16:25:12 +02:00
Mike Yuan
fc159b2fd9 repart,bootspec: use set_ensure_consume 2023-09-08 16:25:12 +02:00
Alvin Alvarado
a05fa30f88 ukify/man: Look for a config file in systemd folders if not specified
If the user does not specify a config file to use, ukify will try looking for one at {/run,/etc,/usr/local/lib,/usr/lib}/systemd/ukify.conf in order and then use the first one found. Also made sure the --config input is a pathlib.Path by specifying its type in its CONFIG_ITEMS entry.
Big cheers to Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> for helping!
2023-09-08 16:21:28 +02:00
Yu Watanabe
b9962da63f network/sr-iov: move common parts to link_set_sr_iov_ifindices()
This also adds several debugging logs.
No functional change, just refactoring.
2023-09-08 20:09:15 +09:00
Yu Watanabe
4b12a8dd33 network/sr-iov: ignore -EINVAL in reading dev_port sysfs attribute
Fixes #27369.
2023-09-08 20:08:18 +09:00
Mike Yuan
b8f18c3089
Merge pull request #29123 from yuwata/conf-parser-cleanups-for-config-section
conf-parser: several cleanups and generalizations for ConfigSection
2023-09-08 18:11:12 +08:00
Luca Boccassi
30a0f7e310
Merge pull request #29121 from yuwata/network-drop-duplicated
network: drop duplicated checks and function calls
2023-09-08 10:42:08 +01:00
Lennart Poettering
fea82394bc
Merge pull request #29071 from YHNdnzj/loop-write-full
io-util: introduce loop_write_full and use it where appropriate
2023-09-08 10:24:39 +02:00
Daan De Meyer
6ec74f916a mkosi: Drop arch workaround
archlinux-keyring was updated in Michel's PPA so let's drop the
workaround.
2023-09-08 09:20:46 +01:00
Yu Watanabe
e63c6e9ffa conf-parser: introduce ordered_hashmap_by_section_find_unused_line() 2023-09-08 12:55:44 +09:00
Yu Watanabe
d9171a230d conf-parser: check overflow in hashmap_find_free_section_line()
Also, this also renames the function, and makes it optionally takes
a filename.
2023-09-08 12:55:44 +09:00
Yu Watanabe
08ca764d0a conf-parser: modernize config_section_new()
- add assertions,
- rename argument to store result.
2023-09-08 12:55:44 +09:00
Yu Watanabe
7bf9e0d5f6 hashmap: introduce HASHMAP_BASE_FOREACH() and friend 2023-09-08 12:55:44 +09:00
Yu Watanabe
f7f5028edc network: drop duplicated check
The same check is in network_adjust_dhcp_server().
2023-09-08 06:41:37 +09:00
Yu Watanabe
0ae8ff50ac network: drop duplicated address_set_broadcast()
It will be called later in link_request_address().
2023-09-08 06:41:37 +09:00
Frantisek Sumsal
3bf7d79637 ci: temporarily disable Packit's i386
As it currently crashes when extracting debuginfo due to [0] and hangs
until it's killed by the watchdog (which takes ~5 hours).

[0] https://bugzilla.redhat.com/show_bug.cgi?id=2237392
2023-09-07 22:22:56 +01:00
Lennart Poettering
4bba26aea6 tpm2-util: drop support for creating TPM2 trial sessions
This is unused these days, we instead calculate policy hashes ourselves
and do not need trial sessions for that anymore. Given how unreliable
they are in actual TPMs, we don't want to use them anyway, so I don't
think we ever want to readd this.

hence, let's drop this unused feature.
2023-09-07 20:41:54 +01:00
Jan Janssen
b7801869d7 efi: Add some more paranoia asserts 2023-09-07 20:41:12 +01:00
Zbigniew Jędrzejewski-Szmek
c63db5420c
Merge pull request #29036 from YHNdnzj/hibernate-resume-when-battery-low
hibernate-resume: split out the logic of finding hibernate location and support battery-check better
2023-09-07 17:34:27 +02:00
наб
ef658a63f8 parse_timestamp: accept RFC3339-style timezone and %FT%R[:%S[.%N]]
We basically parsed the RFC3339 format already, except with a space:
      NOTE: ISO 8601 defines date and time separated by "T".
      Applications using this syntax may choose, for the sake of
      readability, to specify a full-date and full-time separated by
      (say) a space character.
so now we handle both
  2012-11-23 11:12:13.456
  2012-11-23T11:12:13.456
as equivalent.

Parse directly-suffixed Z and +05:30 timezones as well:
  2012-11-23T11:12:13.456Z
  2012-11-23T11:12:13.456+02:00
as they're both defined by RFC3339.

We do /not/ allow z or t; the RFC says
      NOTE: Per [ABNF] and ISO8601, the "T" and "Z" characters in this
      syntax may alternatively be lower case "t" or "z" respectively.

      This date/time format may be used in some environments or contexts
      that distinguish between the upper- and lower-case letters 'A'-'Z'
      and 'a'-'z' (e.g. XML).  Specifications that use this format in
      such environments MAY further limit the date/time syntax so that
      the letters 'T' and 'Z' used in the date/time syntax must always
      be upper case.  Applications that generate this format SHOULD use
      upper case letters.
We /are/ in a case-sensitive environment, neither are in wide-spread
use, and "z" poses an issue of whether "todayz" should be the same
as "todayZ" ("today UTC") or an error (it should be an error).

Fractional seconds are limited to six digits (they're nominally
   time-secfrac    = "." 1*DIGIT
), since we only support 1µs-resolution timestamps, and limit to six
digits in our other sub-second formats.

Parsing
  2012-11-23T11:12
is an extension two ways (no seconds, no timezone),
mirroring our "canonical" format.

Fixes #5194
2023-09-07 17:33:15 +02:00
Mike Yuan
3a1fc3860f
shared/wall: use loop_write_full 2023-09-07 20:32:45 +08:00
Mike Yuan
e22c60a9d5
io-util: introduce loop_write_full that takes a timeout
Also drop do_poll as the use case is covered
by timeout.
2023-09-07 20:30:44 +08:00
Mike Yuan
89a1bb9012
units: order battery-check before hibernate-resume 2023-09-07 20:21:16 +08:00
Mike Yuan
a628d933cc
hibernate-resume: split out the logic of finding hibernate location
Before this commit, the hibernate location logic only exists in
the generator. Also, we compare device nodes (devnode_same()) and
clear EFI variable HibernateLocation in the generator too. This is
not ideal though: when the generator gets to run, udev hasn't yet
started, so effectively devnode_same() always fails. Moreover, if
the boot process is interrupted by e.g. battery-check, the hibernate
information is lost.

Therefore, let's split out the logic of finding hibernate location.
The generator only does the initial validation of system info and
enables systemd-hibernate-resume.service, and when the service
actually runs we validate everything again, which includes comparing
the device nodes and clearing the EFI variable. This should make
things more robust, plus systems that don't utilize a systemd-enabled
initrd can use the exact same logic to resume using the EFI variable.
I.e., systemd-hibernate-resume can be used standalone.
2023-09-07 20:21:16 +08:00
Lennart Poettering
82b7bf8c1c
Merge pull request #28957 from yuwata/core-mount-set-dirty-on-umount
core/credential,mount: re-read /proc/self/mountinfo before invoking umount command
2023-09-07 11:54:52 +02:00
Christian Kirbach
8e2d9d40b3 po: Translated using Weblate (German)
Currently translated at 85.4% (194 of 227 strings)

Co-authored-by: Christian Kirbach <christian.kirbach@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/de/
Translation: systemd/main
2023-09-07 07:08:28 +09:00
Zbigniew Jędrzejewski-Szmek
1c5d54b2df test: use 'until' instead of 'while !'
In general, it's better to avoid a negation. And "!" is special, because it is
used for history expansion, i.e. the same command would behave differently if
pasted on the command line.

Inspired by 4a899c5a239eb50df3f596af4ff145f4a2d33f23.
2023-09-06 19:54:29 +01:00
David Santamaría Rogado
8b7f0eb6a8 hwdb: keyboard: D330 FnLk toggle
Map Fn+Tab to fn_esc as is FnLock toggle in this keyboard. Still doesn't behave as expected because work in ideapad_laptop kernel module could be required but now at least we report the same mapping in others keyboards with Fn+ESC for FnLock and not unknown.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
2023-09-06 19:00:29 +01:00
Luca Boccassi
7d84904925
Merge pull request #29098 from keszybz/man-page-postreview-fixup
man/systemd-id128: fix example
2023-09-06 18:58:27 +01:00
Jan Janssen
400229eaae man: Add new Microsoft CAs to example
Also, let's use the links from the Microsoft documentation as they are
guaranteed to be stable.

Fixes: #29102
2023-09-06 18:56:51 +01:00
Lennart Poettering
ef65c0f6cc openssl-util: add common implementation of digest+sign 2023-09-06 18:34:21 +01:00
Yu Watanabe
1e1225614c core/credential,mount: re-read /proc/self/mountinfo before invoking umount command
When a unit has credentials, stopping the service unmounts the credentials
directory. On shutdown, stopping the service and the corresponding mount
unit may be done mostly simultaneously, and if we invoke umount command soon
after umount() being called on stopping the service, the mount unit will
fail.

This makes Mount.invalidated_state flag set when umount() is called for a path,
and re-read /proc/self/mouninfo before invoking umount command if the flag is set.

Fixes #25527.
Replaces #26959.
2023-09-07 01:05:13 +09:00
Yu Watanabe
25033cca08 test-execute: check credentials can be read on ExecStartPost= and friends
Prompted by
https://github.com/systemd/systemd/pull/28787#issuecomment-1690614202.
2023-09-07 00:53:28 +09:00
Yu Watanabe
133e4de23f core/exec-credential: introduce exec_context_get_credential_directory() helper function
No functional change, just refactoring.
2023-09-07 00:53:28 +09:00