1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-10 01:17:44 +03:00
Commit Graph

61106 Commits

Author SHA1 Message Date
Frantisek Sumsal
0be850bd72 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 1d6052ba5c)
(cherry picked from commit 786649c904)
2023-04-28 16:29:56 +01:00
Frantisek Sumsal
b0561b51a9 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 4388541237)
(cherry picked from commit 5e3ac73017)
2023-04-28 16:29:56 +01:00
Luca Boccassi
75ee851a41 man: add example for sd_bus_call_method
(cherry picked from commit ce199d12e9)
(cherry picked from commit 8b1cc644c5)
2023-04-28 16:29:56 +01:00
Luca Boccassi
16aee50c2b man: further shorten print-unit-path example
(cherry picked from commit d10a5f6c3d)
(cherry picked from commit 382e53977c)
2023-04-28 16:29:56 +01:00
Lennart Poettering
14a5056e5c man: link up new online coredump docs from man page
(cherry picked from commit bba6046b24)
(cherry picked from commit 960f05945c)
2023-04-28 16:29:56 +01:00
Yu Watanabe
215d16a535 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 ef9c12b157)
(cherry picked from commit edfca36727)
2023-04-28 16:29:56 +01:00
Lennart Poettering
9e4507c311 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 62c72c60b5)
(cherry picked from commit 9943f2af3d)
2023-04-28 16:29:56 +01:00
Luca Boccassi
8ae4fd8441 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: 256a835f1c

(cherry picked from commit 49e8342965)
(cherry picked from commit dbb1b9c2c8)
2023-04-28 16:29:56 +01:00
Luca Boccassi
cde5615a44 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 a5979f0bd5)
(cherry picked from commit 18afac6e90)
2023-04-28 16:29:56 +01:00
OMOJOLA JOSHUA DAMILOLA
9aa62536a2 added more test cases
(cherry picked from commit e2a4411a2b)
(cherry picked from commit 4629419038)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
f533407976 busctl: also assume --full if not writing to terminal
If people grep the output, it probably shouldn't be ellipsized.

(cherry picked from commit f735076c54)
(cherry picked from commit ff7040b193)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
a7dee1da0c busctl: use size_t for set size
Also reduce the scope of variables.

(cherry picked from commit bc1f1eba77)
(cherry picked from commit 00977a8e74)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
1b05d5132f busctl: do not truncate property values when --full
(cherry picked from commit d82267e567)
(cherry picked from commit 802fded9a5)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
6b4835805b oomd: add inline comments with param names
(cherry picked from commit ebfb601945)
(cherry picked from commit e400a62a92)
2023-04-28 16:29:56 +01:00
Yu Watanabe
b91e37e323 test: add more testcases for rm_rf()
(cherry picked from commit 0278b1c801)
(cherry picked from commit 4067ec52f4)
2023-04-28 16:29:56 +01:00
Yu Watanabe
ba4ea68e81 rm-rf: also chmod() directory if it cannot be opened
Otherwise, directory with zero access mode cannot be removed.

(cherry picked from commit 808c8b25ee)
(cherry picked from commit 201830df21)
2023-04-28 16:29:56 +01:00
Yu Watanabe
9851867e0b rm-rf: mask file mode with 07777 when passed to chmod()
No functional change hopefully, just for safety.

(cherry picked from commit da19c07198)
(cherry picked from commit d91f7eb0fb)
2023-04-28 16:29:56 +01:00
Yu Watanabe
25a8b163be rm-rf: fix errno handling
(cherry picked from commit cd2cd095db)
(cherry picked from commit 80417f90b0)
2023-04-28 16:29:56 +01:00
Mike Yuan
f3678358a4 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 09567df7db)
(cherry picked from commit ed18c2ab79)
2023-04-04 11:55:22 +01:00
Mike Yuan
b1ce97cffb core: do early setup check for arguments with '=' too
Follow-up for d2ebd50d7f

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 4f44d2c4f7)
(cherry picked from commit 4f4e0bab0d)
2023-04-03 11:40:16 +01:00
Дамјан Георгиевски
eae1851b12 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 86c20937c2)
(cherry picked from commit a3f2884ef2)
2023-04-03 11:40:16 +01:00
Luca Boccassi
250729fff2 test: install 'script' for TEST-26-SYSTEMCTL
Needed by 744ea4536f
2023-03-31 01:12:58 +01:00
Zbigniew Jędrzejewski-Szmek
51e72a8a4e hwdb: update to 201423d801
git restore -s origin/main hwdb.d/ test/hwdb.d test/hwdb-test.sh

