systemd/.git
15 months agotest-dhcp-server: Gracefully handle the network being down
Daan De Meyer [Sun, 18 Aug 2024 22:13:47 +0000 (00:13 +0200)]
test-dhcp-server: Gracefully handle the network being down

(cherry picked from commit 4cf7a676af9a79ff418227d8ff488dfca6f243ab)

15 months agotest: Gracefully handle running within user namespace with single user
Daan De Meyer [Sun, 18 Aug 2024 11:20:14 +0000 (13:20 +0200)]
test: Gracefully handle running within user namespace with single user

Unprivileged users often make themselves root by unsharing a user namespace
and then mapping their current user to root which does not require privileges.
Let's make sure our tests don't fail in such an environment by adding checks
where required to see if we're not running in a user namespace with only a
single user.

(cherry picked from commit ef31767ed7e21672a50b77e7b3935948aaba114c)

15 months agotest-netlink: Gracefully handle the loopback interface being down
Daan De Meyer [Sun, 18 Aug 2024 11:19:30 +0000 (13:19 +0200)]
test-netlink: Gracefully handle the loopback interface being down

(cherry picked from commit d098b8df6e5c1b4c834272dd1397345483116db6)

15 months agomeson: bump version to 256.5 v256.5
Luca Boccassi [Thu, 15 Aug 2024 20:46:49 +0000 (21:46 +0100)]
meson: bump version to 256.5

15 months agoMerge pull request #34003 from bluca/v256-stable
Daan De Meyer [Thu, 15 Aug 2024 20:22:56 +0000 (22:22 +0200)]
Merge pull request #34003 from bluca/v256-stable

v256 batch

15 months agotest: add TEST_SKIP to mkosi integration test wrapper
Luca Boccassi [Wed, 14 Aug 2024 21:49:10 +0000 (22:49 +0100)]
test: add TEST_SKIP to mkosi integration test wrapper

Takes a space-separate list of test names, allows to skip one or more tests

(cherry picked from commit ddc91af4eaa32511f92c83b2c24d9cc0425fd5f5)

15 months agotest: remove temporary directory for test-ukify on success
Yu Watanabe [Thu, 15 Aug 2024 07:14:37 +0000 (16:14 +0900)]
test: remove temporary directory for test-ukify on success

(cherry picked from commit e9a5b4a10eaa10fd43c69d148d57c7f4d8e10a4f)

15 months agotest: remove temporary directory on success
Yu Watanabe [Thu, 15 Aug 2024 06:58:29 +0000 (15:58 +0900)]
test: remove temporary directory on success

Also use mkdtemp_open() with specific template.

Follow-up for e7e52ff9b6d6bbfcdcc298ef3c156420b51d58b8.

(cherry picked from commit 63be834db8fce69536b3ec04f636f1b838dd531a)

15 months agomkosi: Fix debian/not-installed build logic
Daan De Meyer [Wed, 14 Aug 2024 14:51:11 +0000 (16:51 +0200)]
mkosi: Fix debian/not-installed build logic

- Expand globs
- Filter out directories
- Append to the list of packaged files, not the list of installed files

Fixes the issue in https://github.com/systemd/systemd/pull/32363

(cherry picked from commit 0409213cbc1f939b6f2f72deabc4c92a7fe30523)

15 months agoudev: Handle PTP device symlink properly on udev action 'change'
Chengen Du [Mon, 12 Aug 2024 03:41:52 +0000 (11:41 +0800)]
udev: Handle PTP device symlink properly on udev action 'change'

PTP device symlink creation rules are currently executed only when the
udev action is 'add'. If a user reloads the rules and runs the udevadm
trigger command to reapply changes, the symlink may be deleted, which
can prevent the chronyd service from restarting properly.

Signed-off-by: Chengen Du <chengen.du@canonical.com>
(cherry picked from commit 6bd12be3fa7761f190e17efdbdbff4440da7528b)

15 months agorepart: Fix misleading typo in GPT partition flag
Thorsten Scherer [Wed, 14 Aug 2024 20:32:44 +0000 (22:32 +0200)]
repart: Fix misleading typo in GPT partition flag

Bit 60 is the one corresponding to ReadOnly, not 50.  Fix this.

(cherry picked from commit 932cc94436e653d0487c29e0dd44685610cd7bcb)

15 months agotest: Use usual setup in integration-test-setup script
Daan De Meyer [Thu, 8 Aug 2024 20:34:05 +0000 (22:34 +0200)]
test: Use usual setup in integration-test-setup script

(cherry picked from commit db043a9b1a109478581f19b69a3019fc15f672aa)

15 months agotest: Fix section of StateDirectory=
Daan De Meyer [Thu, 8 Aug 2024 19:49:09 +0000 (21:49 +0200)]
test: Fix section of StateDirectory=

(cherry picked from commit dba138b863fadf57362026281d0597b2d7736090)

15 months agomkosi: Install llvm
Daan De Meyer [Thu, 8 Aug 2024 19:48:34 +0000 (21:48 +0200)]
mkosi: Install llvm

For llvm-symbolizer which is required to sanitize address sanitizer
reports.

(cherry picked from commit c022fcd80c5bf94e8ac5511559f085303b24b070)

15 months agomkosi: Disable pagination in gdb
Daan De Meyer [Thu, 8 Aug 2024 08:59:08 +0000 (10:59 +0200)]
mkosi: Disable pagination in gdb

(cherry picked from commit 7628565604f5a6a572cb4a33ccde9a64fcc9ff09)

15 months agoman/systemd-sysusers, man/systemd-tmpfiles: fix sentence fragments
James Muir [Tue, 13 Aug 2024 01:53:24 +0000 (21:53 -0400)]
man/systemd-sysusers, man/systemd-tmpfiles: fix sentence fragments

add "are executed" so that those two sentences have a verb.

(cherry picked from commit c5903cde63bb21a37c3e841c160d1fa060ccf7f2)

