]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
10 months agoRevert "semaphore: skip some tests" 35610/head
Luca Boccassi [Fri, 13 Dec 2024 23:43:28 +0000 (23:43 +0000)] 
Revert "semaphore: skip some tests"

This reverts commit e19cae12ff2e832ce7d79aa483e1aa27ed0ea1f4.

10 months agosemaphore: bump timeout
Luca Boccassi [Fri, 13 Dec 2024 22:08:27 +0000 (22:08 +0000)] 
semaphore: bump timeout

When semaphore is overloaded tests can take more than 1hr, bump
timeout

10 months agorepart: Take configured minimum and maximum size into account for Minimize=
Daan De Meyer [Sat, 23 Nov 2024 10:36:54 +0000 (11:36 +0100)] 
repart: Take configured minimum and maximum size into account for Minimize=

- Let's check if the minimum size we got is larger than the configured
maximum partition size and fail early if it is.
- Let's make sure for writable filesystems that we make the minimal
filesystem at least as large as the minimum partition size, to allow
creating minimal filesystems with a minimum size.

10 months agoRevert "repart: Drop unprivileged subvolumes logic for btrfs"
Daan De Meyer [Wed, 18 Sep 2024 14:42:12 +0000 (16:42 +0200)] 
Revert "repart: Drop unprivileged subvolumes logic for btrfs"

This adds back support for unprivileged btrfs subvolumes which
can be merged once btrfs-progs 6.12 is out.

This reverts commit 4d9ccdc9aec5728a6bfc66879420b2af25817e03.

