1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-14 16:58:22 +03:00

69991 Commits

Author SHA1 Message Date
Yu Watanabe
53a26a6756 test: wait for loop/backing_file attribute being removed
Hopefully fixes issue like
https://github.com/systemd/systemd/issues/32680#issuecomment-2120959238
https://github.com/systemd/systemd/issues/32680#issuecomment-2122074805

(cherry picked from commit e504f5a33979c896213f2fb53217b14263cfe036)
2024-05-27 09:52:26 +02:00
Yu Watanabe
1a6a2d8f24 test: wait for unit generated from /proc/self/mountinfo to be unloaded
Fixes https://github.com/systemd/systemd/issues/32680#issuecomment-2120974685.
===
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2475]: + mountpoint /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2476]: /tmp/tmp.eaRV7lSbX2/mnt is not a mountpoint
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2449]: + systemd-mount /dev/loop0 /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 systemd-mount[2477]: Failed to start transient mount unit: Unit tmp-tmp.eaRV7lSbX2-mnt.mount was already loaded or has a fragment file.
===

(cherry picked from commit 4a8ca3c6d595598f64cf532fad2c98ef7481f6a4)
2024-05-27 09:52:26 +02:00
Mike Yuan
ce25cf6df1 man/systemd-run: beef up info regarding interaction between --pty, --pipe, and --wait
(cherry picked from commit d73a47d259be795958c8aa5b65b002f3d7338b6e)
2024-05-27 09:52:26 +02:00
Mike Yuan
46561305cb run: when disconnected from PTY forwarder, exit event loop if not --wait
Follow-up for ade0789fabbf01b95bf54d32f8cab1217a753f03

The change in behavior was partly intentional, as I think
if both --wait and --pty are used, manually disconnecting
from PTY forwarder should not result in systemd-run exiting
with "Finished with ..." log. But we should check for
--wait here.

Closes #32953

(cherry picked from commit 2b4a691c32aadbc45491c8b243ec3cf7ed910f55)
2024-05-27 09:52:26 +02:00
Mike Yuan
867b5a7258 ptyfwd: add missing assertions for pty_forward_new
(cherry picked from commit d735753256c1e0f3e9a4efaab17ba9ee47650403)
2024-05-27 09:52:26 +02:00
Zbigniew Jędrzejewski-Szmek
78e023aa02 shared/mountpoint-util: for old kernels, assume "norecovery" is supported by btrfs
Fixup for e3828d7103a99a15a1e947ba3063294ead590631, as requested in
https://github.com/systemd/systemd/pull/32892#issuecomment-2117903328.

(cherry picked from commit 055b465a3f56f9d53370a47b91af9cc2ffad4470)
2024-05-27 09:52:26 +02:00
Frantisek Sumsal
71ac20d663 test: add a brief comment for the chattr check
Addresses: https://github.com/systemd/systemd/pull/32907#discussion_r1605919598
(cherry picked from commit d3c14f78cd66a498c2ff8a836bfc4f6a110315fe)
2024-05-27 09:52:26 +02:00
Yu Watanabe
d6f9c7b52b test: extend timeout for DHCP/NDisc tests
Fixes https://github.com/systemd/systemd/pull/32932#issuecomment-2120424121.

(cherry picked from commit f8ef1df3d1a9a22ce9d62df3910d4f940ff42a1a)
2024-05-27 09:52:26 +02:00
Luca Boccassi
7204e84152 btrfs-util: add assert to fix Coverity warning
Coverity gets confused since the iterator change, so add an
assert to indicate that this is allocated if n_old_groups is > 0

CID#1545922

Follow-up for 125cca1b51e19d9209a229fca4fb9d94d34c3e78

(cherry picked from commit 5e30e6e28190fe30e76e071b2eb99546abcee7e6)
2024-05-27 09:52:26 +02:00
Yu Watanabe
c496b01d66 btrfs-util: check current offset before read
Fixes #32936.