15 months agodocs: Mention the new mount API in the container interface doc
Daan De Meyer [Tue, 13 Aug 2024 08:36:40 +0000 (10:36 +0200)]
docs: Mention the new mount API in the container interface doc

Let's mention that the new mount API may be used to establish new
mounts in a container without needing the /run/host/incoming directory.

(cherry picked from commit 74cc5e2041a2c32e1824b32316bd95f2c8a811f5)

15 months agoedit-util: do not try to recreate temp file if missing
Mike Yuan [Sun, 11 Aug 2024 13:41:30 +0000 (15:41 +0200)]
edit-util: do not try to recreate temp file if missing

We initially read from temp file, then strip it, and write
back to it. If the file suddenly disappeared during the process,
it indicates someone else is touching our temp file
behind our back. Let's not silently continue.

(cherry picked from commit 3b5b2ff8fa6413afc2e5a058ea8281a58a4c691d)

15 months agocore/exec-invoke: call setpriority() after sched_setattr()
Ivan Shapovalov [Wed, 7 Aug 2024 08:02:45 +0000 (10:02 +0200)]
core/exec-invoke: call setpriority() after sched_setattr()

The nice value is part of struct sched_attr, and consequently invoking
sched_setattr() after setpriority() would clobber the nice value with
the default (as we are not setting it in struct sched_attr).

It would be best to combine both calls, but for now simply invoke
setpriority() after sched_setattr() to make sure Nice= remains effective
when used together with CPUSchedulingPolicy=.

(cherry picked from commit 711a157738b3dcd29a5ebc8f498eb46bfac59652)

15 months agocore/unit: do not use unit path cache in unit_need_daemon_reload()
Nick Rosbrook [Wed, 7 Aug 2024 22:18:06 +0000 (18:18 -0400)]
core/unit: do not use unit path cache in unit_need_daemon_reload()

When unit_need_daemon_reload() calls unit_find_dropin_paths() to check
for new drop-in configs, the manager's unit path cache is used to limit
which directories are considered. If a new drop-in directory is created,
it may not be in the unit path cache, and hence unit_need_daemon_reload()
may return false, despite a new drop-in being present. However, if a
unit path cache is not given to unit_file_find_dropin_paths() at all,
then it behaves as if the target path was found in the unit path cache.

So, to fix this, adapt unit_find_dropin_paths() to take a boolean
argument indicating whether or not to pass along the unit path cache.
Set this to false in unit_need_daemon_reload().

Fixes #31752

(cherry picked from commit 82c482d573c9d2f3ab36f7be8d32772f90f2c335)

15 months agotest: note in README how to get full list of Ubuntu CI jobs
Luca Boccassi [Thu, 8 Aug 2024 14:13:38 +0000 (15:13 +0100)]
test: note in README how to get full list of Ubuntu CI jobs

(cherry picked from commit 79488ac0038aca5fca5b2938eb645d35015664cf)

15 months agomkosi: Disable debuginfod
Daan De Meyer [Wed, 7 Aug 2024 19:23:37 +0000 (21:23 +0200)]
mkosi: Disable debuginfod

We generally don't care about library debuginfo so let's just disable
debuginfod so it doesn't get in the way when debugging.

We use /root/.gdbinit as the systemwide gdbinit location is distribution
specific.

(cherry picked from commit 2561e2a35601383bfba30da58d378303cb9e39aa)

15 months agomeson: enable -Wunterminated-string-initialization
Yu Watanabe [Wed, 7 Aug 2024 05:03:13 +0000 (14:03 +0900)]
meson: enable -Wunterminated-string-initialization

With af1a6db58fde8f64edcf7d27e1f3b636c999934c, now we can build with the
option.

(cherry picked from commit f548bc4011bcdab008b125b9d0993817efa00718)

15 months agobasic|boot: silence Wunterminated-string-initialization gcc15 warnings
Cristian Rodríguez [Sun, 4 Aug 2024 22:51:54 +0000 (18:51 -0400)]
basic|boot: silence Wunterminated-string-initialization gcc15 warnings

gcc15 has -Wunterminated-string-initialization in -Wextra and
warns about string constants that are not null terminated even though
the functions do do out of bounds access.
Silence the warnings by simply not providing an explicit size.

(cherry picked from commit af1a6db58fde8f64edcf7d27e1f3b636c999934c)

15 months agosysusers: check if requested group name matches user name in queue
Nick Rosbrook [Tue, 6 Aug 2024 00:43:15 +0000 (20:43 -0400)]
sysusers: check if requested group name matches user name in queue

When creating a user, check if the requested group name matches a user
name in the queue. If that matched user name is also going to be a group
name, then use it for the new user too. In other words, allow the
following:

 u foo -
 u bar -:foo

when both foo and bar are new users.

Fixes #33547

(cherry picked from commit 18a8f03e5160ca3828d327d9bbd1b32f26d792a3)

15 months agosystemctl: gracefully adjust bus transport and runtime scope when --boot-loader-entry...
Yu Watanabe [Sun, 4 Aug 2024 05:09:53 +0000 (14:09 +0900)]
systemctl: gracefully adjust bus transport and runtime scope when --boot-loader-entry=help

This fixes the following assertion:
===
SYSTEMD_LOG_LEVEL=debug systemctl --user -H foo --boot-loader-entry=help
Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Ignoring.
Failed to connect to bus: Operation not supported
===

Fixes a bug introduced by 97af80c5a7029c3f92e982dcf9338b9e67ad9cde.
Fixes #33661.
Fixes oss-fuzz#70153.

(cherry picked from commit 1056457d1132e78cbf914e8abfa661465b952412)

15 months agosrc/pcrlock/pcrlock.c: Handle empty pcrlock.d directories
Arnaud Patard [Mon, 8 Jul 2024 13:39:14 +0000 (15:39 +0200)]
src/pcrlock/pcrlock.c: Handle empty pcrlock.d directories

