]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agorun: expand variables also with --scope 27113/head
Zbigniew Jędrzejewski-Szmek [Tue, 4 Apr 2023 19:18:33 +0000 (21:18 +0200)] 
run: expand variables also with --scope

This makes syntax be the same for commands which are started by the manager and
those which are spawned directly (when --scope is used).

Before:
$ systemd-run -q -t echo '$TERM'
xterm-256color

$ systemd-run -q --scope echo '$TERM'
$TERM

Now:
$ systemd-run -q --scope echo '$TERM'
xterm-256color

Previous behaviour can be restored via --expand-environment=no:
$ systemd-run -q --scope --expand-environment=no echo '$TERM'
$TERM

Fixes #22948.

At some level, this is a compat break. Fortunately --scope is not very widely
used, so I think we can get away with this. Having different syntax depending
on whether --scope was used or not was bad UX.

A NEWS entry will be required.

2 years agoman/systemd-run: add examples explaining how variable expansion is performed
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 06:26:56 +0000 (08:26 +0200)] 
man/systemd-run: add examples explaining how variable expansion is performed

2 years agorun: add --expand-environment=no to disable server-side envvar expansion
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 21:17:58 +0000 (23:17 +0200)] 
run: add --expand-environment=no to disable server-side envvar expansion

This uses StartExecEx to get the equivalent of ExecStart=:. StartExecEx was
added in b3d593673c5b8b0b7d781fd26ab2062ca6e7dbdb, so this will not work with
older systemds.

A hint is emitted if we get an error indicating lack of support. PID1 returns
SD_BUS_ERROR_PROPERTY_READ_ONLY, but I'm checking for
SD_BUS_ERROR_UNKNOWN_PROPERTY too for safety.

2 years agorun: split out creation of unit creation messages
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 20:27:58 +0000 (22:27 +0200)] 
run: split out creation of unit creation messages

Just refactoring, in preparation for future changes.
(Though I think it'd be reasonable to do anyway, those functions were
awfully long.)

'git diff' displays this badly. The middle part of start_transient_service()
is moved to make_transient_service_unit(), and the middle part of
start_transient_trigger() is moved to make_transient_trigger_unit().

2 years agorun: simplify returning of status
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 19:50:19 +0000 (21:50 +0200)] 
run: simplify returning of status

start_transient_service() would return two ints: one normally and one via
*retval. We can just return one int and propagate it directly, because we
use DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE().

2 years agocore: fix writing of ExecStartEx and friends
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 11:56:18 +0000 (13:56 +0200)] 
core: fix writing of ExecStartEx and friends

The property name is called ExecStartEx, but we have to write it as ExecStart=
in the unit file. :(
Bug introduced in b3d593673c5b8b0b7d781fd26ab2062ca6e7dbdb when ex-properties
were initially added.

In addition, we cannot escape $ as $$, because when ":" is used, we wouldn't
unescape $$ back to $.

2 years agocore/unit: add UNIT_ESCAPE_EXEC_SYNTAX
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 12:45:46 +0000 (14:45 +0200)] 
core/unit: add UNIT_ESCAPE_EXEC_SYNTAX

Unfortunately we can't escape $ when ':' is used to prohibit variable expansion:
  ExecStart=:echo $$
is not the same as
  ExecStart=:echo $

This just adds the functionality and the unittests, without using it anywhere
for real yet.

2 years agocore/unit: rename UNIT_ESCAPE_EXEC_SYNTAX → *_ENV
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 12:50:12 +0000 (14:50 +0200)] 
core/unit: rename UNIT_ESCAPE_EXEC_SYNTAX → *_ENV

In preparation for future changes.

2 years agocore/unit: fix shell-escaping of strings
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 10:43:53 +0000 (12:43 +0200)] 
core/unit: fix shell-escaping of strings

Our escaping of '$' is '$$', not '\$'. We would write unit files that
were not valid:
  $ systemd-run --user bash -c 'echo $$; sleep 1000'
  Running as unit: run-r1c7c45b5b69f487c86ae205e12100808.service
  $ systemctl cat --user run-r1c7c45b5b69f487c86ae205e12100808
  # /run/user/1000/systemd/transient/run-r1c7c45b5b69f487c86ae205e12100808.service
  ...
  ExecStart="/usr/bin/bash" "-c" "echo \$\$\; sleep 1000"

  $ systemd-analyze verify /run/user/1000/systemd/transient/run-r1c7c45b5b69f487c86ae205e12100808.service
  /run/user/1000/systemd/transient/run-r1c7c45b5b69f487c86ae205e12100808.service:7:
    Ignoring unknown escape sequences: "echo \$\$\; sleep 1000"

Similarly, ';' cannot be escaped as '\;'. Only a handful of characters
listed in "Supported escapes" is allowed.

Escaping of "'" can be done, but it's not useful because we use double quotes
around the string anyway whenever we do escaping.

