1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-26 10:03:40 +03:00

67050 Commits

Author SHA1 Message Date
Mike Yuan
269fb21700 man,units: drop "temporary" from description of systemd-tmpfiles
Historically, systemd-tmpfiles was designed to manager temporary
files, but nowadays it has become a generic tool for managing
all kinds of files. To avoid user confusion, let's remove "temporary"
from the tool's description.

As discussed in #33349

(cherry picked from commit b5c8cc0a3b8e4e2fea0539d6420a76b524ea5735)
(cherry picked from commit 1a0e6961cfaed42bda542e111738c136f7b4d73f)
(cherry picked from commit c752efdfbac84cd62ddc54fc6ff7c58361f7f998)
2024-06-25 14:55:16 +02:00
Lennart Poettering
39b0a4df2c analyze: show pcrs also in sha384 bank
SHA384 is pretty much the bank we actually *want* to use, since it's
faster to calculate than SHA256, hence at the very least, start
considering.

(cherry picked from commit acaca5ab250a51be6ba07768bee80bf0f7b462fa)
(cherry picked from commit 51390a1f41a762ef96d3c496d8a5d890d722907d)
(cherry picked from commit 5024b1b09634e7cee4308457ac327854740b0a4a)
2024-06-25 14:55:16 +02:00
Daan De Meyer
2458e7d9f5 repart: Use CRYPT_ACTIVATE_PRIVATE
Let's skip udev device scanning when activating a LUKS volume in
systemd-repart as we don't depend on any udev symlinks and don't
expect anything except repart to access the volume.

Suggested by https://github.com/systemd/systemd/issues/33129#issuecomment-2143390941.

(cherry picked from commit 726fc7ae696510b04c24810f691d34f5d20529d6)
(cherry picked from commit d316aed5d8e15fb5b13b5618f1b2d1d020b1e7bf)
(cherry picked from commit 1ccc38ebf91dc7e79115080c79d0375f1bea5ac3)
2024-06-25 14:55:16 +02:00
Ronan Pigott
a3a035e238 resolved: permit dnssec rrtype questions when we aren't validating
This check introduced in 91adc4db33f6 is intended to spare us from
encountering broken resolver behavior we don't want to deal with.
However if we aren't validating we more than likely don't know the state
of the upstream resolver's support for dnssec. Let's let clients try
these queries if they want.

This brings the behavior of sd-resolved in-line with previouly stated
change in the meaning of DNSSEC=no, which now means "don't validate"
rather than "don't validate, because the upstream resolver is declared to
be dnssec-unaware".

Fixes: 9c47b334445a ("resolved: enable DNS proxy mode if client wants DNSSEC")
(cherry picked from commit 364c948707afa097f6ad177b61c2b51a86c0089a)
(cherry picked from commit ba031f1fe86e36d7adc0340b047de32399c98bf7)
(cherry picked from commit 5299397e49536dae7903bc4f5bf11d375146261d)
2024-06-25 14:55:16 +02:00
q66
43ee651ec5 strbuf: use GREEDY_REALLOC to grow the buffer
This allows us to reserve a bunch of capacity ahead of time,
improving the performance of hwdb significantly thanks to not
having to reallocate so many times.

Before:
```
$ sudo time valgrind --leak-check=full ./systemd-hwdb update
==113297== Memcheck, a memory error detector
==113297== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==113297== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==113297== Command: ./systemd-hwdb update
==113297==
==113297==
==113297== HEAP SUMMARY:
==113297==     in use at exit: 0 bytes in 0 blocks
==113297==   total heap usage: 1,412,640 allocs, 1,412,640 frees, 117,920,009,195 bytes allocated
==113297==
==113297== All heap blocks were freed -- no leaks are possible
==113297==
==113297== For lists of detected and suppressed errors, rerun with: -s
==113297== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
132.44user 21.15system 2:35.61elapsed 98%CPU (0avgtext+0avgdata 228560maxresident)k
0inputs+25296outputs (0major+6886930minor)pagefaults 0swaps
```