(cherry picked from commit 4c80732d23)
2023-03-30 20:50:51 +02:00
Zbigniew Jędrzejewski-Szmek
48e0395535 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 7d0c47dad0)
(cherry picked from commit bfc03cae41)
2023-03-30 19:21:34 +02:00
Lennart Poettering
34e83c24a7 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 75f7e5e547)
(cherry picked from commit a2ef3c97bd)
2023-03-30 19:21:34 +02:00
David Tardon
760059bd64 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 9ea46af4f2)
(cherry picked from commit e4c7553874)
2023-03-30 19:21:34 +02:00
Frantisek Sumsal
7eca133c1d test: add a couple of tests for userdbctl
(cherry picked from commit 93fe228bb1)
(cherry picked from commit e1ddc48ff9)
2023-03-30 19:21:34 +02:00
Frantisek Sumsal
73afda3f6d 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 5b09499cac)
(cherry picked from commit 0e7745249b)
2023-03-30 19:21:34 +02:00
Frantisek Sumsal
ebcd284358 docs: s/authorized_key/authorized_keys/
(cherry picked from commit 13bf321610)
(cherry picked from commit e17d4351a7)
2023-03-30 19:21:34 +02:00
Frantisek Sumsal
50a9e9a5b0 man: s/io.systemd.Dropin/io.systemd.DropIn/
(cherry picked from commit 8f572d0d82)
(cherry picked from commit 5d2588b594)
2023-03-30 19:21:34 +02:00
Frantisek Sumsal
a13bd7deb5 userdbctl: don't show legend when dumping JSON with services
(cherry picked from commit eedd1da9f9)
(cherry picked from commit 1185e7f9d3)
2023-03-30 19:21:34 +02:00
Lennart Poettering
f76e47b810 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: 6d6a08547c

(cherry picked from commit 950c0ed389)
(cherry picked from commit 7822ae021b)
2023-03-30 19:21:31 +02:00
Lennart Poettering
4b0ae9d418 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 76e86b8dd8)
(cherry picked from commit 54f97c0ae5)
2023-03-30 19:12:37 +02:00
Zbigniew Jędrzejewski-Szmek
c71bd9c535 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 b5a70eeecd)
(cherry picked from commit 90ba721560)
2023-03-30 19:12:32 +02:00
наб
cd3d4ab738 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 ed89819f8f)
(cherry picked from commit f6388f561c)
2023-03-30 19:12:22 +02:00
Daan De Meyer
dc92016bd7 core: Settle log target if we're going to be closing all fds
Whenever we're going to close all file descriptors, we tend to close
the log and set it into open when needed mode. When this is done with
the logging target set to LOG_TARGET_AUTO, we run into issues because
for every logging call, we'll check if stderr is connected to the
journal to determine where to send the logging message. This check
obviously stops working when we close stderr, so we settle the log
target before we do that so that we keep using the same logging
target even after stderr is closed.

(cherry picked from commit a3b00f91bb)
(cherry picked from commit 22c47d24a4)
2023-03-30 19:12:10 +02:00
Yu Watanabe
b5f7c05204 activate: use log_set_open_when_needed()
Otherwise, several error logs may not be shown.

(cherry picked from commit a723521fd2)
(cherry picked from commit ce06e000b8)
2023-03-30 19:12:05 +02:00
Kevin P. Fleming
769d65988d bootctl: 'graceful' should ignore EFI variable failures
Suppress errors when creating/writing EFI variables during 'bootctl update' if
'--graceful' mode is active (as the documentation indicates).

Closes #26773.

