1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-02 09:47:03 +03:00

62782 Commits

Author SHA1 Message Date
Luca Boccassi
64ef6ccd4f ci: do one build with no tpm/p11kit/fido2
We have some missing coverage in the CI, all builds enable these features,
but there are often changes and they cover a lot of code. Do one build
without them to ensure we don't break builds.

(cherry picked from commit b7b48b389c5e68154f72133ec5d12ca2412aa406)
2023-04-27 21:30:38 +01:00
Yu Watanabe
018461aaf0 man: mention -o option for systemd-journal-remote
(cherry picked from commit bc729e81f2622961ef8428df46bb000197706f70)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
31c7f6d0d1 manager: remove transient unit directory during startup
I was testing transient units and user@.service crashed. I restarted it, and
tried to create a transient unit. It failed because
/run/user/1000/systemd/transient/ remained after the previous aborted run:
  Failed to start transient service unit: Unit run-u0.service was already loaded or has a fragment file.

Remove the directory during initial startup so we don't get confused by our own
files.

(cherry picked from commit 45f540a2974dc732820d20a0e73cfffc94766a70)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
49c6965946 core: a more informative error when SetProperties/StartTransientUnit fails
I was changing how some properties are appended to the StartTransientUnit call
and messed up the message contents. When something is wrong with how the
message is structed, we would return a very generic
"Failed to start transient service unit: No such device or address".

Mention that it was property setting that failed, and translate ENXIO to a
different message. bus_unit_set_properties() or any of the children it calls
may also return other errors, in particular EBADMSG or ENOMEM, but the error
message that is generated for those is understandable, so we don't need to
"translate" them explicitly.

bus_unit_set_properties() is called from two places, so it seems nicer to
generate the message internally, rather than ask the caller to do that. Also,
now bus_unit_set_properties() always sets <error>, which is nicer for the
callers.

(cherry picked from commit 44d82df46e38c5bc36ed3722301eeae15df29763)
2023-04-27 21:30:38 +01:00
Yu Watanabe
649e335bc1 journald: fix log message
(cherry picked from commit 01aa59979bc61125f599a5b8a6c911fff5daaee7)
2023-04-27 21:30:38 +01:00
taniishkaaa
eda7bf237f Added unit test for strv_env_name_is_valid() function listed in env-util.c (#27100)
tests: add test for strv_env_name_is_valid function listed in env-util.c
(cherry picked from commit 6cc19afac1332d070d203e12c4f5039c5ea8ae8c)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
0430078cfb man: restore description of ConditionControlGroupController=v1|v2
We use ConditionControlGroupController=v2 in systemd-oomd.service, and also
this condition makes sense in general, so it should be documented.

This reverts a part of 6d48c7cf736ced70c1c2fef1e1f03618911d04bc.

Deprecated commandline options and v1 controller names were removed from
the description.

(cherry picked from commit c32f496b9e7326584e49ae478539c4bc5c51ebe1)
2023-04-27 21:30:38 +01:00
Frantisek Sumsal
0d9c2c270b test: set ReadWritePaths= for test-.services when built w/ coverage
Let's make the dropin, to make the build dir writable for gcov, a bit
more generic, so it can be used by all units starting with prefix test-.
This should help with a bunch of recent reports about missing coverage I
got, as well as with existing test units using DynamicUser=true.

This might feel a bit like a magic trick from behind the curtains, but I
want to touch the actual tests as little as possible, since it makes them
unnecessarily messy (see the various workarounds for sanitizers), and
the coverage reports are generated only in a specific CI job anyway.

(cherry picked from commit e660c590a5222bc72f7aea8912806aa48b0fb126)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
384fec2622 core: skip deps on oomd if v2 or memory unavailable
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2055664
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2172146

User report that systemd repeatedly logs about not being able to start oomd
when booted with v1:

Feb 20 16:52:33   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).
Feb 20 16:52:34   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).
Feb 20 16:52:34   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).
Feb 20 16:52:34   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).
Feb 20 16:52:34   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).
Feb 20 16:52:34   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).
Feb 20 16:52:34   systemd[2067491]: Queued start job for default target default.target.
Feb 20 16:52:34   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).
Feb 20 16:52:34   systemd[2067491]: Created slice app.slice - User Application Slice.
Feb 20 16:52:34   systemd[1]: systemd-oomd.service - Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2).