(cherry picked from commit 125cca1b51e19d9209a229fca4fb9d94d34c3e78)
2024-05-27 09:52:26 +02:00
Yu Watanabe
46eacf705c test: call journalctl --sync just before reading journals
Otherwise, journal entries comes during sleep may not be read.

Follow-up for c22a112883a46e302dae587b809c459647363ceb.

(cherry picked from commit 123acb25605f904c9a52c67f00dfff2b299a7a58)
2024-05-27 09:52:26 +02:00
Luca Boccassi
04a73fa1bc logind: do not fail creating a session when request is not from a unit
When running inside an LXC container the 'su' process will not be part of
any unit or slice.

manager_get_user_by_pid() which was used until v255 (included) does not fail
if it cannot find a unit/slice, but simply returns 'not found'. Do the same
in manager_get_session_by_pidref().

This was not detected as Semaphore CI does not reboot the testbed before
the logind test, so the session is started by the old logind from the base
distro, instead of the one being tested.

Follow-up for 8494f562c8963d8a936b0598e23eab277ff29374
Follow-up for 5099a50d4398e190387d204f5df81cc176bd33e2

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

(cherry picked from commit eb56b564a04b2c34a80bea9ede541c573fb41501)
2024-05-27 09:52:26 +02:00
Luca Boccassi
a2982084ab logind: add one more debug log
Helped track down issue with session tracking

(cherry picked from commit c275e01d99acf502e32f442531902ea000dcd929)
2024-05-27 09:52:26 +02:00
Luca Boccassi
c64e96061b semaphore: use variable for Salsa repo URL
Makes it easier to switch for debuggin

(cherry picked from commit 5002b576d8d3d338df90f7d51543f44dd571f388)
2024-05-27 09:52:26 +02:00
Yu Watanabe
221b2783ba test-network: also set custom altternative name for netdevsim interface
Due to the bug in kernel 6.9 caused by
8debcf5832,
the net_id udev builtin does not work for netdevsim interface.
So, eni99np1 cannot be used with kernel 6.9 anymore.

Workaround for #32910.

(cherry picked from commit f1f1be71feacb3b5d2fb89e2f6421c23b9320fbd)
2024-05-27 09:52:26 +02:00
Yu Watanabe
c047c7e91a test-network: split out setup_netdevsim()
(cherry picked from commit 12e0d6ed38a2f8de0a202d2cdbdbda52a866340d)
2024-05-27 09:52:26 +02:00
Yu Watanabe
41ec2f7038 test: sync journal before starting test
Follow-up for c22a112883a46e302dae587b809c459647363ceb.

Hopefully fixes #32712.

(cherry picked from commit bb84142513be74a953e13d614a9d893a3d45b06d)
2024-05-27 09:52:26 +02:00
Yu Watanabe
c937169b0e machine: fix use-after-free in Rename() DBus method
Fixes a bug introduced by 1ddb263d21099ae42195c2bc382bdf72a7f24f82.

Note, this requires the previous two commits, and cannot backport without them.

Note, before the previous commit, the use-after-free could be triggered
only by Rename() DBus method, and could not by RenameImage(), as we did not
cache Image object when RenameImage() method is called. And machinectl
always uses RenameImage(). Hence, the issue could be triggered only when
Rename() DBus method is explicitly called by e.g. busctl.

With the previous commit, the Image object passed to the function is
always cached. Hence, the issue could be triggered even with machinectl
command, and this fix is important.

(cherry picked from commit 3b1b2d4e3d544c593399e914fd1c3a5f61d7e827)
2024-05-27 09:52:26 +02:00
Yu Watanabe
bf270a3b06 machine: also acquire Image object from cache when a dbus method in the main interface is called
Previously, Image objects were only cached when reading properties or
methods in the org.freedesktop.machine1.Image interface are called.