unit_write_setting() is called all over the place. In a great majority of
places we write either fixed strings or something that we generate ourselves,
so no escaping or quoting is needed. (And it's not allowed, e.g.
'Type="oneshot"' would not work.)  But if we forgot to add escaping or quoting
for a free-style string, it would probably allow writing a unit file that would
be read completely wrong. I looked over various places where
unit_write_setting() is called, and I couldn't find any place where
quoting/escaping was forgotten. But trying to figure out the full
ramifications of this change is not easy.

2 years agobasic/logarithm: add popcount() wrapper
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 12:32:39 +0000 (14:32 +0200)] 
basic/logarithm: add popcount() wrapper

__builtin_popcount() is a bit of a mouthful, so let's provide a helper.
Using _Generic has the advantage that if a type other then the ones on
the list is given, compilation will fail. This is nice, because if by any
change we pass a wider type, it is rejected immediately instead of being
truncated.

log.h is also needed. It is included transitively, but let's include it
directly.

macro.h is *not* needed.

2 years agotest-core-unit: add new test file for unit_escape_setting() and friends
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 09:42:41 +0000 (11:42 +0200)] 
test-core-unit: add new test file for unit_escape_setting() and friends

None of the existing test files fit very well. test-unit-serialize is
pretty close, but it does special cgroup setup, which we don't need in
this case. I hope we can add more tests in the future for this basic
functionality, so I'm adding a brand new file names after the source file
it's testing.

2 years agomeson: redo grouping of tests under src/test/
Zbigniew Jędrzejewski-Szmek [Mon, 3 Apr 2023 06:49:17 +0000 (08:49 +0200)] 
meson: redo grouping of tests under src/test/

Move the tests that link to libcore into a separate subgroup.
They are special and it makes sense to keep them together. While
at it, make the list alphabetical.

Also, merge the list additions into one. No idea why it was like that.

2 years agoMerge pull request #27128 from keszybz/sd-bus-docs-and-error-messages
Zbigniew Jędrzejewski-Szmek [Tue, 4 Apr 2023 19:28:15 +0000 (21:28 +0200)] 
Merge pull request #27128 from keszybz/sd-bus-docs-and-error-messages

Improvements to man pages for systemd.service, sd-bus, and better error messages

2 years agoman: mention -o option for systemd-journal-remote
Yu Watanabe [Tue, 4 Apr 2023 15:38:55 +0000 (00:38 +0900)] 
man: mention -o option for systemd-journal-remote

2 years agoservice: minor modernizations
Lennart Poettering [Tue, 4 Apr 2023 10:21:00 +0000 (12:21 +0200)] 
service: minor modernizations

2 years agomanager: remove transient unit directory during startup
Zbigniew Jędrzejewski-Szmek [Tue, 4 Apr 2023 10:05:16 +0000 (12:05 +0200)] 
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.

2 years agosd-bus: use macros for standard bus error names consistently 27128/head
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 21:07:33 +0000 (23:07 +0200)] 
sd-bus: use macros for standard bus error names consistently

Also add definitions for a few names that didn't have them and update
the list in the man page.

2 years agocore: a more informative error when SetProperties/StartTransientUnit fails
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 19:08:35 +0000 (21:08 +0200)] 
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.

2 years agoman/sd_bus_message_open_container: mention two common errors
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 18:53:51 +0000 (20:53 +0200)] 
man/sd_bus_message_open_container: mention two common errors

2 years agoman/systemd.service: add example for char prefixes
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 18:16:01 +0000 (20:16 +0200)] 
man/systemd.service: add example for char prefixes

The prefixes can be specified for any part of the command. The docs imply this,
but it's not entirely obvious. Let's add an example.

2 years agoman: move description of command line substitution out of ExecStart=
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 18:05:18 +0000 (20:05 +0200)] 
man: move description of command line substitution out of ExecStart=

The description was split — part was under ExecStart= and part in "Command lines".
Now the whole generic part is moved to the separate section, and under ExecStart=
only the stuff that is specific to that option is described.

This just moves the text and removes some repetitions.

2 years agocore: unify two similar paths, avoid formatting of unused string
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 11:50:29 +0000 (13:50 +0200)] 
core: unify two similar paths, avoid formatting of unused string

After 'if (DEBUG_LOGGING)' is added, the two call sites are almost identical,
except that we forgot LOG_UNIT_INVOCATION_ID(unit).

I removed the handling of the log_oom(). It's a debug message only after all,
and it's unlikely to fail.

2 years agocore: simplify unit_escape_setting()
Zbigniew Jędrzejewski-Szmek [Sat, 1 Apr 2023 14:23:47 +0000 (16:23 +0200)] 
core: simplify unit_escape_setting()

The function had a provision for NULL input, and would return NULL, but that
looks like an error and all callers pass in a non-NULL arg and report oom on
NULL. So assert that the input is non-NULL.

All callers specifed the output buffer, so we can simplify the logic to only
make an allocation if appropriate and change the return type to 'const *'.