systemd-oomd.service that pulls systemd-oomd.socket in (because it requires
it); systemd-oomd.service itself is pulled by user@.service because
systemd-oomd package installs an override config file that sets
ManagedOOMMemoryPressure=kill.

Add a check to the code that adds the implicit dependency to skip the
dep if we cannot start it. The check is done exactly the same as in oomd
itself.

(cherry picked from commit 2a4efebb3ba762468937dd45d0b1cb51a5122fde)
2023-04-27 21:30:38 +01:00
OMOJOLA JOSHUA DAMILOLA
2950b4ebf6 test: fixed negative checks in TEST-70-TPM2.
Use in-line error handling rather than redirections. Follow up on #27020

(cherry picked from commit 27d45db38c29d0eb5e2d707507b066438340a792)
2023-04-27 21:30:38 +01:00
Frantisek Sumsal
786649c904 test: make make_addresses() actually return the addresses
I noticed missing coverage in the reports and turns out this has been
broken since forever (i.e. 2016 - 9f7672b3bc), whoopsie.

(cherry picked from commit 1d6052ba5c9533227bdcc3d3368392726981abaf)
2023-04-27 21:30:38 +01:00
Frantisek Sumsal
5e3ac73017 coverage: add a wrapper for execveat()
gcov provides wrappers for the exec*() calls but there's none for execveat(),
which means we lose all coverage prior to the call. To mitigate this, let's
add a simple execveat() wrapper in gcov's style[0], which dumps and resets
the coverage data when needed.

This applies only when we're built with -Dfexecve=true.

[0] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/libgcov-interface.c;h=b2ee930864183b78c8826255183ca86e15e21ded;hb=HEAD

(cherry picked from commit 4388541237e3cdab6821c1b626bb6314027277b4)
2023-04-27 21:30:38 +01:00
Luca Boccassi
8b1cc644c5 man: add example for sd_bus_call_method
(cherry picked from commit ce199d12e9a88286271dec6f22cd2c61f1cd7f54)
2023-04-27 21:30:38 +01:00
Luca Boccassi
382e53977c man: further shorten print-unit-path example
(cherry picked from commit d10a5f6c3de64fcaa71855d9a94394ea8317038a)
2023-04-27 21:30:38 +01:00
Lennart Poettering
960f05945c man: link up new online coredump docs from man page
(cherry picked from commit bba6046b241c0e073a6f70ef1f418434c72d3161)
2023-04-27 21:30:38 +01:00
Yu Watanabe
edfca36727 tree-wide: reset optind to 0 when GNU extensions in optstring are used
Otherwise, if getopt() and friends are used before parse_argv(), then
the GNU extensions may be ignored.

This should not change any behavior at least now, as we usually use
getopt_long() only once per invocation. But in the next commit,
getopt_long() will be used for other arrays, hence this change will
become necessary.

(cherry picked from commit ef9c12b157a50d63e8a8eb710c013d16c2cea319)
2023-04-27 21:30:38 +01:00
Yu Watanabe
91ff21962d test-kernel-install: several cleanups
- allow to run without $PROJECT_BUILD_ROOT,
- drop unnecessary export for bootctl,
- enable -x option to show commands,
- use 'test ! -e' to check the nonexistence of files,
- show more debugging logs.

(cherry picked from commit 0362953e9a5e472b5cd66687e79a957b37e35e09)
2023-04-27 21:30:38 +01:00
Lennart Poettering
9943f2af3d units: let's establish the coredump socket before writting core_pattern sysctl
It's a bit nicer if we only write the sysctl core_pattern once the
coredump socket is established, since it's the backend for the handler.

Given the systemd-coredump.socket basically has no dependencies that run
before it this should not really make things slower or so, it just
removes the tiny window where core pattern is in effect that wants to
connect to the backend socket but cannot.

The status quo isn't terrible, and not too different in effect: either
way, until the socket unit is up we won't process coredumps. It's mostly
what kind of behaviour you get then: an error due to /bin/false being
invoked, or an error because systemd-coredump can't connect to its
socket. After this patch we'll exclusively see the former.

(cherry picked from commit 62c72c60b5e6c0712a45b1feccc6cc18151efa9c)
2023-04-27 21:30:38 +01:00
Luca Boccassi
dbb1b9c2c8 test: do not remove state directory on failure
The test log is in the state directory, and we want to keep it around
when a test fails.