This makes that, when a method in the main interface (org.freedesktop.machine1)
for an image is called, also acquire the Image object from the cache,
and if not cached, create Image object and put into the cache, like we
do for org.freedesktop.machine1.Image.

Otherwise, if some properties of an image are updated by methods in the main
interface, e.g. MarkImageReadOnly(), the changes do not applied to the cached
Image object, and subsequent read of proerties through the interface for the
image, e.g. ReadOnly property, may provide outdated values.

Follow-up for 1ddb263d21099ae42195c2bc382bdf72a7f24f82.

Fixes #32888.

(cherry picked from commit c6aeb9b596749b263145346c7fa2c6bf7fbd3867)
2024-05-27 09:52:26 +02:00
Yu Watanabe
aa6822f2bd machine: split out manager_acquire_image() from image_object_find()
Preparation for the next commit. No functional change.

(cherry picked from commit 6d917da1409eae3b6988ed56cc4812252058ecdb)
2024-05-27 09:52:26 +02:00
Yu Watanabe
a2349e8ce6 discover-image: also update Image.limit in image_set_limit()
Same as the previous commit, but for SetLimit DBus method vs Limit
property and friends.

(cherry picked from commit 96ac6d3fccfe84eeda806da3d132a1374f8b5216)
2024-05-27 09:52:26 +02:00
Yu Watanabe
c16f4aaf65 discover-image: update Image.read_only flag in image_read_only()
Otherwise, ReadOnly DBus property in org.freedesktop.machine1.Image or
org.freedesktop.portable1.Image will not be updated by MarkReadOnly DBus
method.

(cherry picked from commit 608c321f232105966e509265c13ae061c03b9f77)
2024-05-27 09:52:26 +02:00
Yu Watanabe
77c5b47506 test: sync journal before read
Workaround for #32834 and #32890.

(cherry picked from commit a610ba00d923f148702e68b1661166e887759509)
2024-05-27 09:52:26 +02:00
Mike Yuan
182b80bede run: pass the pty slave fd to transient service
The rationale is similar to 40e1f4ea7458a0a80eaf1ef356e52bfe0835412e.

Currently, we only pass TTYPath=/dev/pts/... to
the transient service spawned by systemd-run.
This is a bit problematic though, when ExecStartPre=
or ExecStopPost= is used. Since when these control
processes get to run, the main process is not yet
started/has already exited, hence the slave suffers
from the same vhangup problem as the mentioned commit.

By passing the slave fd in, the service manager will
hold the fd open as long as the service is alive.

Fixes #32916

(cherry picked from commit 28459ba1f4df824d5ef7f7d1a9acb6953ea24045)
2024-05-27 09:52:26 +02:00
Mike Yuan
920dbc7b46 run: do not log "Error on PTY forwarding logic" when disconnected due to user operation
(cherry picked from commit ade0789fabbf01b95bf54d32f8cab1217a753f03)
2024-05-27 09:52:26 +02:00
Yu Watanabe
0868f29eae test: install modinfo to test image
Follow-up for 6c2d47d6d3ad25ffd7527c7f4de31457ee1b25d8.

Fixes the following unexpected skip:
```
[    6.163670] TEST-64-UDEV-STORAGE.sh[596]: + modinfo btrfs
[    6.164102] TEST-64-UDEV-STORAGE.sh[726]: /usr/lib/systemd/tests/testdata/units/TEST-64-UDEV-STORAGE.sh: line 726: modinfo: command not found
[    6.164683] TEST-64-UDEV-STORAGE.sh[727]: + echo 'This test requires the btrfs kernel module but it is not installed, skipping the test'
[    6.165069] TEST-64-UDEV-STORAGE.sh[728]: + tee --append /skipped
[    6.166801] TEST-64-UDEV-STORAGE.sh[728]: This test requires the btrfs kernel module but it is not installed, skipping the test
[    6.167177] TEST-64-UDEV-STORAGE.sh[596]: + exit 77
```