No functional change.

2 years agocore: typos in comments
Zbigniew Jędrzejewski-Szmek [Sat, 1 Apr 2023 14:15:12 +0000 (16:15 +0200)] 
core: typos in comments

2 years agoupdate TODO
Lennart Poettering [Tue, 4 Apr 2023 10:20:50 +0000 (12:20 +0200)] 
update TODO

2 years agoservice: dump fdstore contents also in free-form debug dump
Lennart Poettering [Thu, 30 Mar 2023 14:38:47 +0000 (16:38 +0200)] 
service: dump fdstore contents also in free-form debug dump

2 years agoMerge pull request #27122 from yuwata/id128-at
Daan De Meyer [Tue, 4 Apr 2023 07:25:37 +0000 (09:25 +0200)] 
Merge pull request #27122 from yuwata/id128-at

undefined

2 years agochase: fix error handling
Yu Watanabe [Sat, 1 Apr 2023 12:58:08 +0000 (21:58 +0900)] 
chase: fix error handling

Fixes a bug introduced by 63bfd52f48a772c86ff84e3a1ba1fcd19e0008f8.

2 years agotest: add tests for id128_{read,write}_at() 27122/head
Yu Watanabe [Tue, 4 Apr 2023 02:39:33 +0000 (11:39 +0900)] 
test: add tests for id128_{read,write}_at()

2 years agosd-id128: introduce id128_write_at()
Yu Watanabe [Fri, 31 Mar 2023 07:12:39 +0000 (16:12 +0900)] 
sd-id128: introduce id128_write_at()

2 years agosd-id128: introduce id128_read_at()
Yu Watanabe [Fri, 31 Mar 2023 07:10:36 +0000 (16:10 +0900)] 
sd-id128: introduce id128_read_at()

2 years agosd-id128: rename Id128FormatFlag -> Id128Flag
Yu Watanabe [Sat, 1 Apr 2023 12:30:45 +0000 (21:30 +0900)] 
sd-id128: rename Id128FormatFlag -> Id128Flag

As the flag is not only for formatting.

2 years agosd-id128: rename argument and add missing assertion
Yu Watanabe [Sat, 1 Apr 2023 15:35:33 +0000 (00:35 +0900)] 
sd-id128: rename argument and add missing assertion

2 years agoRevert "sd-id128: make id128_read() optionally take root directory"
Yu Watanabe [Mon, 3 Apr 2023 01:39:00 +0000 (10:39 +0900)] 
Revert "sd-id128: make id128_read() optionally take root directory"

This reverts commit 830e52caa2bf1a29f56cb93e7ed85acb1bda11c3.

2 years agosrc: changed usage of basename() to path_extract_filename().
OMOJOLA JOSHUA DAMILOLA [Sat, 1 Apr 2023 18:52:32 +0000 (18:52 +0000)] 
src: changed usage of basename() to path_extract_filename().
TODO.

2 years agoMerge pull request #27114 from keszybz/trivial-cleanups
Luca Boccassi [Mon, 3 Apr 2023 17:55:49 +0000 (18:55 +0100)] 
Merge pull request #27114 from keszybz/trivial-cleanups

Trivial cleanups

2 years agopid1: drop two spurious empty line
Lennart Poettering [Mon, 3 Apr 2023 17:15:58 +0000 (19:15 +0200)] 
pid1: drop two spurious empty line

2 years agocore/main: also check the argument terminator
Mike Yuan [Mon, 3 Apr 2023 10:42:39 +0000 (18:42 +0800)] 
core/main: also check the argument terminator

For future-proof reasons, in case we will add
another option that starts with --deserialize.

Addresses https://github.com/systemd/systemd/commit/4f44d2c4f76922a4f48dd4473e6abaca40d7e555#r107285603

2 years agoudev-rules: check tokens order
Dmitry V. Levin [Sun, 26 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
udev-rules: check tokens order

When invoked by udevadm verify, warn about rules that have PROGRAM
assignments specified after RESULT checks.

2 years agoshared/exec-util: reduce scope of iterator variables 27114/head
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 19:22:17 +0000 (21:22 +0200)] 
shared/exec-util: reduce scope of iterator variables

2 years agocore/service: inline one variable
Zbigniew Jędrzejewski-Szmek [Sun, 2 Apr 2023 12:59:48 +0000 (14:59 +0200)] 
core/service: inline one variable

2 years agobasic/fs-util: typo fix
Zbigniew Jędrzejewski-Szmek [Thu, 30 Mar 2023 14:19:25 +0000 (16:19 +0200)] 
basic/fs-util: typo fix

2 years agoman/systemd-sysext: minor grammar optimizations
Zbigniew Jędrzejewski-Szmek [Thu, 30 Mar 2023 07:40:14 +0000 (09:40 +0200)] 
man/systemd-sysext: minor grammar optimizations