Follow-up for: 256a835f1c6c646a55039659aa2db186fbeb5c5d

(cherry picked from commit 49e8342965649503a537beacb77dd0fafc71debe)
2023-04-27 21:30:38 +01:00
Luca Boccassi
29cfb05183 test: fix shellcheck warnings in test-sysusers.sh
(cherry picked from commit d79881c530ca18f5387b94f272576a6160405da4)
2023-04-27 21:30:38 +01:00
Luca Boccassi
18afac6e90 man: fix shellcheck warning for html.in
SC2015: Note that A && B || C is not if-then-else. C may run when A is true.
(cherry picked from commit a5979f0bd50234ff9cad47f160d121628e0e3bbe)
2023-04-27 21:30:38 +01:00
OMOJOLA JOSHUA DAMILOLA
4629419038 added more test cases
(cherry picked from commit e2a4411a2b683e3e5b78c1d4931b5e1029d3ba6e)
2023-04-27 21:30:38 +01:00
Franck Bui
05ae9e276c test: fix regexp in testsuite-74.mount.sh
Several whitespaces can separate "ext4" and "sd-mount-test" strings.

(cherry picked from commit 208d9ad16840aa781efb68bb9c7b1d8f7d03760a)
2023-04-27 21:30:38 +01:00
Franck Bui
295012f7fa test: drop extraneous bracket in testsuite-74.mount.sh
(cherry picked from commit 8607a39e0886f83c9c9f34ae4457c927ef4a932e)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
ff7040b193 busctl: also assume --full if not writing to terminal
If people grep the output, it probably shouldn't be ellipsized.

(cherry picked from commit f735076c548abe9878e98c2da044458dd0e684f3)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
00977a8e74 busctl: use size_t for set size
Also reduce the scope of variables.

(cherry picked from commit bc1f1eba776434f84f082bf4935b736c94dbb0f1)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
802fded9a5 busctl: do not truncate property values when --full
(cherry picked from commit d82267e567698e23e8fd915f057d5d67c912aa09)
2023-04-27 21:30:38 +01:00
Zbigniew Jędrzejewski-Szmek
e400a62a92 oomd: add inline comments with param names
(cherry picked from commit ebfb601945b564142d6471fc10aa611c26dbd8b7)
2023-04-27 21:30:38 +01:00
Yu Watanabe
4067ec52f4 test: add more testcases for rm_rf()
(cherry picked from commit 0278b1c80101cc0d857c1becd0c3a51b2eb14a44)
2023-04-27 21:30:38 +01:00
Yu Watanabe
201830df21 rm-rf: also chmod() directory if it cannot be opened
Otherwise, directory with zero access mode cannot be removed.

(cherry picked from commit 808c8b25eece33c503430151641f5f77676af38c)
2023-04-27 21:30:38 +01:00
Yu Watanabe
d91f7eb0fb rm-rf: mask file mode with 07777 when passed to chmod()
No functional change hopefully, just for safety.

(cherry picked from commit da19c07198167946d35be9fdf908bb683da49cfe)
2023-04-27 21:30:38 +01:00
Yu Watanabe
80417f90b0 rm-rf: fix errno handling
(cherry picked from commit cd2cd095db6f26bf9889ef26f1b105843220b803)
2023-04-27 21:30:38 +01:00
Mike Yuan
ed18c2ab79 core/main: also check the argument terminator
For future-proof reasons, in case we will add
another option that starts with --deserialize.

Addresses 4f44d2c4f7 (r107285603)

(cherry picked from commit 09567df7db75824f1b8bf0b5cc721febda03cb56)
v253.3
2023-04-03 21:58:37 +01:00
Mike Yuan
4f4e0bab0d core: do early setup check for arguments with '=' too
Follow-up for d2ebd50d7f9740dcf30e84efc75610af173967d2

We now modify our cmdline to use '=' for all arguments,
but didn't change early setup check to work with that.
So every daemon-reexec does a full setup, thus breaking
running user sessions.

Fixes #27106

(cherry picked from commit 4f44d2c4f76922a4f48dd4473e6abaca40d7e555)
2023-04-03 00:10:52 +01:00
Дамјан Георгиевски
a3f2884ef2 add a github workflow action to make a release from tags
make a github release for every tag that starts with `v*`,
and a pre-release if the tag contains "-rc".