(cherry picked from commit 2569e790f6352797f8e326ed472f49479791a2ac)
2024-05-27 09:52:26 +02:00
Daan De Meyer
c267ea9a89 mountpoint-util: Deal with kernel API breakage in "norecovery" mount option
"norecovery" was deprecated for btrfs in
74ef00185e
and removed in
a1912f7121.

Let's drop our assumption that btrfs supports "norecovery" and first query for the
new name of the option followed by querying for the old name.

(cherry picked from commit e3828d7103a99a15a1e947ba3063294ead590631)
2024-05-27 09:52:26 +02:00
Yu Watanabe
ec0a8c8d46 test: wait for sessions being closed
If a session in closing state, the user state will be in online.

Fixes #32698.

(cherry picked from commit fc5112580a0eafe1f4f56ec35522578b7e76bca5)
2024-05-27 09:52:26 +02:00
Yu Watanabe
539c7cc3f6 test: wait for partition device being processed by udevd
Fixes #32697.

(cherry picked from commit 0664c1cf1db0c8da30dd0303379ff446fff66d01)
2024-05-27 09:52:26 +02:00
Yu Watanabe
c49a6771f7 test: wait for slice unit being (de)activated
Fixes #32731.

(cherry picked from commit 272aae38f89d0c415a57370a624287cd5aeaec0b)
2024-05-27 09:52:26 +02:00
Yu Watanabe
5187c45115 test: sync journal before reading journal
Otherwise, expected lines may not be processed or not sync()ed to disk.

Fixes #32712.

(cherry picked from commit c22a112883a46e302dae587b809c459647363ceb)
2024-05-27 09:52:26 +02:00
Yu Watanabe
8318972184 test: wait for partition processed by udevd
Fixes #32695.

(cherry picked from commit 71f04871739892db2cdbb6a746360fb243f24dc6)
2024-05-27 09:52:26 +02:00
Yu Watanabe
bbe01c78d7 test: do not fill journal with diff
(cherry picked from commit 55732636edcdd9d01fa89ee7ca569fd94522fdc7)
2024-05-27 09:52:26 +02:00
Yu Watanabe
ac9b71aefa test: do not fill journal with "wait"
(cherry picked from commit cad510b08cf801001ab48c154c48208cb002f6b3)
2024-05-27 09:52:26 +02:00
Yu Watanabe
f1ec77ce27 test-network: use different destination from gateway
Previously, one of the test route has the same address in destination
and gateway. Even it is a test case, that's super spurious. Let's use a
different address.

(cherry picked from commit cd6507538a5bd233c94b46c3aba328abc216154c)
2024-05-27 09:52:26 +02:00
Luca Boccassi
3cb3153013 test: add coverate for Compress=yes config option
Avoid regressions like https://github.com/systemd/systemd/issues/32856

Follow-up for 2ef7cdc4255883d1c50860661248c9db69a86aa1

(cherry picked from commit 88e791171aaaa2484c0482a1e7c06ae8fd90e52a)
2024-05-27 09:52:26 +02:00
Daan De Meyer
51c2887c85 journal-importer: Consider ECONNRESET as EOF
Otherwise we log a noisy error when we get ECONNRESET.

(cherry picked from commit 2540036979b341f22567e848e6698cbe993932e3)
2024-05-27 09:52:26 +02:00
Yu Watanabe
2dad3e4d0f pe-binary: .initrd section is optional for UKI
.osrel is also optional, but sd-boot and bootctl requires it.
So, let's keep .osrel section at least now.

Fixes #32774.

(cherry picked from commit 2e93331605e6b6a919121fd957a852431b0b8a19)
2024-05-27 09:52:26 +02:00
Yu Watanabe
8503ba1f91 systemctl: fix "applying zero offset to null pointer" UBSan error
Fixes #32837.