After:
```
$ sudo time valgrind --leak-check=full ./systemd-hwdb update
==112572== Memcheck, a memory error detector
==112572== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==112572== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==112572== Command: ./systemd-hwdb update
==112572==
==112572==
==112572== HEAP SUMMARY:
==112572==     in use at exit: 0 bytes in 0 blocks
==112572==   total heap usage: 1,320,113 allocs, 1,320,113 frees, 70,614,501 bytes allocated
==112572==
==112572== All heap blocks were freed -- no leaks are possible
==112572==
==112572== For lists of detected and suppressed errors, rerun with: -s
==112572== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
21.94user 0.19system 0:22.23elapsed 99%CPU (0avgtext+0avgdata 229876maxresident)k
0inputs+25264outputs (0major+57275minor)pagefaults 0swaps
```

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
(cherry picked from commit 621b10fe2c3203c537996e84c7c89b0ff994ad93)
(cherry picked from commit 514ef0f93b76cbe0ba6b4de07a7b21fd0c2b7bae)
(cherry picked from commit aa0dd89d3faebce3b051f1c63bb234ea8777dd60)
2024-06-25 14:55:16 +02:00
Daan De Meyer
1a8549f4cd rules: Limit the number of device units generated for serial ttys
As per the suggestion in https://github.com/systemd/systemd/issues/33242.

This reduces the number of /dev/ttySXX device units generated in
mkosi from 32 to 4.

(cherry picked from commit dc38f9addd04c34d1fd743efc407bdebb3573d05)
(cherry picked from commit a3d94332a2b5128697373d3093c1cfa56649ec61)
(cherry picked from commit 639124214e0f5fb767716d0b2b7ee7a0c75a5c4a)
2024-06-25 14:55:16 +02:00
Yu Watanabe
74e844ac1f sd-dhcp-server: clear buffer before receive
I do not think this is necessary, but all other places in
libsystemd-network we clear buffer before receive. Without this,
Coverity warns about use-of-uninitialized-values.
Let's silence Coverity.

Closes CID#1469721.

(cherry picked from commit 40f9fa0af4c3094d93e833e62f7e301cd453da62)
(cherry picked from commit 0d573787ea1610ba57a359cf437841f62b186e77)
(cherry picked from commit aa93c07b3a5701f13163b190ee4e6ffd4de32eb5)
2024-06-25 14:55:16 +02:00
Luca Boccassi
da9a6a5436 executor: check for all permission related errnos when setting up IPC namespace
Denials from AppArmor are raised as EACCES, so EPERM is not enough. Do
the same check as PrivateNetwork above.

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

Related to 06384eb3c5044f632f50304a0210a402460f1189

(cherry picked from commit cafe40ec8201db31c6d3519474ef40a72541d511)
(cherry picked from commit e4817103d0f32a3492608f14da6628d5c9b83197)
2024-05-27 23:48:35 +02:00
Mike Yuan
10e36dbd66 tmpfiles: don't compare errno with negative value
Follow-up for 677430b3c7fcd1b352eb66f19b8746741459b91a

(cherry picked from commit d8f5a310227e7c74548b7f6ca9aafd39af6a621f)
(cherry picked from commit 632b4934a0a0d0c048d94a3baab4668b58577a03)
v254.13
2024-05-27 23:48:35 +02:00
Yu Watanabe
e2fe7d88c2 blockdev-util: also check loop/partscan sysattr
With b9684a71fc (v5.19),
we cannot check partition scanning is enabled for a loopback block device
without checking the attribute.

(cherry picked from commit bab8c851daaa2a4ed9febb7cc958f701ee024151)
(cherry picked from commit ae7a07b9ff9066f549ea5ae95be5201d581ea0e8)
2024-05-27 23:48:35 +02:00
Yu Watanabe
7f19a3449b blockdev-util: also check newer value of GENHD_FL_NO_PART flag
With 430cc5d3ab,
the value of GENHD_FL_NO_PART, previously named as GENHD_FL_NO_PART_SCAN,
is changed from 0x0200 to 0x0004. So, we need to check both flags.