on the 'systemd/systemd' repo, the "Release" will be draft, so that the
release manager can fill up the notes manually.

on 'systemd/systemd-stable' the release will be created immediately.

info about the action used:
https://github.com/softprops/action-gh-release

(cherry picked from commit 86c20937c29da637878a1282444b057bc1a519fb)
2023-04-03 00:10:52 +01:00
Luca Boccassi
c5bc8bb080 CI: install python3-pyelftools for mkosi job
mkosi's action added it after the pin, but we can't move forward
without other systemd changes
2023-03-30 01:45:40 +01:00
Daan De Meyer
af0c090db5 mkosi: Narrow glob used to install python packages
Let's make sure we only install the python3 and python39 python
packages, instead of all the packages of all versions that are
packaged.

This also fixes the CentOS 8 CI because python3.11-pytest was failing
to install.

We have to ship our own powertools repo definition because we need to
enable module_hotfixes for powertools to coerce dnf into installing
some of the python packages.

(cherry picked from commit 89de1d983ea84d7147011c52b55aa47a7cce862c)
2023-03-30 01:45:40 +01:00
Zbigniew Jędrzejewski-Szmek
bfc03cae41 shared/exec-util: null_or_empty_path() does not return boolean
We shouldn't report that the file is empty if the stating fails. Let's do the
same as in other places, and just ignore the error and let the subsequent
operation fail.

(cherry picked from commit 7d0c47dad0d4282c3924a654a8fe18fc5d7766f8)
v253.2
2023-03-29 16:56:51 +02:00
Lennart Poettering
a2ef3c97bd man: correct/tweak text about unit name syntax
Unit names can be 255 characters long, not 256.

We first say "name prefix" and then continue with "unit prefix".
Confusing. Couldn't figure out which term is better hence settled on
"unit name prefix".

(cherry picked from commit 75f7e5e54704e643aa9b50ce03ed02a49e75333f)
2023-03-29 16:56:51 +02:00
David Tardon
e4c7553874 journal-vacuum: count size of all journal files
Currently, active journal files are excluded, which means that vacuuming
may not remove anything even if *MaxUse= has been exceeded.

(cherry picked from commit 9ea46af4f2368b41d57705bac09774778126507f)
2023-03-29 16:56:51 +02:00
Frantisek Sumsal
e1ddc48ff9 test: add a couple of tests for userdbctl
(cherry picked from commit 93fe228bb16afdb7c450af26b4d2e5771016a833)
2023-03-29 16:56:51 +02:00
Frantisek Sumsal
0e7745249b userdbctl: flush stdout before running the chain command
Otherwise it's quite difficult to capture the entire output:

$ userdbctl ssh-authorized-keys dropinuser --chain /bin/echo hello
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA//dxI2xLg4MgxIKKZv1nqwTEIlE/fdakii2Fb75pG+ foo@bar.tld
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMlaqG2rTMje5CQnfjXJKmoSpEVJ2gWtx4jBvsQbmee2XbU/Qdq5+SRisssR9zVuxgg5NA5fv08MgjwJQMm+csc= hello@world.tld
hello
$ userdbctl ssh-authorized-keys dropinuser --chain /bin/echo hello | tee
hello

(cherry picked from commit 5b09499cacd3c1c95ab240d041e28cc954a5975d)
2023-03-29 16:56:51 +02:00
Frantisek Sumsal
e17d4351a7 docs: s/authorized_key/authorized_keys/
(cherry picked from commit 13bf3216101af82d36e24e5a95f450f166f5030b)
2023-03-29 16:56:51 +02:00
Frantisek Sumsal
5d2588b594 man: s/io.systemd.Dropin/io.systemd.DropIn/
(cherry picked from commit 8f572d0d82f2f8bb3995faa569da5af1ef7a427d)
2023-03-29 16:56:51 +02:00
Frantisek Sumsal
1185e7f9d3 userdbctl: don't show legend when dumping JSON with services
(cherry picked from commit eedd1da9f992f9b9d38e298207428500b745156b)
2023-03-29 16:56:51 +02:00
Lennart Poettering
7822ae021b analyze: don't claim "@known" was an unlisted syscall
It's a sycall group of our own definition, and the output is erroneous
to claim otherwise. Let's hide it.

