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

61286 Commits

Author SHA1 Message Date
Luca Boccassi
dd7a821b5f Uphold/StopWhenUnneeded/BindsTo: requeue when job finishes
When a unit is upheld and fails, and there are no state changes in
the upholder, it will not be retried, which is against what the
documentation suggests.

Requeue when the job finishes. Same for the other two queues.

(cherry picked from commit 4c7a0fc8d0)
(cherry picked from commit fa8d33bb37)
2023-04-28 16:29:56 +01:00
Luca Boccassi
374ef07274 Uphold/StopWhenUnneeded/BindsTo: add retry timer on rate limit
The Upholds= promise is that as long as unit A is up and Upholds=B,
B will be activated if failed or inactive. But there is a hard-coded,
non-configurable rate limit for this, so add a timed retry after the
ratelimit has expired.

Apply to BindsTo= and StopWhenUnneeded= as well.

(cherry picked from commit 7223d500ac)
(cherry picked from commit 6fc08d8407)
2023-04-28 16:29:56 +01:00
Michal Sekletar
7c353ca5d6 man: add util-linux to the package list for Fedora container
/bin/login is shipped in util-linux, however, systemd.spec on Fedora has
"Requires: (util-linux-core or util-linux)". If the dependency is
fulfilled just by installation of util-linux-core then users won't be
able to log in into the container after it boots. Let's add util-linux
package to the package list so that /bin/login is always present.

(cherry picked from commit 5015b5014b)
(cherry picked from commit 1fb4ae32b0)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
b3f0c01a9d man: link to Fedora 37
Fedora 36 is a bit old at this point and will be EOL in about 6 weeks.
Fedora 38 is not out yet, so the cloud link wouldn't work.

(cherry picked from commit 5a9e2dff47)
(cherry picked from commit 841146f243)
2023-04-28 16:29:56 +01:00
Mike Yuan
bbbbf4932a systemctl: suppress error for try-* if unit is masked
Closes #16521

(cherry picked from commit 8a826a979a)
(cherry picked from commit 465edc1230)
2023-04-28 16:29:56 +01:00
Jan Macku
77f5c97733 ci: drop checkout from release workflow
It's not required as per comment - https://github.com/systemd/systemd/pull/27110#issuecomment-1499653913

(cherry picked from commit 19cdda7c3a)
(cherry picked from commit 7102925d1a)
2023-04-28 16:29:56 +01:00
Jan Macku
4857bc61d2 ci: don't run release wf on systemd-security
(cherry picked from commit 9718afd194)
(cherry picked from commit 167c01688f)
2023-04-28 16:29:56 +01:00
Masatake YAMATO
88f058583b shell-completion: add --xml-interface option of busctl to the rules
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
(cherry picked from commit a5efb0cc2b)
(cherry picked from commit bda5c892a8)
2023-04-28 16:29:56 +01:00
Masatake YAMATO
5ebdf8e0f5 busctl: add --xml-interface to the help message
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
(cherry picked from commit c39b8978f6)
(cherry picked from commit 6265430ca9)
2023-04-28 16:29:56 +01:00
Yu Watanabe
6de5e76467 test: update description
(cherry picked from commit adc5b9823c)
(cherry picked from commit d26fd71d1a)
2023-04-28 16:29:56 +01:00
Дамјан Георгиевски
24c3212eae ci: add permissions to make a release
follow-up to https://github.com/systemd/systemd/pull/27071
in order to create Github Releases, the job needs permissions to write
contents

also:
- pinned the `softprops/action-gh-release` action to a specific commit
- made it only active on the `systemd` organization repos (so not on
  forks)

(cherry picked from commit 7b411cf842)
(cherry picked from commit dc2facf61d)
2023-04-28 16:29:56 +01:00
Thomas Blume
1f8ec0ed38 test/test-functions: fix typo in install_suse_systemd()
(cherry picked from commit d6d0661631)
(cherry picked from commit 4c65c644d6)
2023-04-28 16:29:56 +01:00
Franck Bui
e1a7f29467 test: install symlinks with valid targets on SUSE and Debian
(cherry picked from commit f8d527aa9a)
(cherry picked from commit fca5a45a59)
2023-04-28 16:29:56 +01:00
Olivier Gayot
fcd9ec3eff localed: fix invalid free after shifting pointers using strstrip
After manually editing /etc/locale.gen, calling localectl set-locale
sometimes fails. When it fails, the systemd journal shows:
systemd-localed: free() / invalid pointer.

It turned out that it only fails if some of the uncommented lines in
/etc/locale.gen have leading spaces, as in:

  * C.UTF-8       <= OK
  * en_US.UTF-8   <= OK
  *  fr_FR.UTF-8  <= NOK

After parsing a line from /etc/locale.gen, we use strstrip() to obtain
the "trimmed" line (without leading or trailing spaces).

However, we store the result of strstrip() in the original pointer
containing the untrimmed line. This pointer is later passed to free
(this is done automatically using _cleanup_free_).

This is a problem because if any leading space is present, the pointer
will essentially be shifted from its original value. This will result in
an invalid free upon cleanup.

The same issue is present in the locale_gen_locale_supported function.

Fixed by storing the result of strstrip() in a different pointer.

(cherry picked from commit b24b10592d)
(cherry picked from commit d18037b8ff)
2023-04-28 16:29:56 +01:00
Frantisek Sumsal
59982fbe8d test: bump the timeout for non-qemu runs to 90s
When Ubuntu CI is oversaturated, 60s doesn't seem to be enough.

