]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
10 months agoupdate TODO 35536/head
Lennart Poettering [Tue, 10 Dec 2024 19:49:31 +0000 (20:49 +0100)] 
update TODO

10 months agoman: document the new per-use credstore paths
Lennart Poettering [Tue, 10 Dec 2024 20:34:06 +0000 (21:34 +0100)] 
man: document the new per-use credstore paths

(And some other minor tweaks)

10 months agotest: add integration test that makes sure unpriv creds work correctly
Lennart Poettering [Tue, 10 Dec 2024 19:50:19 +0000 (20:50 +0100)] 
test: add integration test that makes sure unpriv creds work correctly

This checks both the per-user credstore directory logic, and that
unprivileged, encrypted credentials work.

10 months agopid1: add support for decrypting per-user credentials
Lennart Poettering [Tue, 10 Dec 2024 13:56:18 +0000 (14:56 +0100)] 
pid1: add support for decrypting per-user credentials

When I added support for unprivileged credentials I apparently never
hooked them up to service management correctly. Let's fix that.

Fixes: #33796 #33318
10 months agoexecute: introduce a user-scoped credstore
Lennart Poettering [Tue, 10 Dec 2024 12:35:39 +0000 (13:35 +0100)] 
execute: introduce a user-scoped credstore

Fixes: #33887
10 months agosd-path: expose credential store in sd-path
Lennart Poettering [Tue, 10 Dec 2024 13:34:41 +0000 (14:34 +0100)] 
sd-path: expose credential store in sd-path

10 months agosystemd-path: add the usual ANSI sequences to --help text
Lennart Poettering [Tue, 10 Dec 2024 20:38:37 +0000 (21:38 +0100)] 
systemd-path: add the usual ANSI sequences to --help text

10 months agosystemd-path: guarantee that tool exit status is zero on success
Lennart Poettering [Tue, 10 Dec 2024 13:05:04 +0000 (14:05 +0100)] 
systemd-path: guarantee that tool exit status is zero on success

Let's not inherit the error code from an earlier function invocation.

10 months agosystemd-path: order all listed paths by their ID alphabetically
Lennart Poettering [Tue, 10 Dec 2024 13:01:13 +0000 (14:01 +0100)] 
systemd-path: order all listed paths by their ID alphabetically

Let's add some system to the madness, given we added user-specific dirs
to the end of the list, but they should really be listed together with
the other user-specific ones.

10 months agosd-path: don't chop off trailing slash in sd_path apis, when user provided them
Lennart Poettering [Tue, 10 Dec 2024 12:37:56 +0000 (13:37 +0100)] 
sd-path: don't chop off trailing slash in sd_path apis, when user provided them

This is a minor compat break, but given the slow adoption of the
sd-path.h APIs I think it's one we should take. Basically, the idea is
that if the user provides a suffix path with a trailing slash (thus
encoding in the path that the last element must be a dir), we should
keep it in place, and not suppress it, in order to not willy nilly
reduce the amount of information contained in the path.

Simplifications that do not alter meaning, and do not suppress
information should be fine to apply to a path, but otherwise we really
should be conservative on this.

10 months agopid1: normalize oom error handling a bit
Lennart Poettering [Tue, 10 Dec 2024 10:10:30 +0000 (11:10 +0100)] 
pid1: normalize oom error handling a bit

10 months agopo: Translated using Weblate (Finnish)
Ricky Tigg [Fri, 20 Dec 2024 15:38:37 +0000 (16:38 +0100)] 
po: Translated using Weblate (Finnish)

Currently translated at 100.0% (257 of 257 strings)

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/fi/
Translation: systemd/main

10 months agoAdd .venv to gitignore
Septatrix [Fri, 20 Dec 2024 14:44:20 +0000 (15:44 +0100)] 
Add .venv to gitignore

This directory is commonly used for virtual Python environments.
These are useful when developing to install different Python versions
as well as install tooling like mkosi and mypy in an isolated fashion
without influencing the global system.

