systemd/.git
17 months agotest: fix TEST-24-CRYPTSETUP on SUSE
Franck Bui [Tue, 2 Jul 2024 08:33:29 +0000 (10:33 +0200)]
test: fix TEST-24-CRYPTSETUP on SUSE

/etc/systemd/journald.conf.d drop-in dir already exists on SUSE.

(cherry picked from commit 56a894e888002f44f3463b3188f9d5abdcca4bb0)

17 months agotest: install /etc/hosts
Franck Bui [Mon, 1 Jul 2024 16:06:45 +0000 (18:06 +0200)]
test: install /etc/hosts

Needed for resolving the "localhost" hostname.

(cherry picked from commit a09825ce9fb3bd315f35654b6e6ee4f92c675cde)

17 months agotest: split the resolved test suite into separate test cases
Daniel Rusek [Thu, 6 Jun 2024 21:44:38 +0000 (23:44 +0200)]
test: split the resolved test suite into separate test cases

Although being far from ideal and the first two test cases have to be run
before the setup phase otherwise they will fail, it still makes the test
suite look much better and easier to read

(cherry picked from commit a9d472d6e4ae6c548dd24097b20563dc9c06b329)

17 months agomkosi: update debian commit reference
Luca Boccassi [Mon, 1 Jul 2024 14:49:55 +0000 (15:49 +0100)]
mkosi: update debian commit reference

abf24e775c Add recommends on linux-sysctl-defaults
76cb4138d2 autopkgtest: skip qemu tests on arm64
0935d73526 Install new systemd-import generator

(cherry picked from commit 4739539a7866f660cec5d746af65a951cdab8dc4)

17 months agounits: add dep on systemd-logind.service by user@.service
Lennart Poettering [Mon, 1 Jul 2024 10:40:33 +0000 (12:40 +0200)]
units: add dep on systemd-logind.service by user@.service

Let's make sure logind is accessible by the time user@.service runs, and
that logind stays around as long as it does so.

Addresses an issue reported here:

https://lists.freedesktop.org/archives/systemd-devel/2024-June/050468.html

This addresses an issued introduced by
278e815bfa3e4c2e3914e00121c37fc844cb2025, which dropped the a dependency
from user@.service systemd-user-sessions.service without replacement.
While dropping that dependency does make sense, it should have been
replaced with the weaker dependency on systemd-logind.service, hence fix
that now.

user@.service is after all a logind concept, hence logind really should
be around for its lifetime.

systemd-user-sessions.service is a later milestone that only really
should apply to regular users (not root), hence it's too strong a
requirement.

(cherry picked from commit 29294d21cf82323bf04a9dbb5a03d48d6f758822)

17 months agorepart: add sections to --help text
Lennart Poettering [Mon, 1 Jul 2024 08:25:38 +0000 (10:25 +0200)]
repart: add sections to --help text

(cherry picked from commit 68debef4c12e7a25362e8ddbc752feee8c13762b)

17 months ago Conditional PSI check to reflect changes done in 5.13
rhellstrom [Thu, 27 Jun 2024 08:00:00 +0000 (11:00 +0300)]
Conditional PSI check to reflect changes done in 5.13

cpu.pressure 'full' is undefined for system-wide checks since 5.13 but still reported with values set to 0 for backwards compatibility. Made changes to reflect this for system-wide checks so that the conditional comparison is not made against the 0 value and instead fall back to 'some'.

https://www.kernel.org/doc/html/latest/accounting/psi.html
(cherry picked from commit 98b1ecc9175a8bb241292f6f441a754b6759dd97)

17 months agocore: try again bind mounting if the destination was already created
Luca Boccassi [Sat, 29 Jun 2024 17:31:23 +0000 (18:31 +0100)]
core: try again bind mounting if the destination was already created

If the destination mount point is on a shared filesystem and is
missing on the first attempt, we try to create it, but then
fail with -EEXIST if something else created it in the meanwhile.
Enter the retry logic on EEXIST, as we can just use the mount
point if it was already created.

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

(cherry picked from commit c3f0f6f8bd812fee4b2ab658a5cc9ac9167d387d)

17 months agomkfs-util: Set sector size for btrfs as well
Daan De Meyer [Sat, 29 Jun 2024 13:27:02 +0000 (15:27 +0200)]
mkfs-util: Set sector size for btrfs as well

btrfs used to default the sector size to the page size and didn't
support anything else. Since 6.7, it defaults to 4K and using 4K
makes the filesystem compatible with all page sizes. So let's make
sure we use minimum 4K as well (lower causes failures on systems with
a 4K page size) but still allow larger sector sizes if specified by
the user.

(cherry picked from commit 03c9e88fb7eb8973477c33aa63dc6bcf0cab52c9)

17 months agorepart: Don't set filesystem sector size to 512
Daan De Meyer [Sat, 29 Jun 2024 13:36:28 +0000 (15:36 +0200)]
repart: Don't set filesystem sector size to 512

We want to use 4K as the default sector size for filesystems so they
don't have to be regenerated to work on 512, 2048 or 4096 sector sizes.

(cherry picked from commit d34361149f897eac5c6a41854fa4edca4804b49b)

17 months agorepart: Log more about filesystem sector size
Daan De Meyer [Fri, 28 Jun 2024 17:36:50 +0000 (19:36 +0200)]
repart: Log more about filesystem sector size

(cherry picked from commit 0e445aaa8553ff4ddf8330913260e5f167b1690d)

17 months agocore/unit: follow merged units before updating SourcePath= timestamp too
Mike Yuan [Fri, 28 Jun 2024 13:32:33 +0000 (15:32 +0200)]
core/unit: follow merged units before updating SourcePath= timestamp too

Currently, we only follow merged units for unit_load_dropin() call.
But if the unit is an alias, we should always perform operations
on the "canonical" unit.

(cherry picked from commit 740cd1e0f2ae5cc1a10d2111d63cc4e975761091)

17 months agomeson: use less verbose quoting
Zbigniew Jędrzejewski-Szmek [Fri, 28 Jun 2024 16:52:59 +0000 (18:52 +0200)]
meson: use less verbose quoting