(cherry picked from commit cb58571a11)
(cherry picked from commit 93ac024b7e)
2023-04-28 16:29:56 +01:00
Frantisek Sumsal
504e2e9b2b test: enable the systemd-resolved unit in TEST-75
Without enabling itx, there's no symlink to the org.freedesktop.resolve1
dbus service, so there exists a tiny window in which the sequence of
`systemctl start` and `systemctl service-log-level` commands might fail:

[ 1127.615151] H systemd[1]: Started Network Name Resolution.
[ 1127.617768] H testsuite-75.sh[34]: + systemctl service-log-level systemd-resolved.service debug
[ 1127.621251] H dbus-daemon[54]: [system] Activating via systemd: service name='org.freedesktop.resolve1' unit='dbus-org.freedesktop.resolve1.service' requested by ':1.24' (uid=0 pid=119 comm="systemctl service-log-level systemd-resolved>
[ 1127.621336] H systemd[1]: dbus-org.freedesktop.resolve1.service: Failed to load configuration: No such file or directory
[ 1127.621364] H systemd[1]: dbus-org.freedesktop.resolve1.service: Trying to enqueue job dbus-org.freedesktop.resolve1.service/start/replace
[ 1127.621395] H systemd[1]: D-Bus activation failed for dbus-org.freedesktop.resolve1.service: Unit dbus-org.freedesktop.resolve1.service not found.
[ 1127.621965] H dbus-daemon[54]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.resolve1.service': Unit dbus-org.freedesktop.resolve1.service not found.
[ 1127.622046] H systemd[1]: systemd-resolved.service: D-Bus name org.freedesktop.resolve1 now owned by :1.25
[ 1127.622130] H systemctl[119]: Failed to set log level of org.freedesktop.resolve1 to debug: Unit dbus-org.freedesktop.resolve1.service not found.

Spotted in a couple of recent Ubuntu CI runs.

(cherry picked from commit 6de6376075)
(cherry picked from commit 283b7b4159)
2023-04-28 16:29:56 +01:00
Uwe Kleine-König
56c756b183 man/systemd-mount: Clearify documentation about --bind-device
The documentation suggests that the mount point (i.e. the directory
where the device is mounted) is removed when the device vanishes.
However only stopping of the automount unit is implemented.

So adapt the documentation to reality.

(cherry picked from commit 381ccb4246)
(cherry picked from commit 6179141124)
2023-04-28 16:29:56 +01:00
Cristian Rodríguez
9b832c4457 resolve: change DNS_PACKET_UNICAST_SIZE_LARGE_MAX to 1232 (#27171)
The old common default was 4096, until 2020 on which all DNS servers (verified
on BIND9, NSD, Unbound, dnsmasq) switched to 1232 as an agreed max size [1].

[1] https://www.dnsflagday.net/2020/#message-size-considerations

(cherry picked from commit e144a26306)
(cherry picked from commit b2e1dabbeb)
2023-04-28 16:29:56 +01:00
Sorah Fukumori
6e02302292 man: netdev: Clarify wireguard IPv6 endpoint format
(cherry picked from commit 744b04c557)
(cherry picked from commit 16dc17d68c)
2023-04-28 16:29:56 +01:00
Franck Bui
1952ad5801 test: use kbd-mode-map we ship in TEST-73-LOCALE
The rational is the same as the one described in commit
be0cc2ce6c.

(cherry picked from commit f9a23d428a)
(cherry picked from commit 0558c490a6)
2023-04-28 16:29:56 +01:00
Luca Boccassi
01ca822462 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 b7b48b389c)
(cherry picked from commit 64ef6ccd4f)
2023-04-28 16:29:56 +01:00
Yu Watanabe
483048e429 man: mention -o option for systemd-journal-remote
(cherry picked from commit bc729e81f2)
(cherry picked from commit 018461aaf0)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
691d173cb2 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 45f540a297)
(cherry picked from commit 31c7f6d0d1)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
4f4621893c 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 44d82df46e)
(cherry picked from commit 49c6965946)
2023-04-28 16:29:56 +01:00
Yu Watanabe
7f96193975 journald: fix log message
(cherry picked from commit 01aa59979b)
(cherry picked from commit 649e335bc1)
2023-04-28 16:29:56 +01:00
taniishkaaa
b7210ffcd3 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 6cc19afac1)
(cherry picked from commit eda7bf237f)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
c83236a863 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 6d48c7cf73.

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

(cherry picked from commit c32f496b9e)
(cherry picked from commit 0430078cfb)
2023-04-28 16:29:56 +01:00
Frantisek Sumsal
f9b73dc1b9 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 e660c590a5)
(cherry picked from commit 0d9c2c270b)
2023-04-28 16:29:56 +01:00
Zbigniew Jędrzejewski-Szmek
52c1367226 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 2a4efebb3b)
(cherry picked from commit 384fec2622)
2023-04-28 16:29:56 +01:00
OMOJOLA JOSHUA DAMILOLA
5b0276c25b test: fixed negative checks in TEST-70-TPM2.
Use in-line error handling rather than redirections. Follow up on #27020

(cherry picked from commit 27d45db38c)
(cherry picked from commit 2950b4ebf6)
2023-04-28 16:29:56 +01:00
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