(cherry picked from commit 60dbecff27159a34be044b082d3688e62e67a4cb)
2024-05-27 09:52:26 +02:00
Radoslav Kolev
936576d0f5 test/test-rpm-macros.sh: add build directory to pkg-config search path
If tests are run during build time, without an already installed
systemd they fail to resolve the sysusersdir and tpmfilesdir pkg-config variables.

(cherry picked from commit 2aee829fc88fdde3983080de5c56fa06eb678280)
2024-05-27 09:52:26 +02:00
Daan De Meyer
9612ec00a5 core: Fix assertion in parse_smbios_strings()
(cherry picked from commit d02a41a9d4e5e250f5d817dd8cffd38e3db949e8)
2024-05-27 09:52:26 +02:00
Yu Watanabe
8d67da247a home: fix ownership of files copied from skelton directory
Fixes #32808.

(cherry picked from commit 05e64ea45dedc7206f2054d9821c71d7dc94ef1b)
2024-05-27 09:52:26 +02:00
Zbigniew Jędrzejewski-Szmek
8d074b77f6 libsystemd-network: remove double initialization
(cherry picked from commit f7a6418d47d141f4543aa01253f64f60ffdd2e17)
2024-05-27 09:52:26 +02:00
Radoslav Kolev
1b75c51445 libsystemd-network: skip dhcp server test in case of EAFNOSUPPORT
We want to eanble running tests as part of the build, but
our builds run in VMs with networking disabled.

(cherry picked from commit 19614a08d13fb8e0e73f1cb5859f8011e7df2394)
2024-05-27 09:52:26 +02:00
Radoslav Kolev
1ec8328749 sd-event: increase test-event timeout to 120s
The test-event test seems to be taking quite a bit more time than
the other 'simple tests', which usually complete in < 1s. In case
of a slower or loaded machine the default 30s timeout is not enough.

(cherry picked from commit 381c3b64d0a80ccda2ccb0dda6fe825878a6e150)
2024-05-27 09:52:26 +02:00
Lennart Poettering
73164d4819 curl-glue: catch libcurl attempting to change timeout handler when we destroy a curl context on exit
If we destroy both an event loop and a curl contect object at the same
time, then we get into this weird situation where curl wants us to
reconfigure a timout event source right before destruction, which
sd-event will refuse however, since it is already being shutdown.

Hence, catch that and simply don't bother adjusting the timeout, since
we cannot get back from there anyway.

(cherry picked from commit c5ecf0949460dd0bf3211db128a385ce6375252e)
2024-05-27 09:52:26 +02:00
Daan De Meyer
33a8ea65ca TEST-38-FREEZER: Relax regex a little
The state might be "freezing-by-parent" as well so let's take that
into account.

Fixes #32746

(cherry picked from commit 034e85c5f3608b8ae48ab1ad76b8af0b2c2fd3e5)
2024-05-27 09:52:26 +02:00
Yu Watanabe
29868fb123 libcrypt-util: fix wrong errno value assignment
Follow-up for 9de324c3c919f20fd49e1d25579f5a66cac0eaa0.

(cherry picked from commit a937fa96ac121bc8c1e74c3014c6bc0f2a597aeb)
2024-05-27 09:52:26 +02:00
Yu Watanabe
55d73421ec test-network: check existence of kernel bug
This adds checks for the kernel bug caused by
3ddc2231c8,
it will be fixed by
https://patchwork.kernel.org/project/netdevbpf/patch/20240510072932.2678952-1-edumazet@google.com/

(cherry picked from commit d22f2fb912da492a905f30fef84d1a23fdff3e55)
2024-05-27 09:52:26 +02:00
Yu Watanabe
ebbc5e587b test-network: introduce --no-journal option
This should be useful when the test run as a service, e.g.
running on a mkosi image.

(cherry picked from commit e92d7b7dd9dd8d8783e44626268aa6315331d68c)
2024-05-27 09:52:26 +02:00