Running the following commands:

  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock predict --pcr=1+2+3+4+5+16

Will result in:

...
Floating point exception

Running the following commands:
  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock make-policy --pcr=1+2+3+4+5+16

Will result to this (partial) log:
...
Predicted future PCRs in 133us.
[]
...
Written policy digest 0000000000000000000000000000000000000000000000000000000000000000 to NV index 0x1921da6
...

So, add missing checks to handle gracefully cases where there's no variant
inside the component.

Signed-off-by: Arnaud Patard <arnaud.patard@collabora.com>
(cherry picked from commit e7a93e75219b22424bab95fe45982f5eef21d581)

15 months agomkosi: Prevent busybox from getting pulled into opensuse images
Daan De Meyer [Mon, 5 Aug 2024 13:37:46 +0000 (15:37 +0200)]
mkosi: Prevent busybox from getting pulled into opensuse images

OpenSUSE's busybox has a bunch of Provides for basic tools that cause
it to get pulled into images unless the corresponding tool is explicitly
installed so let's add explicit tools to make sure we don't get busybox.

(cherry picked from commit 857e4528f5fe556bbe98e32ffcde8932d0d80f83)

15 months agotest: Add a way to quickly iterate on an integration test
Daan De Meyer [Fri, 2 Aug 2024 14:25:03 +0000 (16:25 +0200)]
test: Add a way to quickly iterate on an integration test

Rebuilding the integration test every time is very slow. Let's
introduce a way to iterate on an integration test without rebuilding
the image every time. By making a btrfs snapshot before we run the
integration test, we can then systemctl soft-reboot after running
the test to restore the rootfs to a pristine state before running
the test again.

As /run/nextroot will get nuked on reboot or soft-reboot, we introduce
a tmpfiles snippet to make sure it is recreated every (soft-)reboot
and adapt the existing tests to deal with this new symlink.

(cherry picked from commit af153e36ae67c242251951c12d6d6b6ae4783845)

15 months agomkosi: Switch back to btrfs
Daan De Meyer [Fri, 2 Aug 2024 14:23:40 +0000 (16:23 +0200)]
mkosi: Switch back to btrfs

The next commit will introduce a way to iterate on integration
tests which depends on btrfs specific features.

We leave CentOS on ext4 as its kernel does not support btrfs.

(cherry picked from commit edc6592e532806fe9ac28400138d5d4e1492a7d0)

15 months agomkosi: Enable Autologin= again on Debian
Daan De Meyer [Fri, 2 Aug 2024 14:22:37 +0000 (16:22 +0200)]
mkosi: Enable Autologin= again on Debian

Debian uses /usr/bin/login from the shadow package instead of util-linux
which doesn't support credentials. Let's enable autologin the old
fashioned way for now.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833256
(cherry picked from commit ea696c5f5300c240ae2749f7791aaa78837d556b)

15 months agotest: Implement TEST_SHELL for mkosi based test runner
Daan De Meyer [Fri, 2 Aug 2024 13:46:41 +0000 (15:46 +0200)]
test: Implement TEST_SHELL for mkosi based test runner

TEST_SHELL can be used to get a shell in the integration test
environment without actually immediately starting the test.

(cherry picked from commit dd1c01b20fb8eef6a4d41ac7f0d3d83399e27593)

15 months agotest: Rename INTERACTIVE_DEBUG to TEST_SHELL
Daan De Meyer [Fri, 2 Aug 2024 14:16:14 +0000 (16:16 +0200)]
test: Rename INTERACTIVE_DEBUG to TEST_SHELL

(cherry picked from commit 33f400a9e05f3a09d28ac3d8251cf82592a207c6)

15 months agodocs: Update upgrade commands in HACKING.md
Daan De Meyer [Fri, 2 Aug 2024 13:18:45 +0000 (15:18 +0200)]
docs: Update upgrade commands in HACKING.md

- Add the required options to make the package managers non interactive
- Use apt-get instead of apt
- Remove --reinstall from apt-get command so we only install newer packages
- Add --needed to pacman command so we only install newer packages

(cherry picked from commit 5f5b6fa9017c7c5de1e8a3e6b8888fd71a1d3862)

15 months agomkosi: Drop locale tmpfiles snippet
Daan De Meyer [Fri, 2 Aug 2024 11:45:41 +0000 (13:45 +0200)]
mkosi: Drop locale tmpfiles snippet

Not required anymore as we don't do /usr only anymore and the symlink
will be created by the debian systemd package.

(cherry picked from commit 63bafef12ba867010507963d5aac67f4d64d85e9)

15 months agojournal: set flushed flag even if we fail to open runtime journals
Yu Watanabe [Mon, 5 Aug 2024 05:18:21 +0000 (14:18 +0900)]
journal: set flushed flag even if we fail to open runtime journals

As at this stage, a persistent journal file has been already opened, and
saved seqnum has been reset, and any later journal entries will be stored
to the file. Hence we should not open the runtime journal file by
server_system_journal_open() again.

(cherry picked from commit b55027efe41b266df4c4704e924fff7dfb32ad70)

15 months agojournal: comment the default value in journald.conf
Yu Watanabe [Mon, 5 Aug 2024 06:24:07 +0000 (15:24 +0900)]
journal: comment the default value in journald.conf

(cherry picked from commit 0d113f8e70243c1a8f0587105195e51e027a4725)

15 months agojournal: do not rotate journal when MaxRetentionSec= is set
Yu Watanabe [Mon, 5 Aug 2024 05:56:11 +0000 (14:56 +0900)]
journal: do not rotate journal when MaxRetentionSec= is set

The setting is about vacuuming archived journal files. It is not
necessary to rotate the current journal. Note, journal file rotation is
controlled by MaxFileSec=.

Fixes #31315.

(cherry picked from commit b63c18db03d0c120ba9eaa2aa9d0d43d80eea02b)