2 years agobasic/mkdir: simplify error handling
Zbigniew Jędrzejewski-Szmek [Wed, 29 Mar 2023 14:00:03 +0000 (16:00 +0200)] 
basic/mkdir: simplify error handling

If we created the dir successfully, we let chmod_and_chown_at() do its thing
and shouldn't go into the part where we check if the existing directory has the
right permissions and ownership and possibly adjust them. The code was doing
that, by relying on the fact that chmod_and_chown_at() does not return -EEXIST.
That's probably true, but seems unnecessarilly complicated.

Follow-up for c1b1492a94b43ca636eb383c3b058feff27ff7b1.

2 years agotpm2: add support for a trusted SRK
William Roberts [Fri, 24 Feb 2023 20:11:16 +0000 (14:11 -0600)] 
tpm2: add support for a trusted SRK

Prevent attackers from spoofing the tpmKey portion of the AuthSession by
adding a trusted key to the LUKS header metadata. Also, use a persistent
object rather than a transient object.

This provides the following benifits:
1. No way to MITM the tpmKey portion of the session, see [1] for
details.

2. Strengthens the encrypted sessions, note that the bindKey could be
   dropped now.

3. Speed, once it's created we just use it.

4. Owner Auth is needed to call create primary, so using the SRK
   creates a scratch space for normal users.

This is a "first to set" model, in where the first person to set the key
in the LUKS header wins. Thus, setup should be done in a known good
state. If an SRK, which is a primary key at a special persistent
address, is found, it will use whatever is there. If not, it creates an
SRK. The SRK follows the convetions used through the tpm2-software
organization code on GitHub [2], however, a split has occured between
Windows and Linux with respect to SRK templates. The Linux SRK is
generated with the unique field size set to 0, in Windows, it properly
sets the size to key size in bytes and the unique data to all 0's of that
size. Note the proper templates for SRKs is covered in spec [3].
However, the most important thing, is that both SRKs are passwordless,
and thus they should be interchangable. If Windows is the first to make
the SRK, systemd will gladly accept it and vice-versa.

1. Without the bindKey being utilized, an attacker was able to intercept
this and fake a key, thus being able to decrypt and encrypt traffic as
needed. Introduction of the bindKey strengthened this, but allows for
the attacker to brute force AES128CFB using pin guesses. Introduction of
the salt increases the difficulty of this attack as well as DA attacks
on the TPM objects itself.

2. https://github.com/tpm2-software

3. https://trustedcomputinggroup.org/wp-content/uploads/TCG-TPM-v2.0-Provisioning-Guidance-Published-v1r1.pdf

Fixes: #20668
Fixes: #22637
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2 years agoMerge pull request #27044 from bluca/sysext_recursive_dir
Lennart Poettering [Mon, 3 Apr 2023 10:38:48 +0000 (12:38 +0200)] 
Merge pull request #27044 from bluca/sysext_recursive_dir

Ensure sysexts do not contain an os-release file, do not load sysexts from /usr[/local]/lib/extensions/

2 years agouser-sessions: do not remove /etc/nologin
Zbigniew Jędrzejewski-Szmek [Sat, 25 Mar 2023 10:34:47 +0000 (11:34 +0100)] 
user-sessions: do not remove /etc/nologin

pam_nologin looks for /etc/nologin and /run/nologin.
user-sessions creates (and removes) /run/nologin, but also removes
/etc/nologin. (This behaviour is unchanged since the introduction
of the binary in e92787416c691c3f34f47349e5eae3fa68eae856.)

By not removing pam_nologin we fully drop compatibility with PAM < 1.1.
This has the advantage that now /etc/nologin can be used by administrator to
disable user logins, e.g. for extended maintanance. We already specified
PAM >= 1.1.2 as dependency, so this was already covered.

The makes the code match the man page.

Fixes #26965.