(cherry picked from commit f0c2668c9934682a3b4ed5c228c05e26bb0ba1dc)
(cherry picked from commit 49b0f0ed08ec50d0ca9d19de657493800b72420b)
2024-05-27 23:48:35 +02:00
Mike Yuan
6426323afa blockdev-util: "partscan" sysattr now directly shows the enabled state
See also: https://lore.kernel.org/r/20240502130033.1958492-3-hch@lst.de

(cherry picked from commit 100bed702b73414161d57adff71e07329c1016ac)
(cherry picked from commit 41fb19e778913273d904f3b75b545bb77da9d1f7)
2024-05-27 23:48:35 +02:00
Yu Watanabe
8b86adabd4 test: applying timezone is asynchronous
So, we need to try to read timezone several times.
Also, on failure, show journal of timedated instead of hostnamed,
as the timezone is handled by timedated.

Hopefully fixes #33007.

(cherry picked from commit 1ef586af237e685c32676e381a5ce8d4918f9225)
(cherry picked from commit 91d31ca3bcf929346ec872d387cd33030d4e1570)
2024-05-27 23:48:35 +02:00
Zbigniew Jędrzejewski-Szmek
1d83c17dd1 shared/conf-parser: do not print "(null)" as section name
Before:
/etc/kernel/install.conf:6: Unknown key name 'asdf' in section '(null)', ignoring.
After:
/etc/kernel/install.conf:6: Unknown key 'asdf', ignoring.

Also make the message a bit better.

(cherry picked from commit 600a7405a9a7cdf2d6a7e669df4fa6025924ba82)
(cherry picked from commit a2f32b99f354c3fc2d4e9b49c26f64357f5a0887)
2024-05-27 23:48:35 +02:00
Luca Boccassi
c3aa100a54 test: do not fail network namespace test with permission issues
When running in LXC with AppArmor we'll most likely get an error when creating
a network namespace due to a kernel regression in < v6.2 affecting AppArmor,
resulting in denials. Like other tests, avoid failing in case of permission
issues and handle it gracefully.

(cherry picked from commit 6ab21f20bd982bc1a9ece47dcffa1137a76cc48a)
(cherry picked from commit ff354605fc440100c2f6aac16a6cce79cf59eef8)
2024-05-27 23:48:35 +02:00
Luca Boccassi
8f988ac8ff lock-util: do not expect EACCES when it cannot happen
As per the documentation, EACCES is only returned when F_SETLK is
used, and only on some platforms, which doesn't seem to include
Linux:

https://github.com/torvalds/linux/blob/master/fs/locks.c

F_OFD_SETLK is documented to only return EAGAIN, and F_SETLKW/F_OFD_SETLKW
are blocking operations so this logic doesn't apply to them in the
first place.

Hence, only automatically convert EACCES into EAGAIN for F_SETLK
operations, and propagate the original error in the other cases.

This is important because in some cases we catch permission errors
and gracefully fallback, which is not possible if the original error
is lost.

This is an issue in practice because, due to a kernel bug present
before v6.2, AppArmor denies locking on file descriptors to LXC
containers. We support all currently maintained LTS kernels,
including v6.1, where despite a lot of effort and attempts over almost
a year, the bugfix still hasn't been backported, as it is complex and
requires large changes to AppArmor.
On affected kernels, all services running with PrivateNetwork=yes
fail and do not recover, instead of the normal behaviour of gracefully
downgrading to PrivateNetwork=no.

The integration tests in the Debian CI fail due to this issue:

https://ci.debian.net/packages/s/systemd/testing/arm64/46828037/
(cherry picked from commit 06384eb3c5044f632f50304a0210a402460f1189)
(cherry picked from commit 2af054219547b848c309d11cccc6ff11769fec1d)
2024-05-27 23:48:35 +02:00
Yu Watanabe
b88915b23d test: lock device during running cryptsetup
On running cryptsetup, udevd detects two inotify events for the
underlying device. Running the test on enough fast host, the expected
symlinks based on UUID and disk label are created by the second event.