15 months agoresolve: refuse invalid service without type field
Yu Watanabe [Mon, 5 Aug 2024 01:46:41 +0000 (10:46 +0900)]
resolve: refuse invalid service without type field

Fixes Fixes #33935.

(cherry picked from commit b48ab08732a76b7337628e1e716f11c687000903)

15 months agosystemctl: refuse --capsule=foo with --system
Yu Watanabe [Sun, 4 Aug 2024 05:07:13 +0000 (14:07 +0900)]
systemctl: refuse --capsule=foo with --system

Fixes the following assertion:
===
systemctl --capsule=hoge --system reboot
Assertion 'runtime_scope == RUNTIME_SCOPE_USER' failed at src/shared/bus-util.c:479, function bus_connect_transport(). Aborting.
Aborted (core dumped)
===

Follow-up for 56cb74c3cd1358d7d0b3f613feaf2eeab601a6bd.

(cherry picked from commit bcf982223cc5d051818dc88866a42f6a08f39a4a)

15 months agobase-filesystem: do not attempt to create a /lib64 -> /usr/lib/<tuple> symlink
Luca Boccassi [Sat, 3 Aug 2024 23:00:05 +0000 (00:00 +0100)]
base-filesystem: do not attempt to create a /lib64 -> /usr/lib/<tuple> symlink

In multi-arch distributions (debian and derivatives) multiarch tuples under
/usr/lib are used, such as /usr/lib/x86_64-linux-gnu/ but the /lib64 symlink
should never point there, it should always point to /usr/lib64, as that's
how they are set up by distribution-specific tools.

https://packages.debian.org/bookworm/amd64/libc6-i386/filelist
https://packages.debian.org/bookworm/mipsel/libc6-mips64/filelist
https://salsa.debian.org/md/usrmerge/-/blob/master/convert-usrmerge?ref_type=heads#L295
https://salsa.debian.org/md/usrmerge/-/blob/master/convert-usrmerge?ref_type=heads#L517
http://bugs.debian.org/1076491

Fixes https://github.com/systemd/systemd/issues/33919

(cherry picked from commit b75c13731ee0867a8d7889348fc8da1869af7551)

15 months agomeson: Use -fstrict-flex-arrays=3
Daan De Meyer [Sat, 3 Aug 2024 18:10:54 +0000 (20:10 +0200)]
meson: Use -fstrict-flex-arrays=3

Let's explicitly pass the value to -fstrict-flex-arrays. This does
not change behavior but it does (selfishly) make my error not bug
out with an error saying -fstrict-flex-arrays does not exist.

(cherry picked from commit ad723ca3e5bd41d2d884760375534910bb55d9b3)

15 months agocore/execute-serialize: use serialize_item_escaped() for external paths
Mike Yuan [Sat, 3 Aug 2024 20:38:18 +0000 (22:38 +0200)]
core/execute-serialize: use serialize_item_escaped() for external paths

Otherwise, read_stripped_line() would spuriously drop trailing spaces.

Fixes #33924

(cherry picked from commit 9be46b1da8b01c3f47e6c050185f2b45484d6300)

15 months agocore/execute-serialize: drop extraneous '=' in ip-{in,e}gress serialization
Mike Yuan [Sat, 3 Aug 2024 20:37:41 +0000 (22:37 +0200)]
core/execute-serialize: drop extraneous '=' in ip-{in,e}gress serialization

(cherry picked from commit f0fdd13c2f06f9c78747103b971566e2c62b9333)

15 months agoman/net-naming-scheme: mention that NAMING_BRIDGE_MULTIFUNCTION_SLOT is reverted
Yu Watanabe [Fri, 2 Aug 2024 07:45:15 +0000 (16:45 +0900)]
man/net-naming-scheme: mention that NAMING_BRIDGE_MULTIFUNCTION_SLOT is reverted

Follow-up for af7417ac7b07bc01232982bf46e9d72e69e7f820.
Closes #33596.

(cherry picked from commit 1c0130e8dc3c99d5a85be41e9172adb0ff0cf7fd)

15 months agoman: extend explanation for ConfigureWithoutCarrier= in systemd.network(5)
Yu Watanabe [Fri, 2 Aug 2024 04:42:29 +0000 (13:42 +0900)]
man: extend explanation for ConfigureWithoutCarrier= in systemd.network(5)

Prompted by #33702.

(cherry picked from commit 347c8822d1a8a5b70624920b3de2a91d4e0fca91)

15 months agoman/systemd-detect-virt: list known CVM technologies
Daniel P. Berrangé [Fri, 2 Aug 2024 12:17:56 +0000 (13:17 +0100)]
man/systemd-detect-virt: list known CVM technologies

Add a section which lists the known confidential virtual machine
technologies.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit a8fb5d21fd6127a6d05757c793cc9ba47f65c893)

15 months agoconfidential-virt: add detection for s390x target
Daniel P. Berrangé [Fri, 2 Aug 2024 10:03:10 +0000 (11:03 +0100)]
confidential-virt: add detection for s390x target

The s390x platform provides confidential VMs using the "Secure Execution"
technology, which is also referred to as "Protected Virtualization" or
just "prot virt" in Linux / QEMU.

This can be detected through a simple sysfs attribute.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 6c35e0a51cc6a852ce239ea46cd75c133212a68e)

15 months agoconfidential-virt: split caching of CVM detection into separate method
Daniel P. Berrangé [Fri, 2 Aug 2024 15:26:00 +0000 (16:26 +0100)]
confidential-virt: split caching of CVM detection into separate method

We have different impls of detect_confidential_virtualization per
architecture. The detection is cached in the x86_64 impl, and as we
add support for more targets, we want to use caching for all. It thus
makes sense to split caching out into an architecture independent
method.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 1c4bd7adcc281af2a2dd40867f64f2ac54a43c7a)