2 years agoupdate 60-sensor.hwdb with toshiba tablet (#27103)
dmkUK [Sun, 2 Apr 2023 23:09:11 +0000 (00:09 +0100)] 
update 60-sensor.hwdb with toshiba tablet (#27103)

* update 60-sensor.hwdb with toshiba tablet

udevadm output after new matrix added

E: MODALIAS=dmi:bvnTOSHIBA:bvr2.00:bd01/09/2015:br2.0:efr19.0:svnTOSHIBA:pnTOSHIBAWT10-A-102:pvrPDW0BE-00800TEN:rvnType2-BoardManufacturer:rnType2-BoardProductName:rvrType2-BoardVersion:cvnChassisManufacturer:ct10:cvrChassisVersion:

P: /devices/platform/80860F41:02/i2c-2/i2c-13/13-000c
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-13/13-000c
E: SUBSYSTEM=i2c
E: MODALIAS=i2c:INVN6500-client

P: /devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00
E: SUBSYSTEM=i2c
E: DRIVER=inv-mpu6050-i2c
E: MODALIAS=acpi:INVN6500:
E: USEC_INITIALIZED=8659532
E: ID_VENDOR_FROM_DATABASE=Inviso, Inc.

P: /devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/iio:device0
N: iio:device0
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/iio:device0
E: SUBSYSTEM=iio
E: DEVNAME=/dev/iio:device0
E: DEVTYPE=iio_device
E: MAJOR=246
E: MINOR=0
E: USEC_INITIALIZED=9662385
E: ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
E: IIO_SENSOR_PROXY_TYPE=iio-poll-accel iio-buffer-accel
E: SYSTEMD_WANTS=iio-sensor-proxy.service
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:

P: /devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/trigger0
L: 0
E: DEVPATH=/devices/platform/80860F41:02/i2c-2/i2c-INVN6500:00/trigger0
E: SUBSYSTEM=iio

The orientation is the same as the WT10-A-103 already listed in 60.sensor.hwdb but not picked up by that rule.

2 years agocore: do early setup check for arguments with '=' too
Mike Yuan [Sun, 2 Apr 2023 10:56:12 +0000 (18:56 +0800)] 
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

2 years agoAdded unit test for strv_env_name_is_valid() function listed in env-util.c (#27100)
taniishkaaa [Sun, 2 Apr 2023 13:27:29 +0000 (18:57 +0530)] 
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

2 years agoMerge pull request #27096 from YHNdnzj/networkctl-modernize
Luca Boccassi [Sun, 2 Apr 2023 13:23:59 +0000 (14:23 +0100)] 
Merge pull request #27096 from YHNdnzj/networkctl-modernize

networkctl: modernize

2 years agoMerge pull request #27086 from keszybz/oomd-on-v1
Mike Yuan [Sun, 2 Apr 2023 08:21:53 +0000 (16:21 +0800)] 
Merge pull request #27086 from keszybz/oomd-on-v1

Do not pull in systemd-oomd on v1 to avoid repeated message in logs

2 years agopo: Translated using Weblate (Russian)
Andrei Stepanov [Sun, 2 Apr 2023 02:20:44 +0000 (04:20 +0200)] 
po: Translated using Weblate (Russian)

Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Andrei Stepanov <adem4ik@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ru/
Translation: systemd/main

2 years agobuild(deps): bump github/codeql-action from 2.2.5 to 2.2.9
dependabot[bot] [Sat, 1 Apr 2023 09:57:38 +0000 (09:57 +0000)] 
build(deps): bump github/codeql-action from 2.2.5 to 2.2.9

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.5 to 2.2.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/32dc499307d133bb5085bae78498c0ac2cf762d5...04df1262e6247151b5ac09cd2c303ac36ad3f62b)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoMerge pull request #27087 from mrc0mmand/missing-coverage
Frantisek Sumsal [Sat, 1 Apr 2023 16:59:42 +0000 (18:59 +0200)] 
Merge pull request #27087 from mrc0mmand/missing-coverage

test: set ReadWritePaths= for test-.services when built w/ coverage

2 years agoMerge pull request #27067 from DaanDeMeyer/find-esp-at
Yu Watanabe [Sat, 1 Apr 2023 16:19:57 +0000 (01:19 +0900)] 
Merge pull request #27067 from DaanDeMeyer/find-esp-at

find-esp: Add openat() like helpers that operate on fds

2 years agobuild(deps): bump ossf/scorecard-action from 2.1.2 to 2.1.3
dependabot[bot] [Sat, 1 Apr 2023 09:57:34 +0000 (09:57 +0000)] 
build(deps): bump ossf/scorecard-action from 2.1.2 to 2.1.3

Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/e38b1902ae4f44df626f11ba0734b14fb91f8f86...80e868c13c90f172d68d1f4501dee99e2479f7af)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agobuild(deps): bump actions/labeler from 4.0.2 to 4.0.3
dependabot[bot] [Sat, 1 Apr 2023 09:57:28 +0000 (09:57 +0000)] 
build(deps): bump actions/labeler from 4.0.2 to 4.0.3

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/5c7539237e04b714afd8ad9b4aed733815b9fab4...ba790c862c380240c6d5e7427be5ace9a05c754b)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agobuild(deps): bump github/super-linter from 4.9.7 to 4.10.1
dependabot[bot] [Sat, 1 Apr 2023 09:57:23 +0000 (09:57 +0000)] 
build(deps): bump github/super-linter from 4.9.7 to 4.10.1