(cherry picked from commit c96cb64dce2e15f50253b34538662845e25e8d1c)

17 months agoTEST-54-CREDS: Use UEFI firmware if available
Daan De Meyer [Fri, 28 Jun 2024 14:22:15 +0000 (16:22 +0200)]
TEST-54-CREDS: Use UEFI firmware if available

On aarch64, SMBIOS is only available when using UEFI, so let's make
sure that the creds test uses UEFI when available so that it can
read creds from SMBIOS when running in a virtual machine.

(cherry picked from commit 436474dd4348d5f12f70d9032d1cc45171b335e7)

17 months agoTEST-18-FAILUREACTION: Set auto firmware
Daan De Meyer [Fri, 28 Jun 2024 14:21:51 +0000 (16:21 +0200)]
TEST-18-FAILUREACTION: Set auto firmware

This test runs in nspawn by default but will still run in qemu when
tests are run unprivileged so make sure we use UEFI if available to
avoid hangs when using the linux firmware.

(cherry picked from commit f392be9e7756268fc1b9d5204adc642bee10c8fa)

17 months agoTEST-09-REBOOT: Set auto firmware
Daan De Meyer [Fri, 28 Jun 2024 14:19:38 +0000 (16:19 +0200)]
TEST-09-REBOOT: Set auto firmware

This test runs in nspawn by default but will still run in qemu when
tests are run unprivileged so make sure we use UEFI if available to
avoid hangs when using the linux firmware.

(cherry picked from commit 3cf38516bb765126fee80fed6d984ae963d075de)

17 months agoTEST-06-SELINUX: Explicitly pull in autorelabel.service
Daan De Meyer [Fri, 28 Jun 2024 13:50:35 +0000 (15:50 +0200)]
TEST-06-SELINUX: Explicitly pull in autorelabel.service

(cherry picked from commit 7c04137a6f09f8536ea3dfb667bd5a862fe945f1)

17 months agoTEST-70-TPM2: Use UEFI firmware if available
Daan De Meyer [Fri, 28 Jun 2024 13:28:16 +0000 (15:28 +0200)]
TEST-70-TPM2: Use UEFI firmware if available

On x86 this doesn't matter but on aarch64 we need to make sure UEFI
is used so that /sys/kernel/security/tpm0/binary_bios_measurements
is there which is required for TEST-70-TPM2.

(cherry picked from commit 98f2a332cb1a3efc3b2e8a5914a895a0a051bda4)

17 months agoresolved: correct parsing of OPT extended RCODEs
James Coglan [Fri, 28 Jun 2024 12:58:22 +0000 (13:58 +0100)]
resolved: correct parsing of OPT extended RCODEs

The DNS_PACKET_RCODE() function works out the full RCODE by taking the
first octet from the OPT record TTL field and bitwise-OR-ing this with
the basic RCODE from the packet header. This results in RCODE values
being lower than they should be.

For example, if the first TTL octet is 0x7a and the basic RCODE is 3,
this function currently returns `0x7a | 3` = 123, rather than 0x7a3 =
1955.

The first TTL octet is supposed to form the upper 8 bits of a 12-bit
value, whereas the current implementation constraints the value to 8
bits and results in mis-interpreted RCODEs.

This fixes things by shifting the TTL 20 places instead of 24 and
masking off the low nibble that comes from the upper bits of the version
octet.

Note that dns_packet_append_opt() correctly converts the input RCODE
into the high octet of the OPT TTL field; this problem only affects
parsing of incoming packets.

(cherry picked from commit c40f3714c9a4d1f2bcd308625c9c835892e3d41c)

17 months agoTEST-45-TIMEDATE: Use syslog identifier journalctl match
Daan De Meyer [Fri, 28 Jun 2024 12:51:10 +0000 (14:51 +0200)]
TEST-45-TIMEDATE: Use syslog identifier journalctl match

Using a unit match is racy whereas a syslog identifier match is
reliable.

(cherry picked from commit 24284098a4613e626368ebe06ea6e39e49a9bc0f)

17 months agoresolved: allow the full TTL to be used by OPT records
James Coglan [Fri, 28 Jun 2024 12:41:31 +0000 (13:41 +0100)]
resolved: allow the full TTL to be used by OPT records

Whereas RFC 1035 says the TTL field takes the "positive values of a
signed 32 bit number", and RFC 2181 says "Implementations should treat
TTL values received with the most significant bit set as if the entire
value received was zero,", the dns_packet_read_rr() function sets
rr->ttl to zero if the MSB is set.

However, EDNS(0) as specified in RFC 6891 repurposes the TTL field's 4
octets to store other information, c.f.:

                  +0 (MSB)                            +1 (LSB)
       +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
    0: |         EXTENDED-RCODE        |            VERSION            |
       +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
    2: | DO|                           Z                               |
       +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

The first octet extends the usual 4-bit RCODE from the packet header by
providing an additional 8 bits of space, extending the RCODE to 12 bits.
But, our handling of the TTL field means that the high bit in the first
octet is not actually usable, since setting it will mean these 4 octets
are replaced with 0. This may have the effect of making us believe a
server does not support DNSSEC when it actually set the DO bit in its
OPT record.

Here we change things so that the TTL is only set to zero for record
types other than OPT.

(cherry picked from commit 131787979c700becaf6ec24a810658d1313587cc)

17 months agoTEST-64-UDEV-STORAGE: Make nvme_subsystem expected pci symlinks more generic
Daan De Meyer [Fri, 28 Jun 2024 12:20:34 +0000 (14:20 +0200)]
TEST-64-UDEV-STORAGE: Make nvme_subsystem expected pci symlinks more generic

When running the test on aarch64 the symlinks look as follows:

"""
[root@H ~]# ls /dev/disk/by-path
platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0       platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part1  platform-4010000000.pcie-pci-0000:00:05.0-nvme-16
platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part  platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part2  platform-4010000000.pcie-pci-0000:00:05.0-nvme-17
"""

So let's make the PCI patterns a little more generic so they match
both the x86 and the aarch64 paths.

(cherry picked from commit 72d121b60174b825bf1390958eb1b55f34c5ff5b)