(cherry picked from commit 06d104d58f)
(cherry picked from commit b041337a7a)
2023-03-30 19:11:51 +02:00
Thomas Blume
d9c2ae019a udev-rules: fix nvme symlink creation on namespace changes
The nvme by-id symlink changes to the latest namespace when a new namespace gets
added, for example by connecting multiple NVMe/TCP host controllers via nvme
connect-all.
That is incorrect for persistent device links.
The persistent symbolic device link should continue to point to the same NVMe
namespace throughout the lifetime of the current boot.
Therefore the namespace id needs to be added to the link name.

(cherry picked from commit c5ba7a2a4d)
(cherry picked from commit 059ca4fe8f)
2023-03-30 19:08:20 +02:00
Antonio Alvarez Feijoo
357a3f1d2b man/network-generator: replace dracut.kernel reference with dracut.cmdline
`dracut.kernel.7` is just a symlink to `dracut.cmdline.7`, so the web reference
points to a non-existent URL
(https://man7.org/linux/man-pages/man7/dracut.kernel.7.html).

(cherry picked from commit 9baeb58fcd)
(cherry picked from commit 2a8c1168b1)
2023-03-30 19:08:14 +02:00
Antonio Alvarez Feijoo
5e5aacd16f gpt-auto-generator: fix typo
(cherry picked from commit dd23292c08)
(cherry picked from commit ad2d77b899)
2023-03-30 19:08:08 +02:00
David Tardon
8bf89dddac systemctl: always print circular deps. at the end
Before:
a.target
○ └─b.target
    ├─...
●   └─paths.target

After:
a.target
○ └─b.target
●   ├─paths.target
    └─...

(cherry picked from commit bb7c4a93ea)
(cherry picked from commit c86983c58a)
2023-03-30 19:07:56 +02:00
David Tardon
0b058ee2bf systemctl: fix formatting of circular dep.
Before:
a.target
○ └─b.target
    └─...
●   └─paths.target

After:
a.target
○ └─b.target
    ├─...
●   └─paths.target

(cherry picked from commit 5a4711e489)
(cherry picked from commit 6903f28d8d)
2023-03-30 19:07:55 +02:00
David Tardon
571f9d5828 systemctl: fix indentation of circular deps
We're still at level `level` here.

Before:
b.target
○ ├─a.target
  │   └─...
● └─paths.target

After:
b.target
○ ├─a.target
  │ └─...
● └─paths.target

Fixes #26052.

(cherry picked from commit a9f2f486f3)
(cherry picked from commit cee098e4e1)
2023-03-30 19:07:54 +02:00
Mike Yuan
e913b51c5b systemctl: list-dependencies: pass bool where appropriate
(cherry picked from commit 8e481bd292)
2023-03-30 19:07:48 +02:00
Yu Watanabe
48abbdda56 tmpfiles: show file type in octal, instead of hex
(cherry picked from commit 056ff0b455)
(cherry picked from commit 7ca1a3a1d4)
2023-03-30 19:06:39 +02:00
Daan De Meyer
603d8402de units: Order user@.service after systemd-oomd.service
The user manager connects to oomd over varlink. Currently, during
shutdown, if oomd is stopped before any user manager, the user
manager will try to reconnect to the socket, leading to a warning
from pid 1 about a conflicting transaction.

Let's fix this by ordering user@.service after systemd-oomd.service,
so that user sessions are stopped before systemd-oomd is stopped,
which makes sure that the user sessions won't try to start oomd via
its socket after systemd-oomd is stopped.

(cherry picked from commit cafd2c0be4)
(cherry picked from commit c4848032f1)
2023-03-30 19:06:35 +02:00
Mike Yuan
9ced8895e1 sleep: fix default values unmatched with manual
(cherry picked from commit f05b4bb9a7)
(cherry picked from commit fd963d1bc8)
2023-03-30 19:06:09 +02:00
Addison Snelling
8a711f1c26 man: fix misspelled executable name (#26858)
(cherry picked from commit 0c868e3fad)
(cherry picked from commit 37f65e46d3)
2023-03-30 19:06:04 +02:00
Zbigniew Jędrzejewski-Szmek
df2ff69d16 man: document "Delegate=" a bit more
This case is a bit surprising, even if logical if one understands how the
parser works. Let's be more explicit.

Follow-up for 7b3693e4e4.

(cherry picked from commit 449172f943)
(cherry picked from commit 2ead535f0d)
2023-03-30 19:05:40 +02:00