Bumps [github/super-linter](https://github.com/github/super-linter) from 4.9.7 to 4.10.1.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](https://github.com/github/super-linter/compare/bb2d833b08b6c288608686672b93a8a4589cdc49...454ba4482ce2cd0c505bc592e83c06e1e37ade61)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoman: restore description of ConditionControlGroupController=v1|v2 27086/head
Zbigniew Jędrzejewski-Szmek [Fri, 31 Mar 2023 16:51:17 +0000 (18:51 +0200)] 
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.

2 years agonetworkctl: use sd_bus_get_property 27096/head
Mike Yuan [Sat, 1 Apr 2023 11:43:59 +0000 (19:43 +0800)] 
networkctl: use sd_bus_get_property

2 years agonetworkctl: style improvements
Mike Yuan [Sat, 1 Apr 2023 11:43:34 +0000 (19:43 +0800)] 
networkctl: style improvements

2 years agonetworkctl: use FOREACH_ARRAY more
Mike Yuan [Sat, 1 Apr 2023 11:42:56 +0000 (19:42 +0800)] 
networkctl: use FOREACH_ARRAY more

2 years agoMerge pull request #25836 from DaanDeMeyer/reset
Daan De Meyer [Sat, 1 Apr 2023 12:33:23 +0000 (14:33 +0200)] 
Merge pull request #25836 from DaanDeMeyer/reset

firstboot: Add --reset option

2 years agoukify: Strip symbol/string table for old stubs
Jan Janssen [Fri, 31 Mar 2023 11:13:00 +0000 (13:13 +0200)] 
ukify: Strip symbol/string table for old stubs

2 years agofind-esp: Add openat() like helpers that operate on fds 27067/head
Daan De Meyer [Thu, 22 Dec 2022 13:59:56 +0000 (14:59 +0100)] 
find-esp: Add openat() like helpers that operate on fds

We also rework the internals of find-esp to work on directory file
descriptors instead of absolute paths and do a lot of general cleanups.

By passing the parent directory file descriptor to verify_fsroot_dir()
along with the name of the directory we're operating on, we can get rid
of the fallback that goes via path to open the parent directory if '..'
fails due to permission errors.

2 years agostat-util: Add xstatfsat()
Daan De Meyer [Fri, 31 Mar 2023 08:39:55 +0000 (10:39 +0200)] 
stat-util: Add xstatfsat()

2 years agofind-esp: Drop explicit automount trigger
Daan De Meyer [Thu, 30 Mar 2023 08:21:45 +0000 (10:21 +0200)] 
find-esp: Drop explicit automount trigger

We call statx_fallback() which calls either statx() or fstatat(),
both of which automount by default, so we don't need the explicit
trigger.

2 years agobtrfs-util: Add btrfs_get_block_device_at()
Daan De Meyer [Thu, 30 Mar 2023 08:39:53 +0000 (10:39 +0200)] 
btrfs-util: Add btrfs_get_block_device_at()

Let's make btrfs_get_block_device_fd() more generic by renaming it
to btrfs_get_block_device_at() so it can operate on only paths, dir_fd
and path, or only on fd by using xopenat().

2 years agonetworkctl: acquire bus only when necessary
Mike Yuan [Thu, 23 Mar 2023 18:03:37 +0000 (02:03 +0800)] 
networkctl: acquire bus only when necessary

2 years agotest: shed some light into the whole coverage situation 27087/head
Frantisek Sumsal [Sat, 1 Apr 2023 10:15:42 +0000 (12:15 +0200)] 
test: shed some light into the whole coverage situation

2 years agofirstboot: Add --reset option 25836/head
Daan De Meyer [Thu, 22 Dec 2022 10:05:08 +0000 (11:05 +0100)] 
firstboot: Add --reset option

This can be used to prepare an image for firstboot by removing all
files that systemd knows about that contain machine specific
information.

2 years agofirstboot: Do not dereference symlinks
Daan De Meyer [Sat, 1 Apr 2023 08:46:42 +0000 (10:46 +0200)] 
firstboot: Do not dereference symlinks

Let's always operate on paths without resolving the final component.
If the path is a symlink, it could point to a vendor default in /usr,
in which case we definitely do not want to modify the vendor defaults.
To avoid this from happening, we replace the symlink with our own file
instead of modifying the file the symlink points at.

2 years agoadd a github workflow action to make a release from tags
Дамјан Георгиевски [Thu, 30 Mar 2023 12:21:54 +0000 (14:21 +0200)] 
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

2 years agoTrim TODO a bit
Daan De Meyer [Fri, 31 Mar 2023 18:18:03 +0000 (20:18 +0200)] 
Trim TODO a bit

Let's drop stuff that's already implemented.

2 years agotreewide: fix unnecessary $ on arithmetic variables
Dmitry V. Levin [Fri, 31 Mar 2023 08:00:00 +0000 (08:00 +0000)] 
treewide: fix unnecessary $ on arithmetic variables

This should fix shellcheck warning SC2004.

2 years agotest: set ReadWritePaths= for test-.services when built w/ coverage
Frantisek Sumsal [Fri, 31 Mar 2023 16:42:38 +0000 (18:42 +0200)] 
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.

2 years agocore: skip deps on oomd if v2 or memory unavailable
Zbigniew Jędrzejewski-Szmek [Fri, 31 Mar 2023 16:31:56 +0000 (18:31 +0200)] 
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.

2 years agotest: fixed negative checks in TEST-70-TPM2.
OMOJOLA JOSHUA DAMILOLA [Thu, 30 Mar 2023 21:36:50 +0000 (21:36 +0000)] 
test: fixed negative checks in TEST-70-TPM2.
Use in-line error handling rather than redirections. Follow up on #27020

2 years agotest: use setpriv instead of su for user switch from root
Thomas Blume [Tue, 14 Mar 2023 14:21:29 +0000 (15:21 +0100)] 
test: use setpriv instead of su for user switch from root

systemd-repart needs to find mkfs.ext4 for the test.
This is located in the directory /usr/sbin on openSUSE Tumbleweed.
But since the variable ALWAYS_SET_PATH in /etc/login.defs is set to yes,
su re-initializes the $PATH variable and removes /usr/sbin.
Hence, mkfs.ext4 is not found and the test fails.
Using setpriv instead of su fixes this issue and is more appropriate to
do the switch user task from root.

[zjs: move setpriv to $BASICTOOLS and force-push to retrigger CI]

2 years agoTODO: drop items regarding swap-for-hibernate-only-use
Lennart Poettering [Fri, 31 Mar 2023 10:21:35 +0000 (12:21 +0200)] 
TODO: drop items regarding swap-for-hibernate-only-use

I doubt we should bother. Swap always makes sense, and having a swap
partition for hibernate only without using it all the time just makes
the system worse overall.

2 years agodocs: fix coredump legacy example
Ludwig Nussel [Fri, 31 Mar 2023 08:10:23 +0000 (10:10 +0200)] 
docs: fix coredump legacy example

2 years agoMerge pull request #27080 from yuwata/rm-rf
Daan De Meyer [Fri, 31 Mar 2023 07:59:06 +0000 (09:59 +0200)] 
Merge pull request #27080 from yuwata/rm-rf

rm-rf: also chmod() directory if it cannot be opened

2 years agoRevert "Revert "test: add more testcases for rm_rf()"" 27080/head
Yu Watanabe [Fri, 31 Mar 2023 02:26:55 +0000 (11:26 +0900)] 
Revert "Revert "test: add more testcases for rm_rf()""

This reverts commit 8c81a618103cafc715e0a1a521e9f1bd34e3e207.

2 years agorm-rf: also chmod() directory if it cannot be opened
Yu Watanabe [Sat, 18 Mar 2023 17:34:22 +0000 (02:34 +0900)] 
rm-rf: also chmod() directory if it cannot be opened

Otherwise, directory with zero access mode cannot be removed.

This is a revised version of 808c8b25eece33c503430151641f5f77676af38c,
- dropped O_NOFOLLOW from fd_reopen()
- fixed error handling on opening path in rm_rf().

2 years agocore: always calculate the next restart interval
Mike Yuan [Wed, 29 Mar 2023 20:04:22 +0000 (04:04 +0800)] 
core: always calculate the next restart interval

Follow-up for #26902 and #26971

Let's always calculate the next restart interval
since that's more useful.

For that, we add 1 to s->n_restarts unconditionally,
and change RestartUSecCurrent property to RestartUSecNext.

2 years agoMerge pull request #27075 from mrc0mmand/test-tweaks
Luca Boccassi [Fri, 31 Mar 2023 00:18:15 +0000 (01:18 +0100)] 
Merge pull request #27075 from mrc0mmand/test-tweaks

test: a couple of coverage-related test tweaks

2 years agobootctl: clean up handling of files with no version information
Zbigniew Jędrzejewski-Szmek [Thu, 30 Mar 2023 09:58:05 +0000 (11:58 +0200)] 
bootctl: clean up handling of files with no version information

get_file_version() would return:
- various negative errors if the file could not be accessed or if it was not a
  regular file
- 0/NULL if the file was too small
- -ESRCH or -EINVAL if the file did not contain the marker
- -ENOMEM or permissions errors
-  1 if the marker was found

bootctl status iterates over /EFI/{systemd,BOOT}/*.efi and checks if the files
contain a systemd-boot version tag. Resource or permission errors should be
fatal, but lack of version information should be silently ignored.

OTOH, when updating or installing bootloader files, the version is expected
to be present.

get_file_version() is changed to return -ESRCH if the version is unavailable,
and other errnos for permission or resource errors.

The logging is reworked to always display an error if encountered, but also
to log the status at debug level what the result of the version inquiry is.
This makes it figure out what is going on:
  /efi/EFI/systemd/systemd-bootx64.efi: EFI binary LoaderInfo marker: "systemd-boot 253-6.fc38"
  /efi/EFI/BOOT/BOOTfbx64.efi: EFI binary has no LoaderInfo marker.
  /efi/EFI/BOOT/BOOTIA32.EFI: EFI binary has no LoaderInfo marker.
  /efi/EFI/BOOT/BOOTX64.EFI: EFI binary LoaderInfo marker: "systemd-boot 253-6.fc38"

Replaces #27034.
Fixes https://github.com/NixOS/nixpkgs/issues/223579.

2 years agoMerge pull request #27072 from bluca/man_example
Luca Boccassi [Thu, 30 Mar 2023 18:56:14 +0000 (19:56 +0100)] 
Merge pull request #27072 from bluca/man_example

man: further shorten print-unit-path example

2 years agotest: make make_addresses() actually return the addresses 27075/head
Frantisek Sumsal [Thu, 30 Mar 2023 18:18:26 +0000 (20:18 +0200)] 
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.

2 years agocoverage: add a wrapper for execveat()
Frantisek Sumsal [Thu, 30 Mar 2023 17:26:53 +0000 (19:26 +0200)] 
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

2 years agoman: add example for sd_bus_call_method 27072/head
Luca Boccassi [Thu, 30 Mar 2023 16:03:50 +0000 (17:03 +0100)] 
man: add example for sd_bus_call_method

2 years agoman: further shorten print-unit-path example
Luca Boccassi [Wed, 29 Mar 2023 20:45:10 +0000 (21:45 +0100)] 
man: further shorten print-unit-path example

2 years agoman: link up new online coredump docs from man page
Lennart Poettering [Thu, 30 Mar 2023 14:44:31 +0000 (16:44 +0200)] 
man: link up new online coredump docs from man page

2 years agoMerge pull request #27074 from bluca/revert_rm
Luca Boccassi [Thu, 30 Mar 2023 17:07:27 +0000 (18:07 +0100)] 
Merge pull request #27074 from bluca/revert_rm

Revert rm-rf changes that are causing test failures

2 years agoRevert "rm-rf: also chmod() directory if it cannot be opened" 27074/head
Luca Boccassi [Thu, 30 Mar 2023 15:48:22 +0000 (16:48 +0100)] 
Revert "rm-rf: also chmod() directory if it cannot be opened"

This reverts commit 808c8b25eece33c503430151641f5f77676af38c.

2 years agoRevert "test: add more testcases for rm_rf()"
Luca Boccassi [Thu, 30 Mar 2023 15:48:18 +0000 (16:48 +0100)] 
Revert "test: add more testcases for rm_rf()"

This reverts commit 0278b1c80101cc0d857c1becd0c3a51b2eb14a44.

2 years agopid1: fully disable coredumping to $PWD
Zbigniew Jędrzejewski-Szmek [Thu, 30 Mar 2023 08:04:18 +0000 (10:04 +0200)] 
pid1: fully disable coredumping to $PWD

We have three states:
- ENABLE_COREDUMP and systemd-coredump is installed,
- ENABLE_COREDUMP but systemd-coredump is not installed,
- !ENABLE_COREDUMP.

In the last case we would not do any coredumping-related setup in pid1, which
means that coredumps would go to to the working directory of the process, but
actually limits are set to 0. This is inherited by children of pid1.

As discussed extensively in https://github.com/systemd/systemd/pull/26607, this
default is bad: dumps are written to arbitrary directories and not cleaned up.

Nevertheless, the kernel cannot really fix it. It doesn't know where to write,
and it doesn't know when that place would become available. It is only the
userspace that can tell this to the kernel. So the only sensible change in the
kernel would be to default to '|/bin/false', i.e. do what we do now.

In the middle case, we disabled writing of coredumps via a pattern, but raise
the RLIMIT_CORE. We need to raise the limit because we can't raise it later
after processes have been forked off. This means we behave correctly, but allow
coredumping to be enabled at a later point without a reboot.

This patch makes the last case behave like the middle case. This means that
even if systemd is compiled with systemd-coredump, it still does the usual
setup. If users want to restore the kernel default, they need to provide two
drop-in files:
  for sysctl.d, with 'kernel.core_pattern=core'
  for systemd.conf, with 'DefaultLimitCORE=0'.

The general idea is that pid1 does the safe thing. A distro may want to use
something different than the systemd-coredump machinery, and then that would
could packaged together with the drop-ins to change the configuration.

Alternative-for: #26607

2 years agodocs: add a document with an overview over systemd's coredump handling
Lennart Poettering [Thu, 30 Mar 2023 09:50:27 +0000 (11:50 +0200)] 
docs: add a document with an overview over systemd's coredump handling

2 years agobasic: update the Arch tuples for LoongArch
Xiaotian Wu [Tue, 8 Mar 2022 03:15:25 +0000 (11:15 +0800)] 
basic: update the Arch tuples for LoongArch

After this commit[1], LoongArch now uses these Multiarch specs:

- Double float: loongarch64-linux-gnu
- Single float: loongarch64-linux-gnuf32
- Soft float: loongarch64-linux-gnusf

You can visit here[2] to view the full documentation.

[1]: https://github.com/loongson/LoongArch-Documentation/commit/55dbaadaaa90b5f5d08a74d96b866af42c8c3c82
[2]: https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html