During processing a uevent for a device, udevd disables the inotify
watch for the device. If the test runs on slow system, the second
inotify event may comes during a udev worker processing the synthesized
uevent triggered by the first inotify event. Hence, no synthesized
uevent for the second inotify event will be generated, and the expected
symlinks will be never created.

To prevent the issue, we need to lock the device during cryptsetup
command is running.

Fixes #32913.

(cherry picked from commit be43c9b0295120e508de1afd739af6fb7603186a)
(cherry picked from commit 640dbad3e75b0c67ed1f6c1afd02ceb313a0d8c8)
2024-05-27 23:48:35 +02:00
Yu Watanabe
30f3f98548 test: wait a bit before stopping/killing service
Otherwise, when stopping the service, the last command may not be
started yet, and the service manager may not send SIGTERM signal to the
last command, but send SIGKILL on timeout.

===
May 21 08:23:24 test19-exit-cgroup.sh[437]: + disown
May 21 08:23:24 test19-exit-cgroup.sh[438]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[437]: + systemd-notify --ready
May 21 08:23:24 test19-exit-cgroup.sh[437]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[441]: + systemctl stop one
May 21 08:23:24 test19-exit-cgroup.sh[443]: + sleep infinity
(snip)
May 21 08:23:24 systemd[1]: one.service: Changed running -> stop-sigterm
May 21 08:23:24 systemd[1]: Stopping one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one"...
May 21 08:23:24 systemd[1]: Received SIGCHLD from PID 441 (systemctl).
May 21 08:23:24 systemd[1]: Child 437 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 437 belongs to one.service.
May 21 08:23:24 systemd[1]: one.service: Main process exited, code=killed, status=15/TERM (success)
May 21 08:23:24 systemd[1]: Child 439 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 439 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 441 (systemctl) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 441 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 442 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 442 belongs to one.service.
(snip)
May 21 08:24:54 systemd[1]: one.service: State 'stop-sigterm' timed out. Killing.
May 21 08:24:54 systemd[1]: one.service: Killing process 443 (sleep) with signal SIGKILL.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigterm -> stop-sigkill
May 21 08:24:54 systemd[1]: Received SIGCHLD from PID 443 (sleep).
May 21 08:24:54 systemd[1]: Child 443 (sleep) died (code=killed, status=9/KILL)
May 21 08:24:54 systemd[1]: one.service: Child 443 belongs to one.service.
May 21 08:24:54 systemd[1]: one.service: Control group is empty.
May 21 08:24:54 systemd[1]: one.service: Failed with result 'timeout'.
May 21 08:24:54 systemd[1]: one.service: Service restart not allowed.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigkill -> failed
May 21 08:24:54 systemd[1]: one.service: Job 738 one.service/stop finished, result=done
May 21 08:24:54 systemd[1]: Stopped one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one".
May 21 08:24:54 systemd[1]: one.service: Unit entered failed state.
May 21 08:24:54 systemd[1]: one.service: Releasing resources...
===

Fixes #32947.