15 months agotest: don't use /skipped for subtests
Frantisek Sumsal [Fri, 2 Aug 2024 08:13:47 +0000 (10:13 +0200)]
test: don't use /skipped for subtests

Since, at least the old framework, checks for the presence of the file
at the end and marks the whole test as skipped if it exists.

Resolves: systemd/systemd-centos-ci#728
(cherry picked from commit 4d1fbe53c1cc9b04acd897c728d996191daa618d)

15 months agoresolved: don't treat conn reset as packet loss
Ronan Pigott [Thu, 1 Aug 2024 17:59:12 +0000 (10:59 -0700)]
resolved: don't treat conn reset as packet loss

tcp reset / icmp port-unreachable are markedly different conditions than
packet loss. It doesn't make much sense to retry in this case. It's
actually not clear if there is any benefit at all retrying tcp
connections, which were presumably already retried as necessary by the
tcp stack.

(cherry picked from commit ddd710a355acc698b48159f3e501dda5a7dc2704)

15 months agoimport: check overflow
Yu Watanabe [Thu, 1 Aug 2024 03:03:54 +0000 (12:03 +0900)]
import: check overflow

Fixes CID#1548022 and CID#1548075.

(cherry picked from commit f7012a93a7f04fa29c7933a4963aa17fcf120e97)

15 months agotest: attempt to install sshd-session from multiple places
Frantisek Sumsal [Thu, 1 Aug 2024 11:14:52 +0000 (13:14 +0200)]
test: attempt to install sshd-session from multiple places

On Fedora the sshd-session binary is under /usr/libexec/openssh/ so
cover this path as well in the old framework.

Follow-up for aaa7b36bd15ca3a96a1e11a557482b0bc59c769f.

(cherry picked from commit ce2344bbee468c7d524e508a8ff7f5f7ae85acb5)

15 months agomkosi: Beef up testuser a bit
Daan De Meyer [Wed, 31 Jul 2024 15:42:56 +0000 (17:42 +0200)]
mkosi: Beef up testuser a bit

Give it a password and add it to some common groups.

(cherry picked from commit 3fe25d4530356b3b04d505bc5442503897c124dd)

15 months agosocket: fix socket activation of stopped services with pinned FD store
Michal Sekletar [Tue, 30 Jul 2024 14:22:03 +0000 (16:22 +0200)]
socket: fix socket activation of stopped services with pinned FD store

(cherry picked from commit 941a12dcba57f6673230a9c413738c51374d2998)

15 months agoexec-credential: Skip duplicate credentials in load_credential_glob()
Daan De Meyer [Wed, 31 Jul 2024 13:02:07 +0000 (15:02 +0200)]
exec-credential: Skip duplicate credentials in load_credential_glob()

We document that when multiple credentials of the same name are found,
we use the first one found so let's actually implement that behavior.

(cherry picked from commit 3de13e6148731ae9c36885afd78b1421e6f16305)

15 months agoexec-credential: Log if we skip duplicate credential
Daan De Meyer [Wed, 31 Jul 2024 13:01:40 +0000 (15:01 +0200)]
exec-credential: Log if we skip duplicate credential

(cherry picked from commit 590348e2bf8415053487324d47d0083b49dfdeb0)

15 months agoDrop EEXIST handling in load_credential_glob()
Daan De Meyer [Wed, 31 Jul 2024 13:21:17 +0000 (15:21 +0200)]
Drop EEXIST handling in load_credential_glob()

Credentials are written to a temporary file and renamed to the
destination with renameat() which will replace existing files so
EEXIST should not happen so drop the handling for EEXIST.

(cherry picked from commit 2c2ed3272b992b6eb13864e49847c943e42be00f)

15 months agocgroup-util: Don't try to open pidfd for kernel threads
Daan De Meyer [Wed, 31 Jul 2024 11:38:50 +0000 (13:38 +0200)]
cgroup-util: Don't try to open pidfd for kernel threads

The kernel might start returning -EINVAL when trying to open pidfd's
for kernel threads so let's not try to open pidfd's for kernel threads.

(cherry picked from commit ead48ec35c863650944352a3455f26ce3b393058)

15 months agolog: Fix size calculation for number of iovecs
Daan De Meyer [Wed, 31 Jul 2024 09:39:04 +0000 (11:39 +0200)]
log: Fix size calculation for number of iovecs

Each log context field can expand to up to three iovecs (key, value
and newline) so let's fix the size calculation to take this into
account.

(cherry picked from commit fc83ff3f55ee53fd9101d4e45736f3f996ee7ca6)

15 months agoexecute: Drop log level to unit log level in exec_spawn()
Daan De Meyer [Wed, 31 Jul 2024 11:11:51 +0000 (13:11 +0200)]
execute: Drop log level to unit log level in exec_spawn()

All messages logged from exec_spawn() are attributed to the unit
and as such we should set the log level to the unit's max log level
for the duration of the function.

(cherry picked from commit 7881f485c9f57b1c7de4308eeab54458890c5c19)

15 months agofirstboot: fix root params with creds and prompting disabled
Dan Nicholson [Tue, 30 Jul 2024 13:37:40 +0000 (07:37 -0600)]
firstboot: fix root params with creds and prompting disabled

Remove an early return that prevents --prompt-root-password or
--prompt-root-shell and systemd.firstboot=off using credentials. In that case,
arg_prompt_root_password and arg_prompt_root_shell will be false, but the
prompt helpers still need to be called to read the credentials. Furthermore, if
only the root shell has been set, don't overwrite the root password.

(cherry picked from commit 35bc4c34240afdd55e117b909f26fa9a5dc54f3b)

15 months agofirstboot: handle missing root password entries
Dan Nicholson [Tue, 30 Jul 2024 19:42:26 +0000 (13:42 -0600)]
firstboot: handle missing root password entries

If /etc/passwd and/or /etc/shadow exist but don't have an existing root entry,
one needs to be added. Previously this only worked if the files didn't exist.