10 months agocore/device: handle ID_PROCESSING udev property (#35351)
Lennart Poettering [Fri, 20 Dec 2024 09:12:39 +0000 (10:12 +0100)] 
core/device: handle ID_PROCESSING udev property (#35351)

Continuation of #35332.

10 months agodebug-generator: add a kernel cmdline option to pause the boot process (#35410)
Daan De Meyer [Fri, 20 Dec 2024 09:04:41 +0000 (10:04 +0100)] 
debug-generator: add a kernel cmdline option to pause the boot process (#35410)

Introduce the `systemd.break=` kernel command line option to allow
stopping the boot process at a certain point and spawn a debug shell.
After exiting this shell, the system will resume booting.

It accepts the following values:
- `pre-udev`: before starting to process kernel uevents (initrd and
host).
- `pre-basic`: before leaving early boot and regular services start
(initrd and host).
- `pre-mount`: before the root filesystem is mounted (initrd).
- `pre-switch-root`: before switching root (initrd).

10 months ago[RFC] better naming for Azure MANA network devices (#34255)
Lennart Poettering [Fri, 20 Dec 2024 08:52:40 +0000 (09:52 +0100)] 
[RFC] better naming for Azure MANA network devices (#34255)

The Azure MANA folks would like the PCI domain to be suppressed from
naming network interfaces. Let's introduce a somewhat generic way to do
this, without hardcoding anything to Azure.

Specifically: we'll ship a new hwdb entry that sets a new
ID_NET_NAME_INCLUDE_DOMAIN=0 property on relevant MANA devices. Then we
make net_id look for that property, and if it is set we simply suppress
the PCI domain.

(Untested as of now, needs feedback from Azure MANA folks that this
actually works and does what is requested here).

10 months agomkosi: move config options
Matteo Croce [Thu, 19 Dec 2024 18:51:42 +0000 (19:51 +0100)] 
mkosi: move config options

Move some config option in the right section, fixes the following warning:
```
mkosi.conf: Setting Credentials should be configured in [Runtime], not [Host].
mkosi.conf: Setting RuntimeBuildSources should be configured in [Runtime], not [Host].
mkosi.conf: Setting RuntimeScratch should be configured in [Runtime], not [Host].
mkosi.conf: Setting QemuSmp should be configured in [Runtime], not [Host].
mkosi.conf: Setting QemuSwtpm should be configured in [Runtime], not [Host].
mkosi.conf: Setting QemuVsock should be configured in [Runtime], not [Host].
mkosi.conf: Setting QemuKvm should be configured in [Runtime], not [Host].
```

10 months agoaudit-util: rename output parameter
Yu Watanabe [Fri, 20 Dec 2024 06:11:47 +0000 (15:11 +0900)] 
audit-util: rename output parameter

To make them consistent with in audit-util.c.

Follow-up for 7e02ee98d86702b8e7055f0a6d8e6ea48267ad23.

10 months agoTEST-71-HOSTNAME: do not start user session
Yu Watanabe [Fri, 20 Dec 2024 05:55:10 +0000 (14:55 +0900)] 
TEST-71-HOSTNAME: do not start user session

The user session may trigger hostnamed, and the job of stopping
hostnamed may be cancelled, and the test may fail:
```
[ 4633.613578] TEST-71-HOSTNAME.sh[175]: + stop_hostnamed
[ 4633.613578] TEST-71-HOSTNAME.sh[175]: + systemctl stop systemd-hostnamed.service
[ 4633.664670] systemd[1]: Stopping systemd-hostnamed.service - Hostname Service...
[ 4636.022277] systemd-logind[121]: New session c2 of user root.
[ 4636.032532] systemd[1]: Created slice user-0.slice - User Slice of UID 0.
[ 4636.042675] systemd[1]: Starting user-runtime-dir@0.service - User Runtime Directory /run/user/0...
[ 4636.176140] systemd[1]: Finished user-runtime-dir@0.service - User Runtime Directory /run/user/0.
[ 4636.202951] systemd[1]: Starting user@0.service - User Manager for UID 0...
[ 4636.292204] systemd-logind[121]: New session c3 of user root.
[ 4636.300065] (systemd)[268]: pam_unix(systemd-user:session): session opened for user root(uid=0) by root(uid=0)
[ 4636.757667] systemd[268]: Queued start job for default target default.target.
[ 4636.774419] systemd[268]: Created slice app.slice - User Application Slice.
[ 4636.774579] systemd[268]: Started systemd-tmpfiles-clean.timer - Daily Cleanup of User's Temporary Directories.
[ 4636.774747] systemd[268]: Reached target paths.target - Paths.
[ 4636.776418] systemd[268]: Reached target sysinit.target - System Initialization.
[ 4636.776604] systemd[268]: Reached target timers.target - Timers.
[ 4636.784997] systemd[268]: Starting dbus.socket - D-Bus User Message Bus Socket...
[ 4636.799472] systemd[268]: Starting systemd-tmpfiles-setup.service - Create User Files and Directories...
[ 4637.027125] systemd[268]: Finished systemd-tmpfiles-setup.service - Create User Files and Directories.
[ 4637.031721] systemd[268]: Listening on dbus.socket - D-Bus User Message Bus Socket.
[ 4637.036189] systemd[268]: Reached target sockets.target - Sockets.
[ 4637.036373] systemd[268]: Reached target basic.target - Basic System.
[ 4637.036558] systemd[268]: Reached target default.target - Main User Target.
[ 4637.036646] systemd[268]: Startup finished in 702ms.
[ 4637.049075] systemd[1]: Started user@0.service - User Manager for UID 0.
[ 4637.075263] systemd[1]: Started session-c2.scope - Session c2 of User root.
[ 4637.084917] login[136]: pam_unix(login:session): session opened for user root(uid=0) by root(uid=0)
[ 4637.117348] login[136]: ROOT LOGIN ON pts/0
[ 4637.238572] systemctl[261]: Job for systemd-hostnamed.service canceled.
[ 4637.290369] systemd[1]: TEST-71-HOSTNAME.service: Main process exited, code=exited, status=1/FAILURE
```

Fixes #35643.

10 months agodebug-generator: add a kernel cmdline option to pause the boot process 35410/head
Antonio Alvarez Feijoo [Fri, 20 Dec 2024 07:51:23 +0000 (08:51 +0100)] 
debug-generator: add a kernel cmdline option to pause the boot process

Introduce the `systemd.break=` kernel command line option to allow stopping the
boot process at a certain point and spawn a debug shell. After exiting this
shell, the system will resume booting.

It accepts the following values:
- `pre-udev`: before starting to process kernel uevents (initrd and host).
- `pre-basic`: before leaving early boot and regular services start (initrd and
host).
- `pre-mount`: before the root filesystem is mounted (initrd).
- `pre-switch-root`: before switching root (initrd).

10 months agoman/debug-generator: add a section for kernel command line options
Antonio Alvarez Feijoo [Fri, 29 Nov 2024 10:29:17 +0000 (11:29 +0100)] 
man/debug-generator: add a section for kernel command line options

10 months agocapability-util: generalize helper to acquire local caps (#35403)
Yu Watanabe [Fri, 20 Dec 2024 02:52:24 +0000 (11:52 +0900)] 
capability-util: generalize helper to acquire local caps (#35403)

This generalizes and modernizes the code to acquire set of local caps,
based on the code for this in the condition logic. Uses PidRef, and
acquires the full quintuplet of caps.

This can be considered preparation to one day maybe build without
libcap.

10 months agoanalyze: add "chid" verb to display CHIDs of the local system (#35175)
Yu Watanabe [Fri, 20 Dec 2024 02:47:03 +0000 (11:47 +0900)] 
analyze: add "chid" verb to display CHIDs of the local system (#35175)

We already have the code for it, expose it in systemd-analyze, because
it's useful.

10 months agoSmall fixes to nspawn and other stuff (#35686)
Yu Watanabe [Fri, 20 Dec 2024 02:03:59 +0000 (11:03 +0900)] 
Small fixes to nspawn and other stuff (#35686)

Split out ouf #35685.

10 months agoTEST-17: add test case for ID_PROCESSING flag on add uevent 35351/head
Yu Watanabe [Mon, 25 Nov 2024 19:11:28 +0000 (04:11 +0900)] 
TEST-17: add test case for ID_PROCESSING flag on add uevent

Also, check the state of the device units on change event.

10 months agocore/device: handle ID_PROCESSING udev property
Yu Watanabe [Mon, 25 Nov 2024 16:19:35 +0000 (01:19 +0900)] 
core/device: handle ID_PROCESSING udev property

If an enumerated device has ID_PROCESSING=1 property, and the service
manager does not know if the device has been processed by udevd
previously (that is, Device.deserialized_found does not have
DEVICE_FOUND_UDEV), then drop DEVICE_FOUND_UDEV flag from the device and
make the device not enter the active state.

Follow-up for 405be62f05d76f1845f347737b5972158c79dd3e, which was
reverted by c4fc22c4defc5983e53f4ce048e15ea7d31e6a75.

10 months agocore/device: use path_equal() to compare sysfs path
Yu Watanabe [Mon, 16 Dec 2024 16:42:16 +0000 (01:42 +0900)] 
core/device: use path_equal() to compare sysfs path

The hashmap Manager.devices_by_sysfs uses path_hash_ops.
Let's consistent compare function.

10 months agocore/device: rename output parameters of device_setup_units() to ret_xyz
Yu Watanabe [Mon, 25 Nov 2024 13:48:37 +0000 (22:48 +0900)] 
core/device: rename output parameters of device_setup_units() to ret_xyz

No functional change, just refactoring.

10 months agoudev: support reloading udev.conf (#35458)
Yu Watanabe [Fri, 20 Dec 2024 00:00:48 +0000 (09:00 +0900)] 
udev: support reloading udev.conf (#35458)

This makes systemd-udevd reload udev.conf when explicitly requested by
e.g. `udevadm control --reload`.

10 months agoptyfwd: reset writable/readable flag before shovel() on exit
Yu Watanabe [Thu, 19 Dec 2024 03:22:00 +0000 (12:22 +0900)] 
ptyfwd: reset writable/readable flag before shovel() on exit

Follow-up for 12807b5a49d1fe60434d473afe11ff81a4c92306.

Otherwise, if a call of shovel() disabled the flags, the subsequent
calls do nothing even if there is something we need to read or write.

Fixes the following error:
```
Dec 19 02:19:39 run0[5618]: Error on PTY forwarding logic: Too many levels of symbolic links
```

10 months agomachine: make TEST-13-NSPAWN wqlong-running code more verbose
Ivan Kruglov [Wed, 18 Dec 2024 17:50:35 +0000 (18:50 +0100)] 
machine: make TEST-13-NSPAWN wqlong-running code more verbose

Need this to debug https://github.com/systemd/systemd/issues/35115

10 months agoMinor fixes in man pages, example scripts, error log (#35683)
Luca Boccassi [Thu, 19 Dec 2024 17:08:13 +0000 (17:08 +0000)] 
Minor fixes in man pages, example scripts, error log (#35683)

No functional changes.

10 months agonspawn: switch to read_virtual_file() for reading audit loginuid 35686/head
Lennart Poettering [Thu, 14 Nov 2024 11:25:22 +0000 (12:25 +0100)] 
nspawn: switch to read_virtual_file() for reading audit loginuid

10 months agonsresource: print nicer error message when trying to acquire an unpriv user ns range...
Lennart Poettering [Tue, 12 Nov 2024 13:19:09 +0000 (14:19 +0100)] 
nsresource: print nicer error message when trying to acquire an unpriv user ns range where this isn't possible

10 months agomount-util: add debug message to make_userns() failure
Lennart Poettering [Thu, 19 Dec 2024 13:27:03 +0000 (14:27 +0100)] 
mount-util: add debug message to make_userns() failure

10 months agomount-util: add debug output when we switched root
Lennart Poettering [Mon, 25 Nov 2024 10:35:11 +0000 (11:35 +0100)] 
mount-util: add debug output when we switched root

10 months agonspawn: trivial improvements
Lennart Poettering [Wed, 13 Nov 2024 11:15:08 +0000 (12:15 +0100)] 
nspawn: trivial improvements

10 months agonspawn: rename pin_fully_visible_fs() → pin_fully_visible_api_fs()
Lennart Poettering [Mon, 25 Nov 2024 10:32:35 +0000 (11:32 +0100)] 
nspawn: rename pin_fully_visible_fs() → pin_fully_visible_api_fs()

This function pins the *API* FS, i.e. /proc/ + /sys/, not just any fs.
Hence clarify this in the name.

(At least we call these two fs "API (V)FS" in our codebase, hence
continue to do so here)

10 months agonspawn: add some additional useful debug logging
Lennart Poettering [Mon, 25 Nov 2024 10:54:21 +0000 (11:54 +0100)] 
nspawn: add some additional useful debug logging

10 months agonspawn: make unexpected mkdir() failures fatal
Lennart Poettering [Mon, 25 Nov 2024 11:08:59 +0000 (12:08 +0100)] 
nspawn: make unexpected mkdir() failures fatal

THis is just to make things easier to debug.

10 months agonspawn: rename 'fd' variable to something more descriptive
Lennart Poettering [Mon, 25 Nov 2024 11:18:14 +0000 (12:18 +0100)] 
nspawn: rename 'fd' variable to something more descriptive

10 months agonspawn: use DEVNUM_FORMAT_STR/DEVNUM_FORMAT_VAL more
Lennart Poettering [Thu, 19 Dec 2024 13:26:14 +0000 (14:26 +0100)] 
nspawn: use DEVNUM_FORMAT_STR/DEVNUM_FORMAT_VAL more

10 months agoman/sysupdate.features: fix typos 35683/head
Matthias Lisin [Thu, 19 Dec 2024 11:04:24 +0000 (12:04 +0100)] 
man/sysupdate.features: fix typos

10 months agosysupdate: fix args order of formatted error
Matthias Lisin [Thu, 19 Dec 2024 10:30:13 +0000 (11:30 +0100)] 
sysupdate: fix args order of formatted error

10 months agoman/sysupdate.d: fix wrong PathRelativeTo value
Matthias Lisin [Thu, 19 Dec 2024 09:32:52 +0000 (10:32 +0100)] 
man/sysupdate.d: fix wrong PathRelativeTo value

10 months agoman: fix args order for udevadm info cmd
Matthias Lisin [Wed, 16 Oct 2024 05:02:21 +0000 (07:02 +0200)] 
man: fix args order for udevadm info cmd

10 months agoTEST-17: use 'udevadm control --reload' or 'systemctl reload systemd-udevd.service... 35458/head
Yu Watanabe [Tue, 3 Dec 2024 21:34:43 +0000 (06:34 +0900)] 
TEST-17: use 'udevadm control --reload' or 'systemctl reload systemd-udevd.service' for reloading udev.conf

These should be equivalent. For coverage, one subtest uses systemctl and
another uses udevadm.

10 months agoudev: also reload udev.conf when explicitly requested
Yu Watanabe [Tue, 3 Dec 2024 19:29:13 +0000 (04:29 +0900)] 
udev: also reload udev.conf when explicitly requested

When reloading is explicitly requested, e.g. by 'udevadm control --reload',
then also reload udev.conf.

10 months agoudev: reload .rules files and builtins only when necessary
Yu Watanabe [Tue, 3 Dec 2024 19:31:31 +0000 (04:31 +0900)] 
udev: reload .rules files and builtins only when necessary

Previously, even if e.g. .rules files are unchanged, all .rules files
are reloaded when other kind of config files like .link files or
.hwdb.bin are changed, vice versa.

10 months agoudev: move config parsers and related things to udev-config.c (#35624)
Yu Watanabe [Thu, 19 Dec 2024 09:41:52 +0000 (18:41 +0900)] 
udev: move config parsers and related things to udev-config.c (#35624)

No functional change, just refactoring and preparation for later
changes.

10 months agoudev-config: introduce UdevConfig 35624/head
Yu Watanabe [Tue, 3 Dec 2024 17:26:02 +0000 (02:26 +0900)] 
udev-config: introduce UdevConfig

Then, save configurations by their source: udev.conf, command line
arguments, kernel command line options, and udev control.

Preparation to support reloading udev.conf in a later commit.

10 months agoudev: move parsers for config file, kerenel command line, and positional arguments...
Yu Watanabe [Tue, 3 Dec 2024 17:33:47 +0000 (02:33 +0900)] 
udev: move parsers for config file, kerenel command line, and positional arguments to udev-config.c

No functional change, just refactoring and preparation for later
commits.

10 months agoukify: Fix regression in --no-sign-kernel flag
Thomas Hebb [Wed, 18 Dec 2024 16:08:17 +0000 (11:08 -0500)] 
ukify: Fix regression in --no-sign-kernel flag

The man page says that --sign-kernel and --no-sign-kernel "override the
detection of whether to sign the Linux binary", so we should only
autodetect if neither are specified. But as of commit 02eabaffe98c
("ukify: Add a unified interface for signing tools"), we autodetect even
when --no-sign-kernel is passed, which makes the flag useless.

The sign_kernel option is parsed using argparse.BooleanOptionalAction,
which sets it to either True, False, or None. commit 02eabaffe98c
replaced `sign_kernel is None` with `not sign_kernel`. These are not the
same in Python, as the latter accepts False as well as None.

Restore the original check and fix type annotations accordingly.

Fixes: 02eabaffe98c ("ukify: Add a unified interface for signing tools")
10 months agonetworkd-sysctl: tweak error handling and log level a bit (#35673)
Lennart Poettering [Wed, 18 Dec 2024 17:20:30 +0000 (18:20 +0100)] 
networkd-sysctl: tweak error handling and log level a bit (#35673)

10 months agoanalyze: drop conditioning of --no-legend and --json= on specific verbs 35175/head
Lennart Poettering [Fri, 15 Nov 2024 10:40:44 +0000 (11:40 +0100)] 
analyze: drop conditioning of --no-legend and --json= on specific verbs

First of all, the list of verbs was badly out of date, in particular for
--no-legend. But second if it, I think such minor switches that alter
some detail of the output should not result in failure when the specific
tweak does not apply on some command. It should be fine for scripts and
suchlike to dumbly always pass --no-legend to all invocations of our
tools without having to consider if a specific subtool of ours actually
supports it or not.

10 months agoanalyze: add verb for showing system's CHIDs
Lennart Poettering [Fri, 15 Nov 2024 10:38:30 +0000 (11:38 +0100)] 
analyze: add verb for showing system's CHIDs

We have the code already, expose it in systemd-analyze too.

This should make it easier to debug the CHID use in the UKIs with
onboard tooling.

10 months agonetworkd-sysctl: tweak error handling and log level a bit 35673/head
Mike Yuan [Wed, 18 Dec 2024 13:34:59 +0000 (14:34 +0100)] 
networkd-sysctl: tweak error handling and log level a bit

Follow-up for 6d9ef22acdeac4b429efb75164341233955484af

- Downgrade log level for bpf not installed or kernel version
  being too old to LOG_DEBUG. Otherwise, on kernels older than 6.12
  the log becomes quite annoying.
- Always propagate the error and ignore only on caller's side.
  The current style is a messy mix.

10 months agoman: Document generator sandbox environment
Daan De Meyer [Wed, 18 Dec 2024 11:32:59 +0000 (12:32 +0100)] 
man: Document generator sandbox environment

10 months agonetworkd-sysctl: rename functions to match our typical prefixes
Mike Yuan [Wed, 18 Dec 2024 13:26:39 +0000 (14:26 +0100)] 
networkd-sysctl: rename functions to match our typical prefixes

10 months agoptyfwd: several cleanups (#35663)
Yu Watanabe [Wed, 18 Dec 2024 15:35:42 +0000 (00:35 +0900)] 
ptyfwd: several cleanups (#35663)

10 months agoupdate-utmp: do not give up if the first attempt at connecting bus failed
Yu Watanabe [Wed, 18 Dec 2024 13:27:29 +0000 (22:27 +0900)] 
update-utmp: do not give up if the first attempt at connecting bus failed

Otherwise, the program exits with failure if the first attempt in run() failed:
```
Dec 18 20:27:37 systemd-update-utmp[254]: Bus n/a: changing state UNSET → OPENING
Dec 18 20:27:37 systemd-update-utmp[254]: sd-bus: starting bus by connecting to /run/systemd/private...
Dec 18 20:27:37 systemd-update-utmp[254]: Bus n/a: changing state OPENING → CLOSED
Dec 18 20:27:37 systemd-update-utmp[254]: Failed to get D-Bus connection: Connection refused
```

10 months agoTEST-50-DISSECT: notify message cannot be sent by ncat
Yu Watanabe [Tue, 17 Dec 2024 06:09:47 +0000 (15:09 +0900)] 
TEST-50-DISSECT: notify message cannot be sent by ncat

Follow-up for d0a63cf0412ccb9b4edd1f6048e25aa7f68b0133.

The command ncat may be already dead when the service manager receives
the notify message. Hence, the service cannot be found by the sender PID,
and the notify message will be ignored.
```
Dec 17 03:26:49 systemd[1]: Cannot find unit for notify message of PID 1159, ignoring.
Dec 17 03:26:49 systemd[1]: Received SIGCHLD from PID 1152 (bash).
Dec 17 03:26:49 systemd[1]: Child 1152 (bash) died (code=exited, status=0/SUCCESS)
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Child 1152 belongs to run-p1151-i1451.service.
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Main process exited, code=exited, status=0/SUCCESS (success)
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Failed with result 'protocol'.
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Service will not restart (restart setting)
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Changed start -> failed
```

This also drops unnecessary --pipe option and redundant check by 'env' command.

10 months agoresolved: if one transaction completes, expect other transactions within candidate...
Morten Hauke Solvang [Thu, 12 Dec 2024 13:26:31 +0000 (14:26 +0100)] 
resolved: if one transaction completes, expect other transactions within candidate to succeed quickly

Fixes #22575, as suggested by poettering in #35514.

Intended as a workaround for some buggy routers, which refuse to send empty
replies. If systemd-resolved starts two DnsTransactions, one for A and one
for AAAA, and the domain in question has no AAAA entry, then the server will
send a reply for A and no reply for AAAA. Correct behavior for the server would
be to send an empty reply for AAAA.

systemd-resolved would previously keep retrying the AAAA transaction, and
eventually timeout the whole query, returning an error to the caller.

Now, if the server replies to one query and not another, we cut short the
timeout and return the partial result. Returning the partial result allows
the rest of the system to keep working. It matches how e.g. glibc libnss_dns
behaves.

10 months agotest-firewall-util: Migrate to new assertion macros
Daan De Meyer [Wed, 18 Dec 2024 10:42:37 +0000 (11:42 +0100)] 
test-firewall-util: Migrate to new assertion macros

10 months agoudev: make builtins take UdevEvent object (#35625)
Yu Watanabe [Wed, 18 Dec 2024 13:02:22 +0000 (22:02 +0900)] 
udev: make builtins take UdevEvent object (#35625)

No functional change, just refactoring.

10 months agodata-fd-util: drop dead code
Yu Watanabe [Wed, 18 Dec 2024 02:55:47 +0000 (11:55 +0900)] 
data-fd-util: drop dead code

Also drops unnecessary header inclusions.

Follow-ups for a87a9625f8bde776ece11b8ddb77588cfff73038.
Fixes CID#1568419.

10 months agotpm2-util: Also retry unsealing after policy_pcr returns PCR_CHANGED
Fabian Vogt [Mon, 16 Dec 2024 18:08:13 +0000 (19:08 +0100)] 
tpm2-util: Also retry unsealing after policy_pcr returns PCR_CHANGED

It's not just Esys_Unseal that may fail due to PCR changes during the
session, but also Esys_PolicyPCR. Perform a retry in that case as well.

Fixes #35490

10 months agotree-wide: use pidref_is_self() at more places
Lennart Poettering [Tue, 19 Nov 2024 14:54:28 +0000 (15:54 +0100)] 
tree-wide: use pidref_is_self() at more places

10 months agomachinectl: explicitly assign PTY forwarder to sd_bus_slot 35663/head
Yu Watanabe [Wed, 18 Dec 2024 04:35:54 +0000 (13:35 +0900)] 
machinectl: explicitly assign PTY forwarder to sd_bus_slot

No functional change, just refactoring.

10 months agoptyfwd: always flush buffer and disconnect before exit
Yu Watanabe [Wed, 18 Dec 2024 02:14:06 +0000 (11:14 +0900)] 
ptyfwd: always flush buffer and disconnect before exit

Then, it is not necessary to manually drain PTY forwarder by the user
side. Also, not necessary to free PTY forwarder earlier explicitly to
make it disconnected.

10 months agoptyfwd: always write additional line break on stop
Yu Watanabe [Wed, 18 Dec 2024 02:12:57 +0000 (11:12 +0900)] 
ptyfwd: always write additional line break on stop

Currently we do that in the user of PTY forwarder, e.g. nspawn.
But, let's do that unconditionally in the PTY forwarder.

10 months agoptyfwd: save the last character before the escape sequence
Yu Watanabe [Wed, 18 Dec 2024 02:10:47 +0000 (11:10 +0900)] 
ptyfwd: save the last character before the escape sequence

If we write e.g. a line break and CSI sequence, then it is not necessary
to write another line break on exit.

10 months agoptyfwd: do not forward partial escape sequence
Yu Watanabe [Wed, 18 Dec 2024 02:06:07 +0000 (11:06 +0900)] 
ptyfwd: do not forward partial escape sequence

Otherwise, if the sender is killed while writing escape sequence,
we may get spurious output.

10 months agoptyfwd: coding style fix
Yu Watanabe [Tue, 17 Dec 2024 06:37:10 +0000 (15:37 +0900)] 
ptyfwd: coding style fix

- replace 'type *func()' -> 'type* func()',
- rename output argument to 'ret'.

10 months agomkosi: Fix tools image package name
Michal Koutný [Wed, 18 Dec 2024 09:36:55 +0000 (10:36 +0100)] 
mkosi: Fix tools image package name

10 months agoconfext/sysext: add initrd-specific units (#35426)
Lennart Poettering [Wed, 18 Dec 2024 09:33:38 +0000 (10:33 +0100)] 
confext/sysext: add initrd-specific units (#35426)

In the rootfs these need to run after /var/lib/ has been set up. In the
initrd we want them to run as soon as possible so that they can be used
to customize setting up the rootfs.

10 months agocore: drop unnecessary header inclusion
Yu Watanabe [Wed, 18 Dec 2024 02:01:35 +0000 (11:01 +0900)] 
core: drop unnecessary header inclusion

Follow-up for e76fcd0e40a6910f4818a374c6a8d854d644ff93.

10 months agoTEST-07-PID1: fix typo
Yu Watanabe [Wed, 18 Dec 2024 01:46:14 +0000 (10:46 +0900)] 
TEST-07-PID1: fix typo

Follow-up for e76fcd0e40a6910f4818a374c6a8d854d644ff93.

10 months agopam_systemd: some refactorings and bugfixes (#35178)
Lennart Poettering [Tue, 17 Dec 2024 22:02:00 +0000 (23:02 +0100)] 
pam_systemd: some refactorings and bugfixes (#35178)

Inspired at #35171 I had another closer look at pam_systemd, and found a
bunch of things to fix, and correct.

10 months agoremove fallbacks for memfd-less kernels (#35605)
Lennart Poettering [Tue, 17 Dec 2024 22:01:29 +0000 (23:01 +0100)] 
remove fallbacks for memfd-less kernels (#35605)

Let the culling continue: let's remove support for kernels that lack
memfd, i.e. pre-3.17 kernels.

This is a nice simplification of things.

10 months agotest: skip TEST-69-SHUTDOWN on ubuntu too
Nick Rosbrook [Tue, 17 Dec 2024 16:10:42 +0000 (11:10 -0500)] 
test: skip TEST-69-SHUTDOWN on ubuntu too

10 months agojournald: get rid of get_process_capeff(), use pidref_get_capability() instead 35403/head
Lennart Poettering [Tue, 17 Dec 2024 18:02:24 +0000 (19:02 +0100)] 
journald: get rid of get_process_capeff(), use pidref_get_capability() instead

This does pretty much the same, but is nicer, since it parses things
properly.

10 months agocapability-util: introduce capability_is_set() helper
Lennart Poettering [Tue, 17 Dec 2024 18:01:13 +0000 (19:01 +0100)] 
capability-util: introduce capability_is_set() helper

10 months agocapability-util: generalize helper to acquire local caps
Lennart Poettering [Thu, 28 Nov 2024 11:59:21 +0000 (12:59 +0100)] 
capability-util: generalize helper to acquire local caps

This generalizes and modernizes the code to acquire set of local caps,
based on the code for this in the condition logic. Uses PidRef, and
acquires the full quintuplet of caps.

This can be considered preparation to one day maybe build without
libcap.

10 months agoupdate TODO 35605/head
Lennart Poettering [Fri, 13 Dec 2024 18:52:33 +0000 (19:52 +0100)] 
update TODO

10 months agodoc: document new baseline requires memfd_create()
Lennart Poettering [Fri, 13 Dec 2024 18:08:16 +0000 (19:08 +0100)] 
doc: document new baseline requires memfd_create()

10 months agofuzz-journal-remote: use memfd_new_and_seal() where appropriate
Lennart Poettering [Mon, 16 Dec 2024 11:18:17 +0000 (12:18 +0100)] 
fuzz-journal-remote: use memfd_new_and_seal() where appropriate

This means we can drop memfd_new_and_map() and results in generally
shorter code.

10 months agopid1: drop check that ensures /run/ has plenty space before reexec/reload
Lennart Poettering [Mon, 16 Dec 2024 10:48:19 +0000 (11:48 +0100)] 
pid1: drop check that ensures /run/ has plenty space before reexec/reload

Now that we only support serialization into a memfd (rather than a file
in /run/) there's no point to check the free space in /run/. Let's drop it.

One error scenario gone. Yay.

10 months agomemfd-util: trivial modernizations
Lennart Poettering [Mon, 16 Dec 2024 10:32:07 +0000 (11:32 +0100)] 
memfd-util: trivial modernizations

10 months agoserialize: add explicit calls for finishing serialization
Lennart Poettering [Mon, 16 Dec 2024 10:29:52 +0000 (11:29 +0100)] 
serialize: add explicit calls for finishing serialization

These new calls will do three things:

1. in case of FILE* stuff: flush any pending bytes onto the fd, just in
   case
2. seal the backing memfd
3. seek back to the beginning.

Note that this adds sealing to serialization: once we serialized fully,
we'll seal the thing off for further modifications, before we pass the
fd over to the target process. This should add a bit of robustness, and
maybe finds a bug or two one day, if we accidentally write to a
serialization that is complete.

10 months agomemfd-util: introduce memfd_new_full() helper
Lennart Poettering [Mon, 16 Dec 2024 10:28:46 +0000 (11:28 +0100)] 
memfd-util: introduce memfd_new_full() helper

This is just like memfd_new(), but allows fine grained control of the
sealing flags.

This switches over all uses of memfd_new() where we actually want
sealing to use memfd_new_full().

This then allows use to use memfd_new() for two further calls, where we
previously used the more lowlevel memfd_create_wrapper().

10 months agomemfd-util: explain what memfd_create_wrapper() is for in a comment
Lennart Poettering [Mon, 16 Dec 2024 10:27:58 +0000 (11:27 +0100)] 
memfd-util: explain what memfd_create_wrapper() is for in a comment

10 months agomemfd-util: use TASK_COMM_LEN at one more place
Lennart Poettering [Mon, 16 Dec 2024 10:04:03 +0000 (11:04 +0100)] 
memfd-util: use TASK_COMM_LEN at one more place

Note this corrects the size of the array from 17 to 16, as the 16
already includes space for a trailing NUL.

10 months agosd-journal: drop memfd fallback
Lennart Poettering [Fri, 13 Dec 2024 18:05:41 +0000 (19:05 +0100)] 
sd-journal: drop memfd fallback

10 months agoserialize: drop memfd fallback when serializing
Lennart Poettering [Fri, 13 Dec 2024 17:59:15 +0000 (18:59 +0100)] 
serialize: drop memfd fallback when serializing

10 months agomemfd-util: short memfd_clone_fd()
Lennart Poettering [Fri, 13 Dec 2024 17:55:59 +0000 (18:55 +0100)] 
memfd-util: short memfd_clone_fd()

10 months agomemfd-util: simplify memfd_new_and_seal()
Lennart Poettering [Fri, 13 Dec 2024 17:55:00 +0000 (18:55 +0100)] 
memfd-util: simplify memfd_new_and_seal()

Let's use pwrite() to write the contents of the memfd. This has the
benefit of not moving the file offset, which means we don't have to
reset it after at all.

10 months agotree-wide: drop acquire_data_fd_full() helper
Lennart Poettering [Fri, 13 Dec 2024 17:51:34 +0000 (18:51 +0100)] 
tree-wide: drop acquire_data_fd_full() helper

Let's drop support systems lacking memfds, i.e. pre kernel 3.17 systems.
This allows us to drastically simplify the "data fd" concept, so far
that we can remove it entirely.

This replaces acquire_data_fd() with a specialized call to
memfd_new_and_seal(), not that memfds can be the only implementation of
the concept.

10 months agopam_systemd: introduce pam_get_data_many() helper and make use of it 35178/head
Lennart Poettering [Fri, 15 Nov 2024 14:23:41 +0000 (15:23 +0100)] 
pam_systemd: introduce pam_get_data_many() helper and make use of it

This is to pam_get_data() what pam_get_item() is to pam_get_item_many().

10 months agopam_systemd: fix error code confusion when prepping D-Bus message
Lennart Poettering [Fri, 15 Nov 2024 14:03:51 +0000 (15:03 +0100)] 
pam_systemd: fix error code confusion when prepping D-Bus message

We got confused by the error codes here, and sometimes return PAM errors
where the caller propagated them unconverted as negative errno errors. Fix that.