(cherry picked from commit a5edb9b7b1366812d5bf558c95a433dae96d7b75)
(cherry picked from commit 139395d7332de385b28ece7a61473d9f854e080f)
2024-05-27 23:48:35 +02:00
Yu Watanabe
d080d3dcd6 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)
(cherry picked from commit 53a26a675627d909cc7accd26d661ebcf565f417)
2024-05-27 23:48:35 +02:00
Yu Watanabe
861affe4cf 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)
(cherry picked from commit 1a6a2d8f2476f2468ac96bd973bbc890eaa9f996)
2024-05-27 23:48:35 +02:00
Mike Yuan
d1e36e6a35 man/systemd-run: beef up info regarding interaction between --pty, --pipe, and --wait
(cherry picked from commit d73a47d259be795958c8aa5b65b002f3d7338b6e)
(cherry picked from commit ce25cf6df1c6f86eabb4f35fae13a3c932096eb9)
2024-05-27 23:48:35 +02:00
Mike Yuan
4e89a4180e 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)
(cherry picked from commit 46561305cba2fcb64726616e88c7b33b2f23c988)
2024-05-27 23:48:35 +02:00
Mike Yuan
7f1f029b13 ptyfwd: add missing assertions for pty_forward_new
(cherry picked from commit d735753256c1e0f3e9a4efaab17ba9ee47650403)
(cherry picked from commit 867b5a72582ae91e63f3181d707977de583559af)
2024-05-27 23:48:35 +02:00
Zbigniew Jędrzejewski-Szmek
7941cf4907 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)
(cherry picked from commit 78e023aa021d44083a5f1213dadb32f5d0706b17)
2024-05-27 23:48:35 +02:00
Frantisek Sumsal
eefc6559b1 test: add a brief comment for the chattr check
Addresses: https://github.com/systemd/systemd/pull/32907#discussion_r1605919598
(cherry picked from commit d3c14f78cd66a498c2ff8a836bfc4f6a110315fe)
(cherry picked from commit 71ac20d663aee0d3e927df538f1d73f387e73189)
2024-05-27 23:48:35 +02:00
Yu Watanabe
87054dc337 test: extend timeout for DHCP/NDisc tests
Fixes https://github.com/systemd/systemd/pull/32932#issuecomment-2120424121.

(cherry picked from commit f8ef1df3d1a9a22ce9d62df3910d4f940ff42a1a)
(cherry picked from commit d6f9c7b52b84da5c3b6d7c2e709fafe722665888)
2024-05-27 23:48:35 +02:00
Luca Boccassi
72e6c4bc89 semaphore: use variable for Salsa repo URL
Makes it easier to switch for debuggin

(cherry picked from commit 5002b576d8d3d338df90f7d51543f44dd571f388)
(cherry picked from commit c64e96061b2f84c3e97e810cf7d3a1fe94550409)
2024-05-27 23:48:35 +02:00
Yu Watanabe
64719b545f 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)
(cherry picked from commit 221b2783ba305f4e7c7c8ea8b32cbd2106499c65)
2024-05-27 23:48:35 +02:00
Yu Watanabe
5a62dc016d test-network: split out setup_netdevsim()
(cherry picked from commit 12e0d6ed38a2f8de0a202d2cdbdbda52a866340d)
(cherry picked from commit c047c7e91a88802245efd6a73a8b71b843c586a8)
2024-05-27 23:48:35 +02:00
Yu Watanabe
3102599b3b 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)
(cherry picked from commit c937169b0ef8403bb7a35741e2587dc5473601b8)
2024-05-27 23:48:35 +02:00
Yu Watanabe
a898cb9f0b 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)
(cherry picked from commit bf270a3b06eff023b13e252d1d9c1876449b79e1)
2024-05-27 23:48:35 +02:00
Yu Watanabe
cde3c5af2d machine: split out manager_acquire_image() from image_object_find()
Preparation for the next commit. No functional change.

(cherry picked from commit 6d917da1409eae3b6988ed56cc4812252058ecdb)
(cherry picked from commit aa6822f2bdca04feb0f3d7224da2d29b02578fb9)
2024-05-27 23:48:35 +02:00
Yu Watanabe
77ec2692ea 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)
(cherry picked from commit a2349e8ce6b511f24b2ecea58be5ada820a41058)
2024-05-27 23:48:35 +02:00
Yu Watanabe
e268f146d6 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)
(cherry picked from commit c16f4aaf6588238b979bbab74e0327c736eb16f6)
2024-05-27 23:48:35 +02:00
Mike Yuan
369d7d4083 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)
(cherry picked from commit 182b80bede28ef6e9c0d0edd34c56a467d22dee5)
2024-05-27 23:48:35 +02:00
Mike Yuan
3b01bd37f3 run: do not log "Error on PTY forwarding logic" when disconnected due to user operation
(cherry picked from commit ade0789fabbf01b95bf54d32f8cab1217a753f03)
(cherry picked from commit 920dbc7b46c175ddc0ecf426ac9f855d90081160)
2024-05-27 23:48:35 +02:00
Yu Watanabe
911a5934d7 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)
(cherry picked from commit 0868f29eae4e1577eb494808a7875df69845f50c)
2024-05-27 23:48:35 +02:00
Daan De Meyer
f455be6110 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)
(cherry picked from commit c267ea9a89cb5f2fe29ae9f93c703ce9dc07cbb0)
2024-05-27 23:48:35 +02:00
Yu Watanabe
0a43e840e9 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)
(cherry picked from commit ec0a8c8d469356faab5db4e116bd9d4bedfefffb)
2024-05-27 23:48:35 +02:00
Yu Watanabe
e62ecc6511 test: wait for partition processed by udevd
Fixes #32695.