10 months agocore: Bind mount notify socket to /run/host/notify in sandboxed units (#35573)
Daan De Meyer [Fri, 13 Dec 2024 13:48:07 +0000 (13:48 +0000)] 
core: Bind mount notify socket to /run/host/notify in sandboxed units (#35573)

To be able to run systemd in a Type=notify transient unit, the notify
socket can't be bind mounted to /run/systemd/notify as systemd in the
transient unit wants to use that as its own notify socket which
conflicts with systemd on the host.

Instead, for sandboxed units, let's bind mount the notify socket to
/run/host/notify as documented in the container interface. Since we
don't guarantee a stable location for the notify socket and insist users
use $NOTIFY_SOCKET to get its path, this is safe to do.

10 months agojournalctl: make --setup-keys honor --output=json and --quiet (#35507)
Luca Boccassi [Fri, 13 Dec 2024 13:40:09 +0000 (13:40 +0000)] 
journalctl: make --setup-keys honor --output=json and --quiet (#35507)

Closes #35503.
Closes #35504.

10 months agocore: Bind mount notify socket to /run/host/notify in sandboxed units 35573/head
Daan De Meyer [Wed, 11 Dec 2024 18:45:28 +0000 (18:45 +0000)] 
core: Bind mount notify socket to /run/host/notify in sandboxed units

To be able to run systemd in a Type=notify transient unit, the notify
socket can't be bind mounted to /run/systemd/notify as systemd in the
transient unit wants to use that as its own notify socket which conflicts
with systemd on the host.

Instead, for sandboxed units, let's bind mount the notify socket to
/run/host/notify as documented in the container interface. Since we don't
guarantee a stable location for the notify socket and insist users use
$NOTIFY_SOCKET to get its path, this is safe to do.

10 months agocore/namespace: several fixes for recently merged PRs (#35580)
Daan De Meyer [Fri, 13 Dec 2024 12:34:11 +0000 (12:34 +0000)] 
core/namespace: several fixes for recently merged PRs (#35580)

Fixes #35546.
Fixes #35566.

10 months agohwdb: move down touchpad toggle section from generic to product specific
Soumyadeep Ghosh [Thu, 12 Dec 2024 13:20:33 +0000 (18:50 +0530)] 
hwdb: move down touchpad toggle section from generic to product specific

adding `KEYBOARD_KEY_76` in generic section is causing a regression
in MSI GF63. Moving this down fixes.
This commit also adds a probable KEY Code for MSI GF63 touchpad toggling

10 months agocore: Add PrivateUsers=full (#35183)
Luca Boccassi [Fri, 13 Dec 2024 12:25:13 +0000 (12:25 +0000)] 
core: Add PrivateUsers=full (#35183)

Recently, PrivateUsers=identity was added to support mapping the first
65536 UIDs/GIDs from parent to the child namespace and mapping the other
UID/GIDs to the nobody user.

However, there are use cases where users have UIDs/GIDs > 65536 and need
to do a similar identity mapping. Moreover, in some of those cases,
users want a full identity mapping from 0 -> UID_MAX.

To support this, we add PrivateUsers=full that does identity mapping for
all available UID/GIDs.

Note to differentiate ourselves from the init user namespace, we need to
set up the uid_map/gid_map like:
```
0 0 1
1 1 UINT32_MAX - 1
```

as the init user namedspace uses `0 0 UINT32_MAX` and some applications
- like systemd itself - determine if its a non-init user namespace based
on uid_map/gid_map files.

Note systemd will remove this heuristic in running_in_userns() in
version 258 (https://github.com/systemd/systemd/pull/35382) and uses
namespace inode. But some users may be running a container image with
older systemd < 258 so we keep this hack until version 259 for version
N-1 compatibility.

In addition to mapping the whole UID/GID space, we also set
/proc/pid/setgroups to "allow". While we usually set "deny" to avoid
security issues with dropping supplementary groups
(https://lwn.net/Articles/626665/), this ends up breaking dbus-broker
when running /sbin/init in full OS containers.

Fixes: #35168
Fixes: #35425
10 months agologind: let system-wide idle begin at the time logind was initialized
Florian Schmaus [Sat, 16 Nov 2024 09:29:35 +0000 (10:29 +0100)] 
logind: let system-wide idle begin at the time logind was initialized

Initialize the start of the system-wide idle time with the time logind was
initialized and not with the start of the Unix epoch. This means that systemd
will not repport a unreasonable long idle time (around 54 years at the time of
writing this), especially at in the early boot, while no login manager session,
e.g,. gdm, had a chance to provide a more accurate start of the idle period.

Fixes #35163

10 months agoCouple small cleanups (#35593)
Mike Yuan [Fri, 13 Dec 2024 12:01:27 +0000 (13:01 +0100)] 
Couple small cleanups (#35593)

10 months agobasic/fileio: two modernizations (#35559)
Daan De Meyer [Fri, 13 Dec 2024 11:49:12 +0000 (11:49 +0000)] 
basic/fileio: two modernizations (#35559)

10 months agoshell-completion: add smbios11 verb to systemd-analyze
Luca Boccassi [Thu, 12 Dec 2024 12:41:45 +0000 (12:41 +0000)] 
shell-completion: add smbios11 verb to systemd-analyze

Follow-up for 8c5045f9b2681774e8731dc0d142c207b61aedf6

10 months agomkosi: update debian commit reference
Luca Boccassi [Thu, 12 Dec 2024 16:46:11 +0000 (16:46 +0000)] 
mkosi: update debian commit reference

e8b7c9a4dd Install 81-net-bridge.rules
50d2997a07 Install systemd-creds bash completion
ff0c42823c test: fix flaky boot-and-services test
2a19dee4ba test: fix flaky boot-and-services test
a15a0bfe60 Update changelog for 257-2 release
c24eafcb7e Backport patches to fix test failures
29840f9b68 udev: install dmi_memory_id and its rules on riscv64
44893bdb32 Update changelog for 257-1 release
7f71d995fb Update symbols file for v257
2dd2b80499 Update upstream source from tag 'upstream/257'
51a3271a85 Update changelog for 257~rc3-1 release
8e687227c5 Update symbols for 257~rc3
c9bae527d6 Drop patches, merged upstream
e8cf329870 Update upstream source from tag 'upstream/257_rc3'
794457516d autopkgtest: fix one more tzdata dependency
16bb143da1 Bump version in tzdata dependency due to p-u upload
f2ddf70604 sysctl: Add file trigger on /usr/lib/sysctl.d to restart systemd-sysctl
79260cb0f4 Increase minimum sections in stub PE header on arm64/armhf/riscv64 to 500
ed3af24635 systemd-ukfy: recommend systemd-boot-efi for the stub

10 months agocore/mount: don't keep cred mounts around after mounted
Mike Yuan [Thu, 12 Dec 2024 21:03:25 +0000 (22:03 +0100)] 
core/mount: don't keep cred mounts around after mounted

Follow-up for 6577cf1ba96027053cedce97ebb22d4ea96887bd

10 months agotest-loop-block: return -77 on skip in more places 35593/head
Luca Boccassi [Wed, 13 Nov 2024 14:20:34 +0000 (14:20 +0000)] 
test-loop-block: return -77 on skip in more places

10 months agobattery-check: parse options before checking for kernel command line
Luca Boccassi [Fri, 8 Nov 2024 12:23:37 +0000 (12:23 +0000)] 
battery-check: parse options before checking for kernel command line

Otherwise --help/--version/etc which exit immediately will do pointless work

10 months agounits: use PrivateTmp=disconnected instead of 'yes' if DefaultDependencies=no
Luca Boccassi [Thu, 12 Dec 2024 11:48:52 +0000 (11:48 +0000)] 
units: use PrivateTmp=disconnected instead of 'yes' if DefaultDependencies=no

Avoids subtle race conditions such as the one described at
#35582.

Fixes #35582

10 months agocore: fix loading verity settings for MountImages= (#35577)
Luca Boccassi [Thu, 12 Dec 2024 13:06:07 +0000 (13:06 +0000)] 
core: fix loading verity settings for MountImages= (#35577)

The MountEntry logic was refactored to store the verity
settings, and updated for ExtensionImages=, but not for
MountImages=.

Follow-up for a1a40297dbfa5bcd926d1a19320deb73c033c6f5

10 months agonetwork: several cleanups (#35267)
Luca Boccassi [Thu, 12 Dec 2024 12:47:23 +0000 (12:47 +0000)] 
network: several cleanups (#35267)

10 months agomkosi: Fix opensuse build
Daan De Meyer [Thu, 12 Dec 2024 11:58:42 +0000 (11:58 +0000)] 
mkosi: Fix opensuse build

The opensuse spec still looks for README.testsuite so hack it to look
for README.md instead now that we changed the name in the repo.

10 months agocore: Set /proc/pid/setgroups to allow for PrivateUsers=full 35183/head
Ryan Wilson [Sat, 30 Nov 2024 22:14:35 +0000 (14:14 -0800)] 
core: Set /proc/pid/setgroups to allow for PrivateUsers=full

When trying to run dbus-broker in a systemd unit with PrivateUsers=full,
we see dbus-broker fails with EPERM at `util_audit_drop_permissions`.

The root cause is dbus-broker calls the setgroups() system call and this
is disallowed via systemd's implementation of PrivateUsers= by setting
/proc/pid/setgroups = deny. This is done to remediate potential privilege
escalation vulnerabilities in user namespaces where an attacker can remove
supplementary groups and gain access to resources where those groups are
restricted.

However, for OS-like containers, setgroups() is a pretty common API and
disabling it is not feasible. So we allow setgroups() by setting
/proc/pid/setgroups to allow in PrivateUsers=full. Note security conscious
users can still use SystemCallFilter= to disable setgroups() if they want
to specifically prevent this system call.

Fixes: #35425
10 months agogpt-auto: take timeout opts in rootflags= into account; hibernate-resume: always...
Luca Boccassi [Thu, 12 Dec 2024 11:01:40 +0000 (11:01 +0000)] 
gpt-auto: take timeout opts in rootflags= into account; hibernate-resume: always respect user-defined timeout (#35518)

10 months agoExport two more functions, and update symbol tests (#35578)
Luca Boccassi [Thu, 12 Dec 2024 10:39:29 +0000 (10:39 +0000)] 
Export two more functions, and update symbol tests (#35578)

Prompted by #35554.
Continuation of #35555.

10 months agomkosi: wrap unshare command when running with sanitizers 35580/head
Yu Watanabe [Thu, 12 Dec 2024 06:14:32 +0000 (15:14 +0900)] 
mkosi: wrap unshare command when running with sanitizers

Follow-up for 219a6dbbf3ad0121ec43118d4fcdb7b375532cbe.
Fixes #35546.

10 months agocore/namespace: use ProtectHostname in NamespaceParameters
Yu Watanabe [Thu, 12 Dec 2024 04:00:41 +0000 (13:00 +0900)] 
core/namespace: use ProtectHostname in NamespaceParameters

To make the type of NamespaceParameters.protect_hostname consistent
with the one in ExecContext.

Addresses https://github.com/systemd/systemd/pull/35447#discussion_r1880372452.
Fixes #35566.

10 months agocreds: introduce --transcode=help and friends and use them in shell completion (...
Daan De Meyer [Thu, 12 Dec 2024 09:33:44 +0000 (09:33 +0000)] 
creds: introduce --transcode=help and friends and use them in shell completion (#35579)

Follow-ups for 783f794e89996ae7f2ae1872d65c515a672437fa (#35537).

10 months agobash-completion/creds: generate suggestions by systemd-creds itself 35579/head
Yu Watanabe [Thu, 12 Dec 2024 02:51:36 +0000 (11:51 +0900)] 
bash-completion/creds: generate suggestions by systemd-creds itself

Follow-ups for 783f794e89996ae7f2ae1872d65c515a672437fa.

10 months agocreds: support --transcode=help and --with-key=help
Yu Watanabe [Thu, 12 Dec 2024 02:37:36 +0000 (11:37 +0900)] 
creds: support --transcode=help and --with-key=help

10 months agostring-table: make DUMP_STRING_TABLE() returns 0
Yu Watanabe [Thu, 12 Dec 2024 02:31:16 +0000 (11:31 +0900)] 
string-table: make DUMP_STRING_TABLE() returns 0

Then, we can use it as
===
  return DUMP_STRING_TABLE(...);
===

10 months agotpm2-util: allow to control if legend and/or footer shown by tpm2_list_devices()
Yu Watanabe [Thu, 12 Dec 2024 02:01:00 +0000 (11:01 +0900)] 
tpm2-util: allow to control if legend and/or footer shown by tpm2_list_devices()

10 months agoci: enable linter for generate-sym-test.py 35578/head
Yu Watanabe [Thu, 12 Dec 2024 01:27:15 +0000 (10:27 +0900)] 
ci: enable linter for generate-sym-test.py

10 months agotest: also generate list of symbols from header files
Yu Watanabe [Thu, 12 Dec 2024 04:18:59 +0000 (13:18 +0900)] 
test: also generate list of symbols from header files

To make the generated tests able to detect issues like #35554.

10 months agotest: modernize generate-sym-test.py
Yu Watanabe [Thu, 12 Dec 2024 01:01:48 +0000 (10:01 +0900)] 
test: modernize generate-sym-test.py

10 months agosd-json: properly export sd_json_variant_type_from_string() and _to_string()
Yu Watanabe [Thu, 12 Dec 2024 01:09:52 +0000 (10:09 +0900)] 
sd-json: properly export sd_json_variant_type_from_string() and _to_string()

These exist in the header file, but were not exporeted.

Continuation of e11f5aa7226253bf31b2ed61be8599bb213c1819.

10 months agotest: rename README.testsuite -> README.md
Yu Watanabe [Thu, 12 Dec 2024 03:02:19 +0000 (12:02 +0900)] 
test: rename README.testsuite -> README.md

10 months agoREADME: drop CentOS CI badges
Yu Watanabe [Thu, 12 Dec 2024 02:58:24 +0000 (11:58 +0900)] 
README: drop CentOS CI badges

CentOS CIs are disabled after ead814a0b0f64c572282b9e27a0a995893f10cf0.

10 months agopolkit-agent: allow to invoke polkit agent even if STDIN is not a tty (#35431)
Yu Watanabe [Thu, 12 Dec 2024 01:32:02 +0000 (10:32 +0900)] 
polkit-agent: allow to invoke polkit agent even if STDIN is not a tty (#35431)

Closes #35018.

10 months agotest: add more coverage for extensions and verity 35577/head
Luca Boccassi [Thu, 12 Dec 2024 00:50:45 +0000 (00:50 +0000)] 
test: add more coverage for extensions and verity

10 months agocore: fix loading verity settings for MountImages=
Luca Boccassi [Thu, 12 Dec 2024 00:24:05 +0000 (00:24 +0000)] 
core: fix loading verity settings for MountImages=

The MountEntry logic was refactored to store the verity
settings, and updated for ExtensionImages=, but not for
MountImages=.

Follow-up for a1a40297dbfa5bcd926d1a19320deb73c033c6f5

10 months agoshell completion: add systemd-creds
Luca Boccassi [Tue, 10 Dec 2024 22:19:09 +0000 (22:19 +0000)] 
shell completion: add systemd-creds

10 months agosemaphore: skip some tests
Luca Boccassi [Wed, 11 Dec 2024 20:44:25 +0000 (20:44 +0000)] 
semaphore: skip some tests

semaphore CI runs are always very close to the limit of 1hr, and often
time out when it's particularly oversubscribed.
Skip some low-value test cases to shorten the runtime.

10 months agoexec-util: use strv_from_stdarg_alloca() 35431/head
Yu Watanabe [Sun, 1 Dec 2024 08:43:31 +0000 (17:43 +0900)] 
exec-util: use strv_from_stdarg_alloca()

No functional change, just refactoring.

10 months agoexec-util: use open_terminal() in fork_agent() for safety
Yu Watanabe [Tue, 3 Dec 2024 09:58:11 +0000 (18:58 +0900)] 
exec-util: use open_terminal() in fork_agent() for safety

10 months agoexec-util: drop handling of ENXIO in opening /dev/tty
Yu Watanabe [Tue, 3 Dec 2024 09:50:25 +0000 (18:50 +0900)] 
exec-util: drop handling of ENXIO in opening /dev/tty

This effectively reverts 0bcf1679007e71d1d37666c10ab1f8d46de8d570.

The handling is not necessary anymore after 61242b1f0f9cac399deb67c88c3b62d38218dba3.

10 months agoexec-util: split out common checks before fork_agent() to can_fork_agent()
Yu Watanabe [Tue, 3 Dec 2024 09:40:06 +0000 (18:40 +0900)] 
exec-util: split out common checks before fork_agent() to can_fork_agent()

No functional change, just refactoring.

10 months agopolkit-agent: modernize code a bit
Yu Watanabe [Tue, 3 Dec 2024 09:36:15 +0000 (18:36 +0900)] 
polkit-agent: modernize code a bit

- Use _cleanup_close_pair_ attribute for the pipe FDs,
- Return earlier on failure in forking polkit agent.

10 months agoexec-util: allow to invoke polkit/ask-password agent even if STDIN is not a tty
Yu Watanabe [Sun, 1 Dec 2024 08:36:33 +0000 (17:36 +0900)] 
exec-util: allow to invoke polkit/ask-password agent even if STDIN is not a tty

Closes #35018.

10 months agosystemd-cryptenroll.xml: fix typo
Carlo Teubner [Wed, 11 Dec 2024 22:40:07 +0000 (22:40 +0000)] 
systemd-cryptenroll.xml: fix typo

10 months agoformat-table: trivial cleanups (#35572)
Yu Watanabe [Wed, 11 Dec 2024 21:12:07 +0000 (06:12 +0900)] 
format-table: trivial cleanups (#35572)

10 months agoman: update example in systemd-measure.xml (#35506)
cvlc12 [Wed, 11 Dec 2024 21:09:11 +0000 (22:09 +0100)] 
man: update example in systemd-measure.xml (#35506)

In the example from systemd-measure(1), do not bind to PCR 7 in
addition to the PCR policy.

As long as this is still done by default, see #35280.

10 months agoRevert "run: disable --expand-environment by default for --scope"
Mike Yuan [Wed, 10 Jul 2024 19:58:12 +0000 (21:58 +0200)] 
Revert "run: disable --expand-environment by default for --scope"

This reverts commit 8167c56bfa97525a7b12e7c5685576657364e3cf.

We've announced the breaking change during v254-v257. Let's actually
apply it for v258.

10 months agopretty-print: don't use OSC 8 for incompatible URLs (#35223)
Yu Watanabe [Wed, 11 Dec 2024 20:43:36 +0000 (05:43 +0900)] 
pretty-print: don't use OSC 8 for incompatible URLs (#35223)

10 months agocgroup-util: introduce cg_get_cgroupid_at()
Mike Yuan [Fri, 29 Nov 2024 12:43:02 +0000 (13:43 +0100)] 
cgroup-util: introduce cg_get_cgroupid_at()

Suggested in https://github.com/systemd/systemd/pull/35242#discussion_r1862658163

10 months agonsresourced: drop unneeded REMOVE_PHYSICAL flag for rm_rf()
Mike Yuan [Wed, 11 Dec 2024 14:00:03 +0000 (15:00 +0100)] 
nsresourced: drop unneeded REMOVE_PHYSICAL flag for rm_rf()

Even without REMOVE_PHYSICAL, rm_rf() permits cgroupfs.

10 months agoprocess-util: modernize is_main_thread(); make sure get_process_ppid() won't return...
Yu Watanabe [Wed, 11 Dec 2024 20:16:04 +0000 (05:16 +0900)] 
process-util: modernize is_main_thread(); make sure get_process_ppid() won't return ppid == 0 (#35561)

Split out from #35242

10 months agosd-varlink: properly export sd_varlink_reset_fds()
Lennart Poettering [Wed, 11 Dec 2024 12:06:03 +0000 (13:06 +0100)] 
sd-varlink: properly export sd_varlink_reset_fds()

This function was listed in the public sd-varlink.h header, but not
actually made public. Fix that. It's quite useful, the comment in it
describes the usecase nicely.

Fixes: #35554
10 months agolibfido2-util: show also verity features when listing FIDO2 devices (#35295)
Yu Watanabe [Wed, 11 Dec 2024 20:11:46 +0000 (05:11 +0900)] 
libfido2-util: show also verity features when listing FIDO2 devices (#35295)

This way, users don't have to check those features using an external
program, or wait for later failure when trying to enroll using an
unsupported feature.

E.g.:

```
# systemd-cryptenroll --fido2-device list
PATH         MANUFACTURER PRODUCT               RK  CLIENTPIN UP  UV
/dev/hidraw2 Yubico       YubiKey OTP+FIDO+CCID yes no        yes no
```

10 months agoAdd credential support for mount units (#34732)
Yu Watanabe [Wed, 11 Dec 2024 20:07:35 +0000 (05:07 +0900)] 
Add credential support for mount units (#34732)

Add `EXEC_SETUP_CREDENTIALS` flag to allow using credentials with mount units.
Fixes: #23535
10 months agotest-bpf-restrict-fs: Migrate to new assertion macros
Daan De Meyer [Wed, 11 Dec 2024 12:44:26 +0000 (12:44 +0000)] 
test-bpf-restrict-fs: Migrate to new assertion macros

10 months agocondition: add new ConditionKernelModuleLoaded=
Lennart Poettering [Thu, 28 Nov 2024 12:00:34 +0000 (13:00 +0100)] 
condition: add new ConditionKernelModuleLoaded=

This introduces a new unit condition check: that matches if a specific
kmod module is allowed. This should be generally useful, but there's one
usecase in particular: we can optimize modprobe@.service with this and
avoid forking out a bunch of modprobe requests during boot for the same
kmods.

Checking if a kernel module is loaded is more complicated than just
checking if /sys/module/$MODULE/ exists, since kernel modules typically
take a while to initialize and we must check that this is complete (by
checking if the sysfs attr "initstate" is "live").

10 months agojournalctl: also mangle unit name when --invocation= or --list-invocations is specifi...
Yu Watanabe [Wed, 11 Dec 2024 20:01:54 +0000 (05:01 +0900)] 
journalctl: also mangle unit name when --invocation= or --list-invocations is specified (#35542)

Fixes #35538.

10 months agonamespace: Rename notify_socket to host_notify_socket
Daan De Meyer [Wed, 11 Dec 2024 19:08:38 +0000 (19:08 +0000)] 
namespace: Rename notify_socket to host_notify_socket

Preparation for next commit.

10 months agoFixing VLAN ranges in man systemd.network.
andrejpodzimek [Wed, 11 Dec 2024 12:46:43 +0000 (12:46 +0000)] 
Fixing VLAN ranges in man systemd.network.

Otherwise it doesn't hold that VLANs 100-400 are allowed (because 201-299 are disallowed).

10 months agoprofile.d: don't bail if $SHELL_* variables are unset
Tobias Klauser [Wed, 11 Dec 2024 14:10:39 +0000 (15:10 +0100)] 
profile.d: don't bail if $SHELL_* variables are unset

If - for whatever reason - a script uses set -u (nounset) and includes
/etc/profile.d/70-systemd-shell-extra.sh (e.g. transitively via
/etc/profile) the script would fail with:

    /etc/profile.d/70-systemd-shell-extra.sh: line 15: SHELL_PROMPT_PREFIX: unbound variable

For example:

    $ cat > foo.sh <<EOF
    #!/bin/sh
    set -u

    source /etc/profile
    EOF
    $ chmod 700 foo.sh
    $ ./foo.sh
    /etc/profile.d/70-systemd-shell-extra.sh: line 15: SHELL_PROMPT_PREFIX: unbound variable

Fix this by using shell parameter substitution[^1] (which is a POSIX
shell concept) to set the $SHELL_* variables to the empty string if
undefined.

[^1]: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/V3_chap02.html

10 months agovirt: drop userns detection heuristic
Lennart Poettering [Wed, 27 Nov 2024 13:54:36 +0000 (14:54 +0100)] 
virt: drop userns detection heuristic

Now that we have an explicit userns check we can drop the heuristic for
it, given that it's kinda wrong (because mapping the full host UID range
into a userns is actually a thing people do).

Hence, just delete the code and only keep the userns inode check in
place.

10 months agovirt: dont check for cgroupns anymore
Lennart Poettering [Wed, 27 Nov 2024 13:50:01 +0000 (14:50 +0100)] 
virt: dont check for cgroupns anymore

Now that we have a reliable pidns check I don't think we really should
look for cgroupns anymore, it's too weak a check. I mean, if I myself
would implement a desktop app sandbox (like flatpak) I'd always enable
cgroupns, simply to hide the host cgroup hierarchy.

Hence drop the check.

I suggested adding this 4 years ago here:

https://github.com/systemd/systemd/pull/17902#issuecomment-745548306

10 months agouserdbctl: use ansi_highlight_green_red() where appropriate 35572/head
Mike Yuan [Tue, 10 Dec 2024 18:24:05 +0000 (19:24 +0100)] 
userdbctl: use ansi_highlight_green_red() where appropriate

10 months agoformat-table: drop pointless table_data_rgap_color() func
Mike Yuan [Wed, 11 Dec 2024 18:18:32 +0000 (19:18 +0100)] 
format-table: drop pointless table_data_rgap_color() func

Follow-up for aab79f52784b4778ae0534452757d9fbf608076a

10 months agoformat-table: minor modernization
Mike Yuan [Tue, 10 Dec 2024 17:50:30 +0000 (18:50 +0100)] 
format-table: minor modernization

10 months agobasic/fileio: clean up executable_is_script() a bit 35559/head
Mike Yuan [Tue, 10 Dec 2024 15:14:34 +0000 (16:14 +0100)] 
basic/fileio: clean up executable_is_script() a bit

- Rename to script_get_shebang_interpreter and return
  -EMEDIUMTYPE if the executable is not a script.
  We nowadays utilize the scheme of making ret param
  of getters optional, and use them directly as checkers.
- Don't unnecessarily read the whole line, but check
  only the shebang first.

10 months agobasic/fileio: minor modernization for xopendirat()
Mike Yuan [Tue, 10 Dec 2024 14:51:24 +0000 (15:51 +0100)] 
basic/fileio: minor modernization for xopendirat()

10 months agoman: document unprivileged is not for reading properties
Katariina Lounento [Mon, 9 Dec 2024 14:09:13 +0000 (16:09 +0200)] 
man: document unprivileged is not for reading properties

Document the fact that read-only properties may not have the flag
SD_BUS_VTABLE_UNPRIVILEGED as that is not obvious especially given the
flag is accepted for writable properties.

Based on the check in `add_object_vtable_internal` called by
`sd_bus_add_object_vtable` (as of the current tip of the main branch
f7f5ba019206cacd486b0892fec76f70f525e04d):

    case _SD_BUS_VTABLE_PROPERTY: {
            [...]
            if ([...] ||
                [...]
                (v->flags & SD_BUS_VTABLE_UNPRIVILEGED && v->type == _SD_BUS_VTABLE_PROPERTY)) {
                    r = -EINVAL;
                    goto fail;
            }

(where `_SD_BUS_VTABLE_PROPERTY` means read-only property whereas
`_SD_BUS_VTABLE_WRITABLE_PROPERTY` maps to writable property).

This was implemented in the commit
adacb9575a09981fcf11279f2f661e3fc21e58ff ("bus: introduce "trusted" bus
concept and encode access control in object vtables") where
`SD_BUS_VTABLE_UNPRIVILEGED` was introduced:

    Writable properties are also subject to SD_BUS_VTABLE_UNPRIVILEGED
    and SD_BUS_VTABLE_CAPABILITY() for controlling write access to them.
    Note however that read access is unrestricted, as PropertiesChanged
    messages might send out the values anyway as an unrestricted
    broadcast.

10 months agojournalctl: make --invocation and --list-invocations accept unit name with glob 35542/head
Yu Watanabe [Wed, 11 Dec 2024 00:35:32 +0000 (09:35 +0900)] 
journalctl: make --invocation and --list-invocations accept unit name with glob

Previously, journalctl -I -u GLOB was not supported, while
journalctl -u GLOB works fine. Let's make them consistent.

10 months agojournalctl: move get_possible_units() to journalctl-util.c
Yu Watanabe [Wed, 11 Dec 2024 00:04:06 +0000 (09:04 +0900)] 
journalctl: move get_possible_units() to journalctl-util.c

No functional change. Preparation for the next commit.

10 months agojournalctl: make --invocation and --list-invocations accept unit name without suffix
Yu Watanabe [Wed, 11 Dec 2024 00:05:34 +0000 (09:05 +0900)] 
journalctl: make --invocation and --list-invocations accept unit name without suffix

Fixes #35538.

10 months agolibfido2-util: show also verity features when listing FIDO2 devices 35295/head
Antonio Alvarez Feijoo [Wed, 11 Dec 2024 16:28:30 +0000 (17:28 +0100)] 
libfido2-util: show also verity features when listing FIDO2 devices

This way, users don't have to check those features using an external program, or
wait for later failure when trying to enroll using an unsupported feature.

10 months agoFix unit tests in unprivileged docker container (#35556)
Luca Boccassi [Wed, 11 Dec 2024 16:28:30 +0000 (16:28 +0000)] 
Fix unit tests in unprivileged docker container (#35556)

10 months agomkosi: use inetutils package instead of hostname for Archlinux
Luca Boccassi [Wed, 11 Dec 2024 11:48:09 +0000 (11:48 +0000)] 
mkosi: use inetutils package instead of hostname for Archlinux

In Arch the hostname binary is in a different package

Follow-up for cf48bde7aea52b18ac3fa218d3f60fd3d533ef66

10 months agomailmap: fix entries for Tobias Klauser
Tobias Klauser [Wed, 11 Dec 2024 13:50:16 +0000 (14:50 +0100)] 
mailmap: fix entries for Tobias Klauser

Map all previous, no longer used e-mail addresses to my current e-mail
address.

10 months agoanalyze: add --mask to --help text (#35548)
Luca Boccassi [Wed, 11 Dec 2024 13:45:30 +0000 (13:45 +0000)] 
analyze: add --mask to --help text (#35548)

10 months agoprocess-util: make sure we don't report ppid == 0 35561/head
Mike Yuan [Wed, 27 Nov 2024 23:40:11 +0000 (00:40 +0100)] 
process-util: make sure we don't report ppid == 0

Previously, if pid == 0 and we're PID 1, get_process_ppid()
would set ret to getppid(), i.e. 0, which is inconsistent
when pid is explicitly set to 1. Ensure we always handle
such case by returning -EADDRNOTAVAIL.

10 months agoprocess-util: use our usual tristate semantics for is_main_thread()
Mike Yuan [Wed, 20 Nov 2024 14:12:25 +0000 (15:12 +0100)] 
process-util: use our usual tristate semantics for is_main_thread()

While at it, _unlikely_ is dropped, as requested in
https://github.com/systemd/systemd/pull/35242#discussion_r1880096233

10 months agotest-fd-util: compare FDs to /bin/sh instead of /dev/null 35556/head
Luca Boccassi [Wed, 11 Dec 2024 13:40:10 +0000 (13:40 +0000)] 
test-fd-util: compare FDs to /bin/sh instead of /dev/null

/dev/null is a character device, so same_fd() in the fallback path
that compares fstat will fail, as that bails out if the fd refers
to a char device. This happens on kernels without F_DUPFD_QUERY and
without kcmp.

/* test_same_fd */
Assertion 'same_fd(d, e) > 0' failed at src/test/test-fd-util.c:111, function test_same_fd(). Aborting.

Fixes #35552

10 months agotest-fd-util: skip test when lacking privileges to create a new namespace
Luca Boccassi [Wed, 11 Dec 2024 12:01:18 +0000 (12:01 +0000)] 
test-fd-util: skip test when lacking privileges to create a new namespace

To reproduce, as an unprivileged user start a docker container and build
and run the unit tests inside it:

$ docker run --rm -ti debian:bookworm bash
...
/* test_close_all_fds */
Successfully forked off '(caf-plain)' as PID 10496.
Skipping PR_SET_MM, as we don't have privileges.
(caf-plain) succeeded.
Failed to fork off '(caf-noproc)': Operation not permitted
Assertion 'r >= 0' failed at src/test/test-fd-util.c:392, function test_close_all_fds(). Aborting.

Partially fixes #35552

10 months agotest-capability: CAP_LINUX_IMMUTABLE is not available in unprivileged containers
Luca Boccassi [Wed, 11 Dec 2024 12:10:13 +0000 (12:10 +0000)] 
test-capability: CAP_LINUX_IMMUTABLE is not available in unprivileged containers

have ambient caps: yes
Capabilities:cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap=ep
Failed to drop auxiliary groups list: Operation not permitted
Failed to change group ID: Operation not permitted
Capabilities:cap_dac_override,cap_net_raw=ep
Capabilities:cap_dac_override=ep
Successfully forked off '(getambient)' as PID 12505.
Skipping PR_SET_MM, as we don't have privileges.
Ambient capability cap_linux_immutable requested but missing from bounding set, suppressing automatically.
Assertion 'x < 0 || FLAGS_SET(c, UINT64_C(1) << CAP_LINUX_IMMUTABLE)' failed at src/test/test-capability.c:273, function test_capability_get_ambient(). Aborting.
(getambient) terminated by signal ABRT.
src/test/test-capability.c:258: Assertion failed: expected "r" to succeed, but got error: Protocol error

Partially fixes #35552

10 months agoDefine flags for manager_is_inhibited() (#35253)
Luca Boccassi [Wed, 11 Dec 2024 13:08:29 +0000 (13:08 +0000)] 
Define flags for manager_is_inhibited() (#35253)

10 months agotest: set nsec3-salt-length=8 in knot.conf
Nick Rosbrook [Tue, 10 Dec 2024 21:48:59 +0000 (16:48 -0500)] 
test: set nsec3-salt-length=8 in knot.conf

TEST-75-RESOLVED fails on Ubuntu autopkgtest due to this warning from
knot:

 notice: config, policy 'auto_rollover_nsec3' depends on default nsec3-salt-length=8, since version 3.5 the default becomes 0

Explicitly set nsec3-salt-length=8 to silence.

10 months agobasic/user-util: modernize getgroups_alloc() a bit (#35226)
Mike Yuan [Wed, 11 Dec 2024 12:50:50 +0000 (13:50 +0100)] 
basic/user-util: modernize getgroups_alloc() a bit (#35226)

Split out from #35219 for inclusion in v258

10 months agologind: define flags enum for manager_is_inhibited() 35253/head
Zbigniew Jędrzejewski-Szmek [Wed, 20 Nov 2024 12:15:06 +0000 (13:15 +0100)] 
logind: define flags enum for manager_is_inhibited()

The most common case of block=true, ignore_inactive=false is mapped to flags=0.

For https://github.com/systemd/systemd/issues/34091.

10 months agologind: drop one duplicate param in manager_is_inhibited()
Zbigniew Jędrzejewski-Szmek [Wed, 20 Nov 2024 08:38:52 +0000 (09:38 +0100)] 
logind: drop one duplicate param in manager_is_inhibited()

In the review in https://github.com/systemd/systemd/pull/30307#pullrequestreview-2255002732
removal of the excessive boolean parameters was requested. We don't need
a separate boolean param here, since we always pass true with a uid and
false otherwise.

10 months agopretty-print: don't use OSC 8 for incompatible URLs 35223/head
Lennart Poettering [Mon, 18 Nov 2024 11:34:17 +0000 (12:34 +0100)] 
pretty-print: don't use OSC 8 for incompatible URLs

10 months agostring-util: split out EOT check in strip_tab_ansi()
Lennart Poettering [Tue, 19 Nov 2024 09:49:36 +0000 (10:49 +0100)] 
string-util: split out EOT check in strip_tab_ansi()

Let's unify the eot check in one place in order to make things more
readable.

10 months agoanalyze: add missing --mask option to --help text 35548/head
Lennart Poettering [Wed, 11 Dec 2024 09:31:58 +0000 (10:31 +0100)] 
analyze: add missing --mask option to --help text

Follow-up for: 3e7a029c2856e7814b930443cc2d4fb089377592

10 months agoanalyze: tab fix
Lennart Poettering [Wed, 11 Dec 2024 09:31:41 +0000 (10:31 +0100)] 
analyze: tab fix

10 months agonetwork: optionally bring up interface before joining bridge (#34438)
Yu Watanabe [Wed, 11 Dec 2024 09:16:34 +0000 (18:16 +0900)] 
network: optionally bring up interface before joining bridge (#34438)

Closes #34247.

10 months agojournalctl: do not override explicitly specified -b or -n with -e or -k
Yu Watanabe [Wed, 20 Nov 2024 10:28:20 +0000 (19:28 +0900)] 
journalctl: do not override explicitly specified -b or -n with -e or -k

Fixes #35248.

10 months agosystemctl: downgrade log level of ECONNREFUSED from system dbus.service
Yu Watanabe [Fri, 29 Nov 2024 17:56:06 +0000 (02:56 +0900)] 
systemctl: downgrade log level of ECONNREFUSED from system dbus.service

To suppress log message when 'systemctl poweroff' or friends invoked in
rescue shell, which does not have dbus.service.

10 months agolibfido2-util: reorder dl symbols alphabetically
Antonio Alvarez Feijoo [Fri, 22 Nov 2024 08:10:03 +0000 (09:10 +0100)] 
libfido2-util: reorder dl symbols alphabetically