17 months agoLICENSES/README: expand text to summarize state for binaries and libs
Zbigniew Jędrzejewski-Szmek [Fri, 28 Jun 2024 11:22:40 +0000 (13:22 +0200)]
LICENSES/README: expand text to summarize state for binaries and libs

We would say how *sources* are licensed, but actually most user care about the
resulting binaries. So say how the *binaries* are licensed. I used the word
"effectively" because the permissive licenses don't set any requirements on the
binaries, so the license of sources is a complex mix, but the resulting
binaries have a simple effective license.

Also, make it clear that the GPLv2 license applies to udev programs, but not
the shared library. Based on private correspondence, there's some confusion
about this.

(cherry picked from commit bd7236912f373e0a06a1b0395000ec67d96767af)

17 months agotest: pull in multi-user.target explicitly
Daan De Meyer [Fri, 28 Jun 2024 11:34:37 +0000 (13:34 +0200)]
test: pull in multi-user.target explicitly

Let's make sure we pull in multi-user.target so that we get a console
when a test fails and we're running meson test with --interactive.

(cherry picked from commit 32f3617fd700e4a98b35f8c28a2807c2e51a2d9f)

17 months agoTEST-64-UDEV-STORAGE: Fix python 3.9 compatibility
Daan De Meyer [Fri, 28 Jun 2024 10:51:46 +0000 (12:51 +0200)]
TEST-64-UDEV-STORAGE: Fix python 3.9 compatibility

Using double quotes in f-strings only works from python 3.12 onwards.
Use single quotes to make sure python 3.9 works as well.

Also clean up quotes a little in general.

(cherry picked from commit 4e469c0af2e92914b324f0fb48cf4462caff5c86)

17 months agoTEST-64-UDEV-STORAGE: Use bus pci slot 1 instead of 0
Daan De Meyer [Fri, 28 Jun 2024 10:50:49 +0000 (12:50 +0200)]
TEST-64-UDEV-STORAGE: Use bus pci slot 1 instead of 0

Trying to use bus pci slot 0 fails on aarch64 so let's use 1 instead.

The error:

"""
qemu-system-aarch64: -device virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25: Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.
"""

(cherry picked from commit 7f07f9c8cdbcca3b57e40143e86e7179420d39db)

17 months agoTEST-58-REPART: reverse order of diff args
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2024 09:33:20 +0000 (11:33 +0200)]
TEST-58-REPART: reverse order of diff args

I expect the test output to be the second argument, so we're diffing "expected"
and "output", not the other way around.

I noticed this when working on https://github.com/systemd/systemd/pull/33081.

(cherry picked from commit 6bb3ea655d08c0602c99ccd2a580ba102fd19114)

17 months agoman/tmpfiles: remove outdated behavior regarding symlink ownership
Giovanni Baratta [Thu, 27 Jun 2024 11:35:12 +0000 (13:35 +0200)]
man/tmpfiles: remove outdated behavior regarding symlink ownership

Update the man page of tmpfiles.d to remove outdated comments regarding the behavior of ownership with symlinks.
The behavior has been changed in this commit 51207ca134716a0dee5fd763a6c39204be849eb1

(cherry picked from commit d108198f395fde05d94fc75d8581af4aa0de7e4a)

17 months agotest-mountpoint-util: add a test for bind mounted symlinks
Mike Yuan [Thu, 27 Jun 2024 10:17:12 +0000 (12:17 +0200)]
test-mountpoint-util: add a test for bind mounted symlinks

(cherry picked from commit b917e5b06bf466b34edf4002aed98494a331e4d0)

17 months agomountpoint-util: do not assume symlinks are not mountpoints
Mike Yuan [Wed, 26 Jun 2024 16:11:30 +0000 (18:11 +0200)]
mountpoint-util: do not assume symlinks are not mountpoints

They very much can be with the new mount API.

(cherry picked from commit 36e48f22af102843b6cceeda5a2292e57434d2ee)

17 months agohostnamed: if polkit authentication fails for Varlink Describe() call, don't reply...
Lennart Poettering [Thu, 27 Jun 2024 08:09:45 +0000 (10:09 +0200)]
hostnamed: if polkit authentication fails for Varlink Describe() call, don't reply to client with an error

The logic of the Describe() call was supposed to be: if we can acquire
the PK priv to get the product UUID then let's return the product UUID,
and if we cannot then return the data without it.

This didn't work however, since the polkit varlink glue would
immediately propagate the error it acquired from polkit its own client.
Let's turn this off, optionally, so that hostnamed can handle this
nicely.

(cherry picked from commit b6464e80d65fd5bfd9e6206ee305f0da9c88c096)

17 months agocore/exec-invoke: use sched_setattr instead of sched_setscheduler
Florian Schmaus [Wed, 26 Jun 2024 12:37:52 +0000 (14:37 +0200)]
core/exec-invoke: use sched_setattr instead of sched_setscheduler

The kernel's sched_setattr interface allows for more control over a processes
scheduling attributes as the previously used sched_setscheduler interface.

Using sched_setattr is also the prerequisite for support of utilization
clamping (UCLAMP [1], see #26705) and allows to set sched_runtime. The latter,
sched_runtime, will probably become a relevant scheduling parameter of the
EEVDF scheduler [2, 3], and therefore will not only apply to processes
scheduled via SCHED_DEADLINE, but also for processes scheduled via
SCHED_OTHER/SCHED_BATCH (i.e., most processes).

1: https://docs.kernel.org/next/scheduler/sched-util-clamp.html
2: https://lwn.net/Articles/969062/
3: https://lwn.net/ml/linux-kernel/20240405110010.934104715@infradead.org/
(cherry picked from commit 016e9d8d08ce66f5e81b42e0a0db398afc17336a)

17 months agocryptsetup: improve TPM2 blob display
Kamil Szczęk [Tue, 25 Jun 2024 15:44:53 +0000 (17:44 +0200)]
cryptsetup: improve TPM2 blob display

Just a tiny change to fix an eyesore in cryptsetup luksDump display :)

(cherry picked from commit 0828c6a2bf9aa40a6cf5fcb3d5650130c483ac8a)