(cherry picked from commit 71f04871739892db2cdbb6a746360fb243f24dc6)
(cherry picked from commit 8318972184d1f6a382fc6fb28f81a5d992fe145b)
2024-05-27 23:48:35 +02:00
Yu Watanabe
7b44f6c77e test: do not fill journal with "wait"
(cherry picked from commit cad510b08cf801001ab48c154c48208cb002f6b3)
(cherry picked from commit ac9b71aefadcc4f9d47cbb1453d019ae8738155b)
2024-05-27 23:48:35 +02:00
Daan De Meyer
c61d11c03a journal-importer: Consider ECONNRESET as EOF
Otherwise we log a noisy error when we get ECONNRESET.

(cherry picked from commit 2540036979b341f22567e848e6698cbe993932e3)
(cherry picked from commit 51c2887c850fcc0326233c5b1aaf60ce5182e397)
2024-05-27 23:48:35 +02:00
Yu Watanabe
1fbe3d0bdd systemctl: fix "applying zero offset to null pointer" UBSan error
Fixes #32837.

(cherry picked from commit 60dbecff27159a34be044b082d3688e62e67a4cb)
(cherry picked from commit 8503ba1f91f20d4a339cd0825a4c416731a0fda7)
2024-05-27 23:48:35 +02:00
Radoslav Kolev
eec41b7016 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)
(cherry picked from commit 936576d0f5300d3f5b455246acbba729b558659b)
2024-05-27 23:48:35 +02:00
Daan De Meyer
2692acb884 core: Fix assertion in parse_smbios_strings()
(cherry picked from commit d02a41a9d4e5e250f5d817dd8cffd38e3db949e8)
(cherry picked from commit 9612ec00a5cfc5fecc0cbf7de63e14bbb89acbdf)
2024-05-27 23:48:35 +02:00
Zbigniew Jędrzejewski-Szmek
6d913d018e libsystemd-network: remove double initialization
(cherry picked from commit f7a6418d47d141f4543aa01253f64f60ffdd2e17)
(cherry picked from commit 8d074b77f63e6c73c9628c36f89c30c5d7c44cc5)
2024-05-27 23:48:35 +02:00
Radoslav Kolev
07a72ea227 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)
(cherry picked from commit 1b75c5144544aa7153317209339c552d948d4b12)
2024-05-27 23:48:35 +02:00
Lennart Poettering
e892472b64 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)
(cherry picked from commit 73164d4819afdb3d0870c3d5ce769d1e0a90347a)
2024-05-27 23:48:35 +02:00
Daan De Meyer
376507227a 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)
(cherry picked from commit 33a8ea65ca28b67a1faf766143e2847be5dd379e)
2024-05-27 23:48:35 +02:00
Yu Watanabe
6f2a7f0d05 libcrypt-util: fix wrong errno value assignment
Follow-up for 9de324c3c919f20fd49e1d25579f5a66cac0eaa0.

(cherry picked from commit a937fa96ac121bc8c1e74c3014c6bc0f2a597aeb)
(cherry picked from commit 29868fb1238a7127b4f939f5693732eeb96f7aba)
2024-05-27 23:48:35 +02:00