(cherry picked from commit 2319154a6bec7b8c42e901dfacaefe95bf4e3750)

15 months agoman: suggest to enable global IPv6Forwarding= setting to make IPv6 packets forwarded
Yu Watanabe [Sun, 23 Jun 2024 20:03:58 +0000 (05:03 +0900)]
man: suggest to enable global IPv6Forwarding= setting to make IPv6 packets forwarded

Closes #33414.

(cherry picked from commit 175cdefd33788eced7fd6d76fb0b1676eb6ba799)

15 months agofirstboot: create locked and empty root passwords consistently
Dan Nicholson [Tue, 30 Jul 2024 17:11:11 +0000 (11:11 -0600)]
firstboot: create locked and empty root passwords consistently

Although locked and empty passwords in /etc/passwd are treated the same, in all
other cases the entry is configured to read the password from /etc/shadow.

(cherry picked from commit 5088de9daa156a095e79684c658f9035db971538)

15 months agotest: extend firstboot testing
Dan Nicholson [Wed, 31 Jul 2024 00:20:13 +0000 (18:20 -0600)]
test: extend firstboot testing

Several features were not being tested or weren't being evaluated thoroughly.

(cherry picked from commit 38688bbc8ffb16a449a41cab344c27f6b1e74cd3)

15 months agonetwork: mention that IPv4 ACD is enabled by default for 169.254.0.0/16
Yu Watanabe [Tue, 30 Jul 2024 22:21:09 +0000 (07:21 +0900)]
network: mention that IPv4 ACD is enabled by default for 169.254.0.0/16

Prompted by #33824.

(cherry picked from commit dd87ad8e193092f053ca702b303b25d2001bf96d)

15 months agonetwork: request non-NULL SSID when a wlan interface is configured as station
Yu Watanabe [Tue, 30 Jul 2024 21:49:32 +0000 (06:49 +0900)]
network: request non-NULL SSID when a wlan interface is configured as station

To avoid conflicts with user .network file for the wlan interface with Bond=.
See https://github.com/systemd/systemd/issues/19832#issuecomment-857661200.

(cherry picked from commit e2becab08506d8a085f4c18231c7f354db16df9f)

15 months agoefi: fix link to legacy EFI handover protocol
Luca Boccassi [Wed, 31 Jul 2024 00:46:58 +0000 (01:46 +0100)]
efi: fix link to legacy EFI handover protocol

(cherry picked from commit 4d6ab7e8440845301c90211beb22015e7232faa1)

15 months agostub: allocate and zero enough space in legacy x86 handover protocol
Luca Boccassi [Wed, 31 Jul 2024 00:45:06 +0000 (01:45 +0100)]
stub: allocate and zero enough space in legacy x86 handover protocol

A PE image's memory footprint might be larger than its file size due
to uninitialized memory sections. Normally all PE headers should be
parsed to check the actual required size, but the legacy EFI handover
protocol is only used for x86 Linux bzImages, so we know only the last
section will require extra memory. Use SizeOfImage from the PE header
and if it is larger than the file size, allocate and zero extra memory
before using it.

Fixes https://github.com/systemd/systemd/issues/33816

(cherry picked from commit 19812661f1f65ebe777d1626b5abf6475faababc)

15 months agonetwork: call link_handle_bound_by_list() before trying to reconfigure interface
Yu Watanabe [Tue, 30 Jul 2024 18:50:55 +0000 (03:50 +0900)]
network: call link_handle_bound_by_list() before trying to reconfigure interface

Otherwise, when an interface gained its carrier, the interface may not
have matching .network file yet, then link_reconfigure_impl() returns
zero, and link_handle_bound_by_list() is skipped.

Fixes #33837.

(cherry picked from commit 36b8ad085c6902631ad7054bffbda33d6d168823)

15 months agoRevert "network/ndisc: ignore most fields of RA header when lifetime is zero"
Ivan Shapovalov [Sun, 16 Jun 2024 08:46:34 +0000 (10:46 +0200)]
Revert "network/ndisc: ignore most fields of RA header when lifetime is zero"

This reverts commit ffef01acddcac27caaef02f7f28bff03d7799e5e.

Similar to 2d393b1b6d8 ("network: IPv6 Compliance: Router Advertisement
Processing, Reachable Time [v6LC.2.2.15]"),

Extract from: https://www.ietf.org/rfc/rfc4861.html#section-4.2, p.21,
first paragraph:

    The Router Lifetime applies only to
    the router's usefulness as a default router; it
    does not apply to information contained in other
    message fields or options.

So it does not make sense to prevent DHCPv6 when Router Lifetime is 0.

Fixes #33357.

(cherry picked from commit 7767896d127264f660e1e8a714e5cd760840921f)

15 months agoFix detection of TDX confidential VM on Azure platform
Daniel P. Berrangé [Tue, 30 Jul 2024 09:51:21 +0000 (10:51 +0100)]
Fix detection of TDX confidential VM on Azure platform

The original CVM detection logic for TDX assumes that the guest can see
the standard TDX CPUID leaf. This was true in Azure when this code was
originally written, however, current Azure now blocks that leaf in the
paravisor. Instead it is required to use the same Azure specific CPUID
leaf that is used for SEV-SNP detection, which reports the VM isolation
type.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 9d7be044cad1ae54e344daf8f2ec37da46faf0fd)

15 months agonetwork: do not bring down bound interfaces immediately
Yu Watanabe [Tue, 30 Jul 2024 18:04:04 +0000 (03:04 +0900)]
network: do not bring down bound interfaces immediately

Even if a timespan specified to IgnoreCarrierLoss= for an interface,
when the carrier of the interface lost, bound interfaces might be bring
down immediately.

Let's also postpone bringing down bound interfaces with the specified
timespan.

(cherry picked from commit e8eaed0240d642e70c567b08f3593e4cf45a255a)