17 months agoutil: make file_read() 64bit offset safe
Lennart Poettering [Wed, 26 Jun 2024 13:43:28 +0000 (15:43 +0200)]
util: make file_read() 64bit offset safe

File offsets in UEFI are 64bit on all archs, hence let's use that typo
too, and not create artificial confusion around types.

(cherry picked from commit 9573ab8f5a1e2dfdb3542aa647868ff73ced7dd2)

17 months agoman/capsule@.service: the capsule user is prefixed with "c-" rather than "p_"
Mike Yuan [Wed, 26 Jun 2024 14:47:48 +0000 (16:47 +0200)]
man/capsule@.service: the capsule user is prefixed with "c-" rather than "p_"

(cherry picked from commit 6343d2ea504661a009df25932fde0ccec15e38d1)

17 months agoman/capsule@.service.xml: fix typo
Carlo Teubner [Wed, 26 Jun 2024 14:39:53 +0000 (15:39 +0100)]
man/capsule@.service.xml: fix typo

(cherry picked from commit 6733d691bb96f926b380fe37aa371b9558b08384)

17 months agonspawn, vmspawn: honor the new window title switch
Mantas Mikulėnas [Mon, 17 Jun 2024 11:22:51 +0000 (14:22 +0300)]
nspawn, vmspawn: honor the new window title switch

(cherry picked from commit 0bdaa998272da778223ca1965a903c258fcbbfcd)

17 months agorun: add environment variable to prevent the setting of terminal title
Mantas Mikulėnas [Mon, 17 Jun 2024 09:41:56 +0000 (12:41 +0300)]
run: add environment variable to prevent the setting of terminal title

This goes together with the existing SYSTEMD_TINT_BACKGROUND.

Closes https://github.com/systemd/systemd/issues/33301

(cherry picked from commit 27a2513013d3b3c6140de47e04b3042c5b4487e5)

17 months agotest-execute: add a test case for issue #33299
Yu Watanabe [Sun, 23 Jun 2024 06:52:53 +0000 (15:52 +0900)]
test-execute: add a test case for issue #33299

(cherry picked from commit 956a9f00b444145ebc5ddc7c5cefb0a6c9c7ca8f)

17 months agocore: do not filter out write() if required in the very late stage
Yu Watanabe [Mon, 24 Jun 2024 20:10:04 +0000 (05:10 +0900)]
core: do not filter out write() if required in the very late stage

Before 12001b1bf067339db089d52e08fd0b4c6a9945df, write() is required for
if Type=exec. However, with the previous commit, now write() is also used
for sending handoff timestamp. Let's allow write() if necessary.

Fixes a regression caused by 12001b1bf067339db089d52e08fd0b4c6a9945df.
Fixes #33299.

(cherry picked from commit 84b79215ccc5abd6ee50ffd9df34dbbe2d29d625)

17 months agocore: use write() to send handoff timestamp
Yu Watanabe [Sun, 23 Jun 2024 06:15:30 +0000 (15:15 +0900)]
core: use write() to send handoff timestamp

Before 12001b1bf067339db089d52e08fd0b4c6a9945df, the timestamp is sent
with write(), but the commit made the timestamp sent by send(), and
causes regressin #33299.

Note the invocation will still fail if write() is filtered by seccomp.
But, that is an old issue since Type=exec is introduced
(5686391b006ee82d8a4559067ad9818e3e631247).

Partially fixes a regression caused by 12001b1bf067339db089d52e08fd0b4c6a9945df.
Partially fixes #33299.

(cherry picked from commit 5161422bb5b0cc47100163ea690252c90159b354)

17 months agoseccomp-util: split out seccomp_filter_set_add_by_name()
Yu Watanabe [Mon, 24 Jun 2024 20:08:17 +0000 (05:08 +0900)]
seccomp-util: split out seccomp_filter_set_add_by_name()

(cherry picked from commit b89a262eb57f18c2dbf6c1ee7427b6f6fd8203cf)