This adds syscall_set_add() which is nicely symmetric to the existing
syscall_set_remove().

Follow-up for: 6d6a08547c03f96dc798cda1ef4a8d3013d292d5

(cherry picked from commit 950c0ed38935198a67a57c645e499555eaf006eb)
2023-03-29 16:56:51 +02:00
Lennart Poettering
54f97c0ae5 seccomp-util: add some newer syscalls to existing groups
These three new syscalls are mostly just new flavours or extensions of
existing syscalls, hence add them to the same groups.

(cherry picked from commit 76e86b8dd8cca9f9fee120289945b29e1dbbe215)
2023-03-29 16:56:51 +02:00
Zbigniew Jędrzejewski-Szmek
90ba721560 xdg-autostart-generator: do not warn about unknown fields
My user manager says:
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.gnome.Terminal.desktop:256: Unknown key name 'Actions' in section 'Desktop Entry', ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.gnome.Terminal.desktop:258: Unknown section 'Desktop Action new-window'. Ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.gnome.Terminal.desktop:343: Unknown section 'Desktop Action preferences'. Ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.telegram.desktop.desktop:12: Unknown key name 'Actions' in section 'Desktop Entry', ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.telegram.desktop.desktop:13: Unknown key name 'SingleMainWindow' in section 'Desktop Entry', ignoring.
systemd-xdg-autostart-generator[2933]: /home/zbyszek/.config/autostart/org.telegram.desktop.desktop:19: Unknown section 'Desktop Action Quit'. Ignoring.

This is not useful. Those are externally-provided files, and they are likely to
have entries which we know nothing about.

(cherry picked from commit b5a70eeecdb593f8498c0bc163d5a12297cfb55d)
2023-03-29 16:56:51 +02:00
наб
f6388f561c find-esp: don't silently error bootctl install if presumed XBOOTLDR part is stx_dev_major=0 but not btrfs
btrfs_get_block_device_fd() returns -ENOTTY if fstatfs().f_type !=
BTRFS_SUPER_MAGIC

btrfs_get_block_device_fd() is run by verify_fsroot_dir() by
verify_xbootldr() by find_xbootldr_and_warn() if
statx($presumed-XBOOTLDR).stx_dev_major == 0 ("maybe a btrfs device")

Every bootctl verb_install() runs find_xbootldr_and_warn(), by default
with /boot

If your /boot .stx_dev_major=0 but /not/ btrfs, bootctl install/update
quietly exits 1 with no note so as to what exactly failed (debug also
empty, and the strace isn't exactly clear since no syscall actually
failed)

This is the case on ZFS and the Debian filesystem layout: /boot/efi is
the ESP, and everything else under / is ZFS:
  $ sudo env SYSTEMD_LOG_LEVEL=debug bootctl update
  Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
  Found container virtualization none.
  File system "/boot" is not a FAT EFI System Partition (ESP) file system.
  Using EFI System Partition at /boot/efi.
  Checking whether /boot/efi/EFI/systemd/ contains any files…
  $ echo $?
  1
and funnier still:
  $ sudo bootctl update --graceful
  $ echo $?
  1

Which is great, and also breaks postinst, which runs precisely the
latter, with no feedback at all

By checking for -ENOTTY we accept that the path being investigated
"is not it" if it's on ZFS (and any other filesystem that returns
.stx_dev_major == 0 but isn't btrfs)

(cherry picked from commit ed89819f8fd7bfe99cd652082076e85e1417e4e9)
2023-03-29 16:56:51 +02:00
Tobias Powalowski
f492ca7b5d ukify: allow uncompressed kernel images for UNAME detection on aarch64 and riscv64 (#26929)
Uncompressed aarch64 and riscv64 kernels have a different startpoint than x86.
Example output from ukify:
aarch64: NotImplementedError: unknown file format (starts with b'MZ@\xfa')
riscv64: NotImplementedError: unknown file format (starts with b'MZo\x10')
Add check for (b'MZ') to catch both in one call.

Fix:
https://github.com/systemd/systemd/issues/26923
(cherry picked from commit bf9f07a62966043c0f1fd7ac4a249790643d1f9a)
2023-03-29 16:56:51 +02:00