15 months agodocument how TimeoutStartSec= affects notify-reload (#33653)
Arian van Putten [Tue, 30 Jul 2024 11:35:52 +0000 (13:35 +0200)]
document how TimeoutStartSec=  affects notify-reload (#33653)

* document how TimeoutStartSec=  affects notify-reload

(cherry picked from commit a55d1b29a4cc2edc8550c5f4e062f2194807dcd3)

15 months agonspawn: remove macvlan interfaces before network namespace died
Yu Watanabe [Tue, 30 Jul 2024 05:35:33 +0000 (14:35 +0900)]
nspawn: remove macvlan interfaces before network namespace died

This is similar to what we do for veth interfaces in remove_veth_links().

When a container rebooted, macvlan interfaces created by the previous
boot may still exist in the kernel, and that causes -EADDRINUSE after
reboot.

Hopefully fixes #680.

(cherry picked from commit 1bfa47418e9df03c2562a4c82dc319cf7c3b228c)

15 months agocgroup-util: Ignore kernel threads in cg_kill_items()
Daan De Meyer [Tue, 30 Jul 2024 09:53:32 +0000 (11:53 +0200)]
cgroup-util: Ignore kernel threads in cg_kill_items()

Similar to the implementation of cgroup.kill in the kernel, let's
skip kernel threads in cg_kill_items() as trying to kill kernel
threads as an unprivileged process will fail with EPERM and doesn't
do anything when running privileged.

(cherry picked from commit 0fbb569de1dcc06118dba006cf7a40caf6cd94d0)

15 months agokernel-install: Try some more initrd variants in 90-loaderentry.install
Daan De Meyer [Mon, 29 Jul 2024 13:41:51 +0000 (15:41 +0200)]
kernel-install: Try some more initrd variants in 90-loaderentry.install

On CentOS/Fedora, dracut is configured to write the initrd to
/boot/initramfs-$KERNEL_VERSION...img so let's check for that as well
if no initrds were supplied.

(cherry picked from commit b56920e36c5692c0dde701bfb48330653a9c62c9)

15 months agokernel-install: Only read cmdline from /proc/cmdline when not in container
Daan De Meyer [Mon, 29 Jul 2024 15:13:28 +0000 (17:13 +0200)]
kernel-install: Only read cmdline from /proc/cmdline when not in container

If we're running from within a container, we're very likely not going
to want to use the kernel command line from /proc/cmdline, so let's add
a check to see if we're running from a container to decide whether we'll
use the kernel command line from /proc/cmdline.

(cherry picked from commit 35c01ec59e0c2e6bd06cb18ca2ff612c6a7ea35d)

15 months agotest: Don't mount build sources into image when running non-interactively
Daan De Meyer [Mon, 29 Jul 2024 11:40:42 +0000 (13:40 +0200)]
test: Don't mount build sources into image when running non-interactively

(cherry picked from commit 578ee05155c0f6d8cc07f785fcc636037545c8da)

15 months agonetwork: Fixup Table when L3MasterDevice is set on routing policy rule
Nick Cao [Sun, 28 Jul 2024 14:07:19 +0000 (10:07 -0400)]
network: Fixup Table when L3MasterDevice is set on routing policy rule

(cherry picked from commit 615af2c77d996b2ba6e6d17d376f7a221c0e5822)

15 months agoman: network: move note about L3MasterDevice to the correct section
Nick Cao [Sun, 28 Jul 2024 17:50:30 +0000 (13:50 -0400)]
man: network: move note about L3MasterDevice to the correct section

(cherry picked from commit 034b7dfc08062cde9f63847f34b4d1c604a19a46)

15 months agoman: clarify systemd-path variable source
Vladimir Panteleev [Sat, 27 Jul 2024 11:49:20 +0000 (11:49 +0000)]
man: clarify systemd-path variable source

(cherry picked from commit 3f24fa57df552accc2a6f9ab4d36724ba7227eff)

15 months agoman: improve ManagerEnvironment documentation
Vladimir Panteleev [Sat, 27 Jul 2024 11:43:47 +0000 (11:43 +0000)]
man: improve ManagerEnvironment documentation

- Improve wording for explanation when these variables are inherited

- Clarify that these variables are not placed in the process environment block,
  so /proc/PID/environ cannot be used as a debugging tool

(cherry picked from commit 6c1e0823b04525716d9ee0031a2b6735d3f7dfa4)

15 months agokernel-install: remove depmod generated file modules.weakdep
Jose Ignacio Tornos Martinez [Fri, 26 Jul 2024 08:28:21 +0000 (10:28 +0200)]
kernel-install: remove depmod generated file modules.weakdep

The new file, modules.weakdep, generated by depmod to get the weak
dpendencies information can be present
(https://github.com/kmod-project/kmod/commit/05828b4a6e9327a63ef94df544a042b5e9ce4fe7),
so remove it like the other similar files.

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
(cherry picked from commit eef4cd51f94d837bd0e71512c831634a2902522d)

15 months agoresolved: Don't retry queries that indicate net error
Ronan Pigott [Thu, 25 Jul 2024 19:48:03 +0000 (12:48 -0700)]
resolved: Don't retry queries that indicate net error

This probably rarely helped anyway, but it also in some cases interferes
with auxiliary dnssec queries where the authoritative nameserver does
not support EDNS0/DNSSEC.

Fixes: ac6844460ca1 ("resolved: support RFC 8914 EDE error codes")
(cherry picked from commit cd2ce31adbfa5fb4f08267a13ace3a72e7597a2f)

15 months agotest: Fail cgroup delegation test when user cannot be created
Michal Koutný [Fri, 26 Jul 2024 08:44:10 +0000 (10:44 +0200)]
test: Fail cgroup delegation test when user cannot be created

It means: a) user cannot be created, something's wrong in the
test environment -> fail the test; b) user already exists, we shall not
continue and delete (foreign) user.

(cherry picked from commit 3e6e3e6d40db0a9e9741ef4942218193fca7b28e)

15 months agoresize-fs: Put minimal ext4 size in the same ballpark as the other filesystems
Daan De Meyer [Thu, 25 Jul 2024 11:22:42 +0000 (13:22 +0200)]
resize-fs: Put minimal ext4 size in the same ballpark as the other filesystems

TEST-46-HOMED fails on ext4 because the filesystem is deemed to small
for activation by cryptsetup. Let's bump the minimal filesystem size for
ext4 a bit to be in the same ballpark as ext4 and btrfs to avoid weird
errors due to impossibly small filesystems.

Also use U64_MB while we're touching this.

(cherry picked from commit ae07feb401ff70b122650ac01041021703d4b8ad)

15 months agotest: Reorganize testcase of cgroup delegation
Michal Koutný [Thu, 31 Mar 2022 16:25:36 +0000 (18:25 +0200)]
test: Reorganize testcase of cgroup delegation

There are multiple subtests, just move them around into functions
(leveraging the testcase_* convention) to make space for new related
subtests.

(cherry picked from commit 4f0541dc595277a62431c46d59dc258005160650)

15 months agoTEST-54-CREDS: Specify SMBIOS creds via corresponding mkosi option
Daan De Meyer [Thu, 25 Jul 2024 11:08:48 +0000 (13:08 +0200)]
TEST-54-CREDS: Specify SMBIOS creds via corresponding mkosi option

This allows mkosi to combine fstab.extra with its own fstab.extra so
that it doesn't override the one we pass for the test.

(cherry picked from commit ebe17e3f9e6f6b7a85677fc10439936b41d196e3)

15 months agosd-event: change error code -EINVAL -> -EIO
Yu Watanabe [Sun, 4 Aug 2024 02:29:03 +0000 (11:29 +0900)]
sd-event: change error code -EINVAL -> -EIO

EINVAL should be used when a function is called with an invalid
argument. Here, the signal is not a function argument.

Follow-up for 7a64c5f23efbb51fe4f1229c1a8aed6dd858a0a9.

(cherry picked from commit ab9af70edb23f2a66e93e2e16f87cd98873885b7)

15 months agosd-event: do not assert on invalid signal
David Tardon [Thu, 25 Jul 2024 08:06:34 +0000 (10:06 +0200)]
sd-event: do not assert on invalid signal

The signalfd_siginfo struct is received from outside via a FD, hence
assert() is not appropriate way to check it. Just do a normal runtime
check.

(cherry picked from commit 7a64c5f23efbb51fe4f1229c1a8aed6dd858a0a9)

15 months agologind-dbus: check auth. for all inhibitor operations
David Tardon [Thu, 25 Jul 2024 07:47:56 +0000 (09:47 +0200)]
logind-dbus: check auth. for all inhibitor operations

Fixes #33834

(cherry picked from commit 639719e01065c3a2f557d70e4d8088c2ec71c7c6)

15 months agodocs/CONTROL_GROUP_INTERFACE.md: document accounting information available via D-Bus
Jeffrey Bosboom [Thu, 25 Jul 2024 01:14:24 +0000 (18:14 -0700)]
docs/CONTROL_GROUP_INTERFACE.md: document accounting information available via D-Bus

(cherry picked from commit f7fa6326820bbb75a2a7112072a7771944ad8ce3)

15 months agobasic/log: do not treat all negative errnos as synthetic
Mike Yuan [Wed, 24 Jul 2024 14:28:48 +0000 (16:28 +0200)]
basic/log: do not treat all negative errnos as synthetic

Currently, IS_SYNTHETIC_ERRNO() evaluates to true for all negative errnos,
because of the two's-complement negative value representation.
Subsequently, ERRNO= is not logged for most of our own code.
Let's fix this, by formatting all synthetic errnos as positive.
Then, treat all negative values as non-synthetic.

While at it, mark the evaluation order explicitly, and remove
unneeded comment.

Fixes #33800

(cherry picked from commit 268f58076f7e0258dce75f521d08199092279853)

15 months agotest: fix D-Bus policy override for TEST-73-LOCALE
Luca Boccassi [Thu, 25 Jul 2024 09:43:48 +0000 (10:43 +0100)]
test: fix D-Bus policy override for TEST-73-LOCALE

We don't need to allow non-root, and the policy needs to specify destination
and interface too, to narrow it down

Follow-up for 7b5c38a91def6cf236605010a0a93a1cd4c137e9

(cherry picked from commit a4c436c9d8ae20baf9d1d08d43e64e6355bcce83)

15 months agotest-fs-util: Modernize openat_report_new() test
Daan De Meyer [Wed, 24 Jul 2024 08:50:38 +0000 (10:50 +0200)]
test-fs-util: Modernize openat_report_new() test

(cherry picked from commit b91ad562280ec4f37ba970f1f167d2d626da2692)

15 months agotest-id128: Use new assertion macros
Daan De Meyer [Wed, 24 Jul 2024 07:56:25 +0000 (09:56 +0200)]
test-id128: Use new assertion macros

(cherry picked from commit 372e96a5a10630eb2e02111672221428e0be3fb8)

15 months agotest: Add ASSERT_EQ_ID128() and ASSERT_NE_ID128()
Daan De Meyer [Wed, 24 Jul 2024 07:56:01 +0000 (09:56 +0200)]
test: Add ASSERT_EQ_ID128() and ASSERT_NE_ID128()

(cherry picked from commit 60a4505da4cfb57653fac79a79745e32ab0bc311)

15 months agotest: Add ASSERT_FAIL()
Daan De Meyer [Wed, 24 Jul 2024 07:55:21 +0000 (09:55 +0200)]
test: Add ASSERT_FAIL()

(cherry picked from commit 8eb06fd162c8828739f8619437351d98d7105ec9)