17 months agoFix typo in CAP_BPF description (#33464)
Eugeny Shcheglov [Mon, 24 Jun 2024 18:23:50 +0000 (21:23 +0300)]
Fix typo in CAP_BPF description (#33464)

description_good and description_bad are mixed up. Disabling CAP_BPF results in the inability to load BPF, not the other way around.

(cherry picked from commit 1750e30d237e6d9cdebc6b546d0a26342828dbd1)

17 months agotest-network: check if static routes not overridden by NDisc routes
Yu Watanabe [Sun, 23 Jun 2024 05:37:01 +0000 (14:37 +0900)]
test-network: check if static routes not overridden by NDisc routes

(cherry picked from commit 62fb079a3b4a6553d87d06a3004d21b4e322a4e5)

17 months agonetwork/ndisc: do not remove static routes when received RA with zero lifetime
Yu Watanabe [Mon, 24 Jun 2024 07:20:27 +0000 (16:20 +0900)]
network/ndisc: do not remove static routes when received RA with zero lifetime

Similar to the previous commit, but for preventing from removing static
routes on receiving RA with zero lifetime.

Fixes a regresson caused by 479d3e1994a2e4ff7070dc2a0cb1615af7120b0c.
Fixes #33346.

(cherry picked from commit fd436c8d67e75eebd0ef9499f699524e4cbe2a92)

17 months agonetwork/ndisc: do not override conflicting static routes
Yu Watanabe [Sun, 23 Jun 2024 05:36:08 +0000 (14:36 +0900)]
network/ndisc: do not override conflicting static routes

We have already ignored conflicting address configurations requested by
NDisc protocol. See ndisc_request_address().
Let's follow the same rule for routes. That is, if there are conflicting
static routes configured or requested, do not override them by NDisc.

Also, swap the order of checking existing route and existing request.

Fixes a regression caused by 972f1d17ab461a51142a142609dd3ec50bae8440.
Prompted by #33346.

(cherry picked from commit 7af3e8cd0034a6eb2e614b052c94c6d0b4556e98)

17 months agocore/exec-invoke: reopen OpenFile= fds with O_NOCTTY
Mike Yuan [Mon, 24 Jun 2024 16:26:15 +0000 (18:26 +0200)]
core/exec-invoke: reopen OpenFile= fds with O_NOCTTY

(cherry picked from commit b9c5d812d5132ea1d6a7146be80d41ae2ccb288e)

17 months agocore: verify WorkingDirectory= is outside of API VFS only under mount namespacing
Mike Yuan [Sun, 23 Jun 2024 16:12:33 +0000 (18:12 +0200)]
core: verify WorkingDirectory= is outside of API VFS only under mount namespacing

The purpose of the check is to prevent leaking API VFS fds
from host into a mount namespace/container. When mountns
is not used at all, the check is pointless and causes
inconvenience. E.g. file managers might need to be spawned
under those directories, and they surely won't run in mountns.

Suggested in https://github.com/systemd/systemd/pull/33454#issuecomment-2186351467
Fixes #33361

(cherry picked from commit 276bd392ecdd6febaeac82e7d6f46a035826f98d)

17 months agoterminal-util: use colon as separator for specifying color
Yu Watanabe [Mon, 24 Jun 2024 08:55:17 +0000 (17:55 +0900)]
terminal-util: use colon as separator for specifying color

Then, terminal will safely ignore unsupported features, like colored
underline.

Fixes a regression caused by 891abc9cf1d3d7afd7b740b4077551dcfb5f8e16.
Fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1074073.
Fixes #33449.

(cherry picked from commit 6eabe9f2ff48c1b6924724d5afe64e7b661ccdbf)

17 months agoman: fix double is typo in systemd-tmpfiles
Diego Viola [Sat, 22 Jun 2024 02:46:32 +0000 (23:46 -0300)]
man: fix double is typo in systemd-tmpfiles

Signed-off-by: Diego Viola <diego.viola@gmail.com>
(cherry picked from commit a78394a49a3bc8eedb9fc2df10c41765bd823c8e)

17 months agotest: skip test-cgroup-id on ENOSYS from cg_cgroupid_open
Nick Rosbrook [Thu, 20 Jun 2024 15:27:03 +0000 (11:27 -0400)]
test: skip test-cgroup-id on ENOSYS from cg_cgroupid_open

Most container managers will block open_by_handle_at with seccomp to
mitigate a container escape attack. LXD in particular returns ENOSYS
rather than e.g. EPERM like nspawn. Skip this test if we get ENOSYS
from open_by_handle_at via cg_cgroupid_open.

(cherry picked from commit 82f57401d933596746c32a955773bc70be53b0ac)

17 months agomeson: bpf: propagate 'sysroot' for cross compilation
Johannes Schneider [Thu, 20 Jun 2024 10:32:18 +0000 (12:32 +0200)]
meson: bpf: propagate 'sysroot' for cross compilation

During cross-compilation of systemd, the compiler used to build the bpf's needs
to be pointed at the correct include searchpath. Which can be done by passing
the corresponding directory in through the cflags; for example in yocto/bitbake
this would work: CFLAGS += "--sysroot=${STAGING_DIR_TARGET}"

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
(cherry picked from commit b608bf5620765de20851eca55cbd6c42ce1af450)

17 months agokernel-install: correct the place where it works in man and help text
Antonio Alvarez Feijoo [Wed, 19 Jun 2024 12:41:55 +0000 (14:41 +0200)]
kernel-install: correct the place where it works in man and help text

(cherry picked from commit 111f9889927d75b82264fcaf59b99b879a4a8a26)

17 months agoman/systemd.exec: list inaccessible files for ProtectKernelTunables
Maximilian Wilhelm [Wed, 19 Jun 2024 11:41:39 +0000 (13:41 +0200)]
man/systemd.exec: list inaccessible files for ProtectKernelTunables

(cherry picked from commit 163bb43ceaa1e5bdcda27c4417339b3af9cf28af)

17 months agoUse consistent spelling of systemd.condition_first_boot argument
pyfisch [Tue, 18 Jun 2024 20:22:15 +0000 (22:22 +0200)]
Use consistent spelling of systemd.condition_first_boot argument

(cherry picked from commit 051d462b42fe6c27824046c15cd3c84fa5afe05b)

17 months agologin/user-runtime-dir: free ignored sd_bus_error, avoid triggering assertion
Mike Yuan [Tue, 18 Jun 2024 14:32:14 +0000 (16:32 +0200)]
login/user-runtime-dir: free ignored sd_bus_error, avoid triggering assertion

Fixes #33388

(cherry picked from commit 909ba6907032caee1157a3e3afd53640798ea817)

17 months agologin/user-runtime-dir: use STRLEN where appropriate
Mike Yuan [Tue, 18 Jun 2024 14:31:12 +0000 (16:31 +0200)]
login/user-runtime-dir: use STRLEN where appropriate

Also, add missing trailing / to paths used in STRLEN/sizeof.

(cherry picked from commit 0b8a714b2bb69cba68daec4f742c1b85bbafbdb1)

17 months agopretty-print: take console glyph width into account when drawing progress bar
Lennart Poettering [Fri, 24 May 2024 11:56:10 +0000 (13:56 +0200)]
pretty-print: take console glyph width into account when drawing progress bar

So far this used string length, not character width. Fix that.

(cherry picked from commit 1ad4e37da164041605d18c28ee1868cf942f7857)

17 months agomkosi: add support for TEST_SAVE_JOURNAL to integration test wrapper
Luca Boccassi [Mon, 24 Jun 2024 14:20:11 +0000 (15:20 +0100)]
mkosi: add support for TEST_SAVE_JOURNAL to integration test wrapper

Same variable and values as supported by the shell suite

(cherry picked from commit 59d4970a552cbc30d7977bdc9eca756b41260875)

17 months agosemaphore: pin packaging to ci/v256/stable branch
Luca Boccassi [Thu, 4 Jul 2024 22:32:43 +0000 (23:32 +0100)]
semaphore: pin packaging to ci/v256/stable branch

The packaging in debian/master is no longer compatible with v256-stable
so switch it

17 months agotest: skip TEST-69-SHUTDOWN on Debian
Luca Boccassi [Thu, 4 Jul 2024 00:01:08 +0000 (01:01 +0100)]
test: skip TEST-69-SHUTDOWN on Debian

There is a regression in the login package, skip the test until
it is fixed. https://bugs.debian.org/1075733

(cherry picked from commit 92d9d5ca70b0a8b3aea12f24e9cd0f770c31a94c)

17 months agomeson: Bump version to 256.2~devel
Daan De Meyer [Thu, 4 Jul 2024 09:01:44 +0000 (11:01 +0200)]
meson: Bump version to 256.2~devel

We need this so the packages built in CI are considered more recent
than the stable releases shipped by distributions.

17 months agomeson: Fix various versions
Daan De Meyer [Thu, 4 Jul 2024 12:44:21 +0000 (14:44 +0200)]
meson: Fix various versions

Follow up for 8b3b01c4b7e0fde39b4be354990ee68f5e612c52

We switch to PROJECT_VERSION instead of PROJECT_VERSION_FULL where
we report our version and which is likely being parsed to avoid
breaking compat. If we didn't, the output would change from systemd
255 to systemd 255.1 which could break various tools.

(cherry picked from commit 6a4fcf8cefceba151e11f85e784c8962b6fc383b)

17 months agosrc/boot/efi/meson.build: ensure VERSION_TAG exists in case of cross build
Chen Qi [Thu, 4 Jul 2024 06:18:41 +0000 (23:18 -0700)]
src/boot/efi/meson.build: ensure VERSION_TAG exists in case of cross build

The GIT_VERSION is changed to use VERSION_TAG, but in case of cross build
for src/boot/efi, it's not set, causing build error because the compiler cannot
know it's a macro thus treating it as some variable and error out.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
(cherry picked from commit 646ed5af0013accacac1f4ac048371bebec52f60)

17 months agomkosi: Build a disk image by default again
Daan De Meyer [Thu, 4 Jul 2024 10:13:31 +0000 (12:13 +0200)]
mkosi: Build a disk image by default again

Now that we have a way to rebuild and reinstall systemd without
having to rebuild the image, let's default to building a disk image
again.

(cherry picked from commit 96110261ee7716bf19a6920a4206365614ad3857)

17 months agomeson: Deal with potential stable versions
Daan De Meyer [Thu, 4 Jul 2024 09:12:35 +0000 (11:12 +0200)]
meson: Deal with potential stable versions

The meson.version file might contain e.g. 256.2~devel in a stable
branch so let's make sure we deal with that.

(cherry picked from commit 8b3b01c4b7e0fde39b4be354990ee68f5e612c52)

17 months agomkosi: bump to latest commit
Luca Boccassi [Wed, 26 Jun 2024 14:21:14 +0000 (15:21 +0100)]
mkosi: bump to latest commit

(cherry picked from commit ea6376d17f4475d470925adfe7bf1bac577e96b2)

17 months agomkosi: Switch back to btrfs
Daan De Meyer [Thu, 27 Jun 2024 10:08:51 +0000 (12:08 +0200)]
mkosi: Switch back to btrfs

Now that we're running on Noble instead of Jammy btrfs has the temp_fsid
feature which means we can mount the same image multiple times so let's
switch back to btrfs instead of ext4 as the filesystem as btrfs properly
records timestamps when building filesystems from a root directory unlike
ext4.

(cherry picked from commit 93440db8b5eae1244aaf5fecfa68050a8b26f3e3)

17 months agomkosi: Install btrfs-progs on CentOS as well
Daan De Meyer [Thu, 27 Jun 2024 13:45:44 +0000 (15:45 +0200)]
mkosi: Install btrfs-progs on CentOS as well

(cherry picked from commit 48e7d0e91e1c9d86c660a67a8ca29aa79deee33d)

17 months agomkosi: Enable hyperscale-packages-experimental for CentOS
Daan De Meyer [Thu, 27 Jun 2024 10:49:59 +0000 (12:49 +0200)]
mkosi: Enable hyperscale-packages-experimental for CentOS

This gets us a kernel with btrfs support.

(cherry picked from commit 6f1f13ca9f8db424c613332ec4739e53b2db6fdf)

17 months agomkosi: Drop leftover systemd-coredump-debuginfo package for opensuse
Daan De Meyer [Thu, 27 Jun 2024 08:14:32 +0000 (10:14 +0200)]
mkosi: Drop leftover systemd-coredump-debuginfo package for opensuse

The package was merged into the main systemd package in
https://src.opensuse.org/rpm/systemd/commit/23bfa9d83b6e24a5395a704b816a351f3dc5b5316e580cacedd1b5d9e068c117.

(cherry picked from commit 21942c008e6540f2ff905a2c6de35475037e734b)

17 months agomkosi: Drop s390x console patch from opensuse spec
Daan De Meyer [Thu, 27 Jun 2024 07:49:40 +0000 (09:49 +0200)]
mkosi: Drop s390x console patch from opensuse spec

This patch does not apply anymore on upstream, so let's remove it
from the spec before building until the spec is fixed.

(cherry picked from commit f92a005cd13ee1df95f3ea16e421f7757fb0f424)

17 months agomkosi: use new standalone-shutdown package for debian's exitrd
Luca Boccassi [Wed, 26 Jun 2024 14:21:33 +0000 (15:21 +0100)]
mkosi: use new standalone-shutdown package for debian's exitrd

(cherry picked from commit efd5314c5036cc41f3dde0e2ef33c3cbd4314e3f)

17 months agomkosi: update debian commit reference
Daan De Meyer [Tue, 25 Jun 2024 14:18:02 +0000 (16:18 +0200)]
mkosi: update debian commit reference

3b4368d4b8 d/not-installed: fix shutdown.standalone path
2de05155e8 Update changelog for 256.1-2 release
cd98bcef06 autopkgtest: add dependency on libcryptsetup-dev in unit-tests suite
e220ce22f1 Bump breaks/replaces to conflicts for DEP17

(cherry picked from commit 0d40269e5a71d56734eeb30e41fc74c3c0bea7d4)

17 months agomkosi: bump Debian Salsa commit to latest
Luca Boccassi [Sun, 23 Jun 2024 09:20:27 +0000 (10:20 +0100)]
mkosi: bump Debian Salsa commit to latest

(cherry picked from commit 8a91a43197b63e84f6a7439585204a36c70040ba)

17 months agomkosi: install new split-out systemd packages
Luca Boccassi [Sun, 23 Jun 2024 09:10:26 +0000 (10:10 +0100)]
mkosi: install new split-out systemd packages

repart and cryptsetup tools were moved out of the main package
to reduce dependencies.

(cherry picked from commit 621a7fe0647eca4ced4914c1c9beb569678b304b)

17 months agomkosi: update arch commit reference
Daan De Meyer [Wed, 3 Jul 2024 06:23:29 +0000 (08:23 +0200)]
mkosi: update arch commit reference

d74b24c7c6 meson options: vcs-tag=false
7424fedef0 upgpkg: 256.1-1: new upstream release
6016864c99 upgpkg: 256-3: rebuild to fix man pages...
6f6d48b221 upgpkg: 256-2: update shells
b9ce44e766 drop systemd-stable repository, build from main one
baf4803252 upgpkg: 256-1: new upstream release
1d75e7ddaa add an install hint on NEWS
6f17a23127 Ups, inverted...
d76029f7cc update meson options
6e7929dd98 upgpkg: 256rc4-1: new upstream pre-release - testing only!
7b70e7b0e7 upgpkg: 256rc3-2: fast-forward to current git main, non-official testing
a438b879e2 upgpkg: 256rc3-1: new upstream pre-release, non-official testing
ff30a600c9 upgpkg: 256rc2-1: new upstream pre-release, non-official testing

(cherry picked from commit cd98453908a9a2e2c7c0dc3064599c8b2184431a)

17 months agomkosi: switch opensuse to devel branch
Luca Boccassi [Wed, 26 Jun 2024 14:52:23 +0000 (15:52 +0100)]
mkosi: switch opensuse to devel branch

The factory branch seems to have been reset to 9 years ago, switch
to devel

(cherry picked from commit 582718d959c66e3e7108310662ec8ae587ae6862)

17 months agomkosi: update fedora commit reference
Daan De Meyer [Wed, 3 Jul 2024 06:21:31 +0000 (08:21 +0200)]
mkosi: update fedora commit reference

f9fe17dbde Use vmlinux.h from kernel-devel
9cbad936a6 Pull in openssl-devel-engine
8ae009f929 Only add Requires on python3-zstd on Fedora
750e910c7c Drop BuildRequires on python3-zstd

(cherry picked from commit 6bd14bf4b3ec85101ba6ce75a4292d61066a5e68)

17 months agomkosi: update fedora commit reference
Daan De Meyer [Tue, 25 Jun 2024 14:34:28 +0000 (16:34 +0200)]
mkosi: update fedora commit reference

8153d9b0f9 Revert "Remove tmpfiles snippet for /home and /srv"
a76669ee22 Remove tmpfiles snippet for /home and /srv
b3e1d52cb4 Soft-disable tmpfiles --purge until a good use case comes up
4a29ab3f3b Version 256.1
ebf352d292 disable auto-features when bootstrapping
1ae0516ae7 Version 256
b32641170e Restore patch to drop varlink method call
421f0041b3 Version 256~rc4
65d9b49791 Fix typo
c56891fb68 Drop sysusers.d/basic.conf
69472997b9 Renumber sources and make order more consistent

(cherry picked from commit b6a9ad2c62fef8da07d4feb2c0190b4176b2b7b9)

17 months agomkosi: Install zypper in opensuse images
Daan De Meyer [Wed, 3 Jul 2024 20:48:37 +0000 (22:48 +0200)]
mkosi: Install zypper in opensuse images

(cherry picked from commit 18c98a839fc589d80eb256428f9eb091bb028171)

17 months agomkosi: Fix sync script git command
Daan De Meyer [Wed, 3 Jul 2024 20:18:07 +0000 (22:18 +0200)]
mkosi: Fix sync script git command

Let's make sure we actually operate on the packaging git repo.

(cherry picked from commit d1bbeeea4cd9317ad5915c99641aa9d82c4bc37d)

17 months agomkosi: Clean up old packages from the build directory
Daan De Meyer [Wed, 3 Jul 2024 18:20:31 +0000 (20:20 +0200)]
mkosi: Clean up old packages from the build directory

(cherry picked from commit 2f6046f66b61e4f12a53d6d93dcd59f25971ccf6)

17 months agomkosi: remove conflicting deb packages from builddir
Luca Boccassi [Wed, 3 Jul 2024 18:15:03 +0000 (19:15 +0100)]
mkosi: remove conflicting deb packages from builddir

These are not actually needed or installed, so delete them from the
build directory, so that inside an image one can do:

apt install --reinstall /work/build/*.deb

Follow-up for 690a85b1d4e794af62bca6d1ea530ffc530ee58c

(cherry picked from commit ce513c6c6cfbb52dd4736f8074b61d2dfdb2417d)

17 months agomkosi: Copy packages to the build directory as well
Daan De Meyer [Wed, 3 Jul 2024 12:28:21 +0000 (14:28 +0200)]
mkosi: Copy packages to the build directory as well

With the latest mkosi, mkosi -t none can be used to rerun the build
script without messing with a previously built image. This allows
one to run "mkosi -t disk -f qemu" in one terminal to build and boot
an image in qemu and then run "mkosi -t none" in another terminal to
rebuild the packages. If one then has "RuntimeBuildSources=yes" set
in their mkosi configuration, the build directory is mounted into the
virtual machine, which means that one can then run "dnf upgrade
/work/build/*.rpm" from within the VM to install the new packages.

This allows for quickly iterating on changes without having to rebuild
the image all the time.

We'll probably want to document this at some point, but let's start
with making it possible by copying the built packages to the build directory.

(cherry picked from commit 690a85b1d4e794af62bca6d1ea530ffc530ee58c)

17 months agomkosi: Make sure we don't hide errors from git merge-base
Daan De Meyer [Wed, 3 Jul 2024 11:19:34 +0000 (13:19 +0200)]
mkosi: Make sure we don't hide errors from git merge-base

Currently if git merge-base fails we'll hide the error and exit with
exit status 0. Let's make we only exit early if git merge-base exits
with 1 which indicates the current commit is not on the target branch.
Any other error is considered fatal.

(cherry picked from commit 2fe6ad5a64bca187712708d41269091c91500a35)

17 months agomkosi: Install perf
Daan De Meyer [Tue, 2 Jul 2024 13:46:09 +0000 (15:46 +0200)]
mkosi: Install perf

It's already installed on ubuntu via linux-tools-common.

(cherry picked from commit cca8c15599b888fc757d7e17a8a8949bca522447)

17 months agomkosi: Install pciutils
Daan De Meyer [Fri, 28 Jun 2024 11:41:12 +0000 (13:41 +0200)]
mkosi: Install pciutils

(cherry picked from commit 3cdc8da5ad4beb9bdb06e9c6ca3544da410454ce)

17 months agomkosi: move variable to the right scope
Zbigniew Jędrzejewski-Szmek [Thu, 6 Jun 2024 11:23:17 +0000 (13:23 +0200)]
mkosi: move variable to the right scope

(cherry picked from commit 3690971cd0d11749e82bc1cb69d5a1e80284ab46)

17 months agomkosi: Don't touch the packaging checkout if work is being done
Daan De Meyer [Tue, 2 Jul 2024 20:27:01 +0000 (22:27 +0200)]
mkosi: Don't touch the packaging checkout if work is being done

If work is being done in a separate branch, don't touch the packaging
checkout.

(cherry picked from commit 88e92306431bd5928ab4e5c18310e36de9ffa3f6)

17 months agovmspawn: define QEMU_MACHINE_TYPE for loongarch64
Robin Lee [Mon, 24 Jun 2024 05:48:32 +0000 (13:48 +0800)]
vmspawn: define QEMU_MACHINE_TYPE for loongarch64

Use ["virt"](https://www.qemu.org/docs/master/system/loongarch/virt.html) as a commonly used generic platform on loongarch64.

(cherry picked from commit 6efab8c343f0881ad9e1800facb0d08594b025ee)

17 months agovmspawn: define QEMU_MACHINE_TYPE for riscv
Xeonacid [Wed, 19 Jun 2024 09:56:57 +0000 (17:56 +0800)]
vmspawn: define QEMU_MACHINE_TYPE for riscv

Use ["virt"](https://www.qemu.org/docs/master/system/target-riscv.html#board-specific-documentation) as a commonly used generic platform on riscv.

(cherry picked from commit 5f7136a3690cd118eeef3c84dfbd9f5d0df556d6)

17 months agodocs: fix dead link to GNOME documentation
Luca Boccassi [Thu, 27 Jun 2024 16:59:01 +0000 (17:59 +0100)]
docs: fix dead link to GNOME documentation

(cherry picked from commit b22ee1010d4ba2e0049b162483c0f185c367d0bb)

17 months agologs-show: do not use _SOURCE_MONOTONIC_TIMESTAMP field v256.1
Yu Watanabe [Tue, 18 Jun 2024 08:55:31 +0000 (17:55 +0900)]
logs-show: do not use _SOURCE_MONOTONIC_TIMESTAMP field

The timestamp is not in CLOCK_MONOTONIC, but CLOCK_BOOTTIME,
while header monotonic timestamp is in CLOCK_MONOTONIC. Hence, we cannot
adjust timestamp by comparing with header monotonic timestamp and
_SOURCE_MONOTONIC_TIMESTAMP field.

Fixes a regression caused by affde1d7e79a634ee6053dbd4a57b3b51b74c170.
Fixes #33293.

(cherry picked from commit 144498e7e6efe2d90981cb14e3ed462a70a955c6)

17 months agorepart: fix memory leak
Antonio Alvarez Feijoo [Tue, 18 Jun 2024 12:07:50 +0000 (14:07 +0200)]
repart: fix memory leak

(cherry picked from commit a81f5ffd40081441dafc678fe83d185436dde35a)

17 months agomkosi: restrict noble-backports to noble builds
Luca Boccassi [Tue, 18 Jun 2024 12:35:32 +0000 (13:35 +0100)]
mkosi: restrict noble-backports to noble builds

Follow-up for c01cb8cbff8512b65b7903b55f78c8d12661b8d7

(cherry picked from commit f97b243edfcae211aade6ceb2fd89ae9d9209fac)

17 months agotmpfiles: move --purge to command section in --help text where it belongs
Lennart Poettering [Tue, 18 Jun 2024 07:56:15 +0000 (09:56 +0200)]
tmpfiles: move --purge to command section in --help text where it belongs

Also, make contrast between --remove and --purge clearer: one deletes
files marked for deletion, the other deletes files marked for creation.

(cherry picked from commit 69d76823ce6e9c307184946ed55b207eb728e625)

17 months agotmpfiles: insist on at least one configuration file being specified on --purge
Lennart Poettering [Tue, 18 Jun 2024 07:55:20 +0000 (09:55 +0200)]
tmpfiles: insist on at least one configuration file being specified on --purge

Also, extend the man page explanation substantially, matching more
closely what --create says.

Fixes: #33349
(cherry picked from commit 41064a3c97c9a53c97bbe8a1de799a82c4374a2d)

17 months agotmpfiles: honour --dry-run when removing directories
Lennart Poettering [Tue, 18 Jun 2024 07:54:33 +0000 (09:54 +0200)]
tmpfiles: honour --dry-run when removing directories

(cherry picked from commit edeceb80a91e8400e8c22f08a41045a2ba270fe6)

17 months agoinstall: allow removing symlinks even for units that are gone
Luca Boccassi [Fri, 7 Jun 2024 20:39:45 +0000 (21:39 +0100)]
install: allow removing symlinks even for units that are gone

If a symlink is leftover, still allow cleaning it up via 'disable'. This
happens when a unit is stopped and removed, but not disabled, and a reload
has already happened. At that point, cleaning up the old symlinks becomes
impossible through the APIs, and needs to be done manually. Always allow
cleaning up symlinks, if they exist, by only erroring out if there is an
OOM.

Follow-up for f31f10a6207efc9ae9e0b1f73975b5b610914017

(cherry picked from commit 5163c9b1e56293b1bb2803420613c5b374570892)