1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-30 17:18:08 +03:00
Commit Graph

69493 Commits

Author SHA1 Message Date
Daan De Meyer
fc7cdb2dde kernel-install: Look for uki.conf in /usr/lib/kernel as well 2023-12-11 10:29:57 +01:00
Yu Watanabe
cfe69f962b network: drop unused Manager.routes_foreign 2023-12-11 15:44:08 +09:00
Yu Watanabe
e924dc598e network: adjust log message
The address or neighbor processed here may not be foreign.
2023-12-11 15:43:03 +09:00
Yu Watanabe
9d51ab7830 test: add test cases for issue #30357 2023-12-11 15:12:42 +09:00
Yu Watanabe
6d9d556579 analyze: also find template unit when a template instance is specified
Fixes a regression caused by 2f6181ad4d.

Fixes #30357.

Co-authored-by: Jeff King <peff@peff.net>
2023-12-11 15:12:38 +09:00
Yu Watanabe
be26893c85 network/neighbor: add missing OOM check 2023-12-11 15:07:54 +09:00
JmbFountain
9f640614a6
Adding Trekstor Primebook C13 rotation to 60-sensor.hwdb (#30415)
* Adding Trekstor Primebook C13 rotation to 60-sensor.hwdb
2023-12-10 22:37:44 +00:00
Daan De Meyer
e0e523ea7f mkosi: Copy /boot into the ESP as well
Newer mkosi will start installing UKIs to /boot so prepare for that
by making sure we also copy /boot into the ESP.
2023-12-10 21:47:10 +01:00
Luca Boccassi
32adf62a69
Merge pull request #30406 from yuwata/resolve-clean-exit
resolve: make resolved exit cleanly
2023-12-10 18:42:24 +00:00
Luca Boccassi
7aea3cf8c2
Merge pull request #30404 from yuwata/network-peer
network/route: fix reachability check when peer address is specified
2023-12-10 14:13:37 +00:00
Luca Boccassi
65ea0d9e75
Merge pull request #30407 from yuwata/network-clean-exit
network: make networkd exit cleanly
2023-12-10 12:54:17 +00:00
Yu Watanabe
ef8ba77576 test: update log message and use SYNTHETIC_ERRNO()
Follow-up for ce5a6d5307.

Addresses https://github.com/systemd/systemd/pull/30049#discussion_r1395453408.
2023-12-10 12:51:17 +00:00
Mike Yuan
ced3e6bc0e elf2efi: remove outdated comment mentioning linker script
Follow-up for 142f0c61a3
2023-12-10 12:50:14 +00:00
Yu Watanabe
fca212b022 resolve: fix wrong error cause assignment to log_debug_errno()
Fixes #30392.
2023-12-10 17:47:36 +08:00
Mike Yuan
c8f7c9a11d core/exec-invoke: sigwait() returns positive errno and never EINTR
Follow-up for 5b6319dcee (gosh this is
ancient), and effectively reverts 3dead8d925.

sigwait() is documented to "suspend execution of the calling thread
until one of the signals specified in the signal set becomes pending".
And the only error it returns is EINVAL, when "set contains an invalid
signal number". Therefore, there's no need to run it in a loop or
to check for runtime error.
2023-12-10 09:44:44 +01:00
Yu Watanabe
7618fd06ef test-network: check if networkd exits cleanly 2023-12-10 14:40:09 +09:00
Yu Watanabe
f67208a172 network/ipv4ll: do not start sd-ipv4ll on exit
When assert_return() is critical, the following assertion is triggered
on exit:
---
 #0  0x00007f8b1f6b0884 in __pthread_kill_implementation () from target:/lib64/libc.so.6
 #1  0x00007f8b1f65fafe in raise () from target:/lib64/libc.so.6
 #2  0x00007f8b1f64887f in abort () from target:/lib64/libc.so.6
 #3  0x00007f8b208d02d6 in log_assert_failed (text=0x7f8b210009e0 "e->state != SD_EVENT_FINISHED", file=0x7f8b20fff403 "src/libsystemd/sd-event/sd-event.c",
     line=1252, func=0x7f8b21004400 <__func__.154> "sd_event_add_io") at ../src/basic/log.c:948
 #4  0x00007f8b208d0457 in log_assert_failed_return (text=0x7f8b210009e0 "e->state != SD_EVENT_FINISHED",
     file=0x7f8b20fff403 "src/libsystemd/sd-event/sd-event.c", line=1252, func=0x7f8b21004400 <__func__.154> "sd_event_add_io") at ../src/basic/log.c:967
 #5  0x00007f8b20c7d102 in sd_event_add_io (e=0x617000000080, ret=0x60c000000a20, fd=11, events=1, callback=0x7dfd85 <ipv4acd_on_packet>,
     userdata=0x60c000000a00) at ../src/libsystemd/sd-event/sd-event.c:1252
 #6  0x00000000007e3934 in sd_ipv4acd_start (acd=0x60c000000a00, reset_conflicts=true) at ../src/libsystemd-network/sd-ipv4acd.c:597
 #7  0x00000000007e72b9 in ipv4ll_start_internal (ll=0x6080000006a0, reset_generation=true) at ../src/libsystemd-network/sd-ipv4ll.c:278
 #8  0x00000000007e7462 in sd_ipv4ll_start (ll=0x6080000006a0) at ../src/libsystemd-network/sd-ipv4ll.c:298
 #9  0x00000000006047a1 in dhcp4_handler (client=0x617000000400, event=0, userdata=0x61a000000680) at ../src/network/networkd-dhcp4.c:1183
 #10 0x000000000075b1ed in client_notify (client=0x617000000400, event=0) at ../src/libsystemd-network/sd-dhcp-client.c:783
 #11 0x000000000075bf8d in client_stop (client=0x617000000400, error=0) at ../src/libsystemd-network/sd-dhcp-client.c:821
 #12 0x000000000077710f in sd_dhcp_client_stop (client=0x617000000400) at ../src/libsystemd-network/sd-dhcp-client.c:2388
 #13 0x000000000065cdd1 in link_stop_engines (link=0x61a000000680, may_keep_dhcp=true) at ../src/network/networkd-link.c:336
 #14 0x000000000041f214 in manager_free (m=0x618000000080) at ../src/network/networkd-manager.c:613
 #15 0x00000000004124e3 in manager_freep (p=0x7f8b1c800040) at ../src/network/networkd-manager.h:128
 #16 0x00000000004139f6 in run (argc=1, argv=0x7ffffe4522e8) at ../src/network/networkd.c:24
 #17 0x0000000000413b20 in main (argc=1, argv=0x7ffffe4522e8) at ../src/network/networkd.c:119
---
Prompted by https://github.com/systemd/systemd/pull/30049#issuecomment-1844087965.
2023-12-10 14:40:09 +09:00
Yu Watanabe
b1384db11b test: check if resolved exits cleanly 2023-12-10 14:38:56 +09:00
Yu Watanabe
a4be4ad8ab resolve: do not trigger assertion on exit
By making assert_return() critical, we observe the following:
---
 Program received signal SIGABRT, Aborted.
 0x00007f01320b0884 in __pthread_kill_implementation () from /lib64/libc.so.6
 (gdb) bt
 #0  0x00007f01320b0884 in __pthread_kill_implementation ()
    from /lib64/libc.so.6
 #1  0x00007f013205fafe in raise () from /lib64/libc.so.6
 #2  0x00007f013204887f in abort () from /lib64/libc.so.6
 #3  0x00007f01338d02d6 in log_assert_failed (
     text=0x7f01340009e0 "e->state != SD_EVENT_FINISHED",
     file=0x7f0133fff403 "src/libsystemd/sd-event/sd-event.c", line=1399,
     func=0x7f01340045a0 <__func__.148> "sd_event_add_time")
     at ../src/basic/log.c:948
 #4  0x00007f01338d0457 in log_assert_failed_return (
     text=0x7f01340009e0 "e->state != SD_EVENT_FINISHED",
     file=0x7f0133fff403 "src/libsystemd/sd-event/sd-event.c", line=1399,
     func=0x7f01340045a0 <__func__.148> "sd_event_add_time")
     at ../src/basic/log.c:967
 #5  0x00007f0133c7ed83 in sd_event_add_time (e=0x617000022280,
     ret=0x610000007e98, clock=7, usec=24054941030, accuracy=0,
     callback=0x4625b4 <on_announcement_timeout>, userdata=0x610000007e40)
     at ../src/libsystemd/sd-event/sd-event.c:1399
 #6  0x00007f0133c7f725 in sd_event_add_time_relative (e=0x617000022280,
     ret=0x610000007e98, clock=7, usec=1000000, accuracy=0,
     callback=0x4625b4 <on_announcement_timeout>, userdata=0x610000007e40)
     at ../src/libsystemd/sd-event/sd-event.c:1462
 #7  0x0000000000464cac in dns_scope_announce (scope=0x610000007e40, goodbye=true) at ../src/resolve/resolved-dns-scope.c:1530
 #8  0x0000000000504d08 in link_free (l=0x612000023d40) at ../src/resolve/resolved-link.c:83
 #9  0x000000000052dbbd in manager_free (m=0x619000000a80) at ../src/resolve/resolved-manager.c:697
 #10 0x0000000000562328 in manager_freep (p=0x7f012f800040) at ../src/resolve/resolved-manager.h:198
 #11 0x000000000056315a in run (argc=1, argv=0x7fff22b06468) at ../src/resolve/resolved.c:25
 #12 0x0000000000563284 in main (argc=1, argv=0x7fff22b06468) at ../src/resolve/resolved.c:99
---
Prompted by https://github.com/systemd/systemd/pull/30049#issuecomment-1844087965.
2023-12-10 14:38:56 +09:00
Yu Watanabe
a753d30303 systemctl: fix typo
Follow-up for 329050c5e2.
2023-12-10 14:26:33 +09:00
Yu Watanabe
0500f755fc networkctl: fix typo
Follow-up for 2b98926f98.
2023-12-10 14:25:33 +09:00
Mike Yuan
ba8245a77a core/executor: do destruct static variables and selinux before exiting
I was wondering why I couldn't trigger the assertion in safe_fclose()
when submitting #30251. It turned out that the static destructor was
not run at all :/

Replace main() with a minimized version of main-func.h. This also
prevents emitting negative exit codes.
2023-12-10 14:13:35 +09:00
Yu Watanabe
f1e89cb9b1
Merge pull request #30399 from YHNdnzj/memory-accounting-always-peak
systemctl-show: always show memory peak if available
2023-12-10 14:11:05 +09:00
Mike Yuan
8ad973ed99 hibernate-util: de-duplicate clear_efi_hibernate_location 2023-12-10 14:08:46 +09:00
Yu Watanabe
3a4e3d4f9e
Merge pull request #30400 from bluca/coverity
Assorted coverity fixes
2023-12-10 14:07:37 +09:00
Yu Watanabe
5e46ca9890 test-network: add test case for issue #30403 2023-12-10 14:04:28 +09:00
Yu Watanabe
e091ed4053 network/route: fix reachability check when peer address is specified
When an address with peer address is specified, the kernel by default
adds the prefix route for the peer address. When ManageForeignRoute=no
is set, then we also needs to check the prefix for the peer address.

Fixes #30403.
2023-12-10 14:01:33 +09:00
Luca Boccassi
3b3bce04f0 test-login: remove dead code
HANDLE_SLEEP is == _HANDLE_ACTION_SLEEP_LAST and the loop is bounded
by < _HANDLE_ACTION_SLEEP_LAST, so no need to check for it

CID#1529414
2023-12-09 13:17:02 +00:00
Luca Boccassi
2343f6b11e logind: use ASSERT_PTR to validate result before use
handle_action_lookup() in general can return NULL, but not
here as the handle is checked before, so add an assert.

CID#1529415
CID#1529416
2023-12-09 13:17:02 +00:00
Luca Boccassi
fc9d7ddbac systemctl: fix copy/paste
on_circle is set twice to the same value

CID#1529418
2023-12-09 13:17:02 +00:00
Luca Boccassi
5572e9d82f journal-remote: set upper length bound when parsing incoming headers
CID#1529420
2023-12-09 13:17:02 +00:00
Mike Yuan
2747cd6d17
systemctl-show: always show memory peak if available 2023-12-09 20:42:48 +08:00
Mike Yuan
ad009380e1
core/cgroup: cache the last memory usage values before destroying cgroup
Currently, memory accounting values are only cached if it was queued
at least once before destroying cgroup. Let's always cache it like
what we already do for CPU usage.

Preparation for later changes.
2023-12-09 20:42:48 +08:00
Luca Boccassi
9614dd542b mount: check that MountParameters is valid before use
Follow-up for 6c75eff6af

CID#1530430
2023-12-09 11:57:01 +00:00
Florian Schmaus
7ba8260c46 NEWS: fix typo s/show/shown/ 2023-12-09 19:44:20 +08:00
Luca Boccassi
1d13163520
Merge pull request #30387 from mrc0mmand/TEST-17-tweaks
test: a couple of tweaks for TEST-17-UDEV
2023-12-09 11:06:37 +00:00
Mike Yuan
32a0004c62
Merge pull request #30384 from YHNdnzj/rename-process
core/executor: save argv for later use by rename_process()
2023-12-09 19:04:07 +08:00
Yu Watanabe
2b2f192a0e
Merge pull request #30362 from mrc0mmand/cat-highlight-directives
shared: highlight directives when dumping configs
2023-12-09 18:54:46 +09:00
Zbigniew Jędrzejewski-Szmek
ba056e146a Revert "packit: don't take ownership of /etc/ssh/sshd_config.d/"
This reverts commit 9f7d189923.
systemd.spec was updated in [1], so we don't need this here anymore.

[1] 245a2587e0
2023-12-08 19:12:19 +00:00
Zbigniew Jędrzejewski-Szmek
6bc99ec29b test_ukify: raise timeout
With a sufficiently large initrd, the tests take 25 s on my laptop.
Normally, they'd be quicker, but since we use what we find on the
system, we don't control this. Let's raise the timeout to reduce the
chances of a spurious failure.
2023-12-08 19:17:40 +01:00
Zbigniew Jędrzejewski-Szmek
fd9ccc07a6 test_ukify: formatting 2023-12-08 19:17:40 +01:00
Zbigniew Jędrzejewski-Szmek
ef0a69eb90 test_ukify: explicitly remove big temporary directories
pytest intentionally keeps around a limited number of the previous test
temporary directories [1]. This is generally OK, but in our tests that generate
initrds, we create a few very large files (both the initrd and kernel in a few
copies), which quickly adds up. I had a particularly large initrd (because of
some mkosi-initrd shenanigans), and I unded up with dozens of gigabytes of
temporary files from the tests. Let's just nuke the dirs where we write
kernel data.

[1] https://github.com/pytest-dev/pytest/issues/543
2023-12-08 19:17:40 +01:00
Zbigniew Jędrzejewski-Szmek
6f1df1ff3c test_ukify: use Path-based fixtures
Quoting https://docs.pytest.org/en/stable/how-to/tmp_path.html#the-default-base-temporary-directory:
> The tmpdir and tmpdir_factory fixtures are similar to tmp_path and
> tmp_path_factory, but use/return legacy py.path.local objects rather than
> standard pathlib.Path objects.
>
> These days, it is preferred to use tmp_path and tmp_path_factory.
2023-12-08 19:17:40 +01:00
Frantisek Sumsal
e23fc070e2 test: backup /etc/udev/udev.conf only if it exists
On Fedora systemd recently moved all of its configuration files to
/usr/lib/ [0], so make sure we account for this case as well.

[   42.450325] testsuite-17.sh[800]: + mkdir -p /run/udev/rules.d
[   42.466504] testsuite-17.sh[800]: + cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp
[   42.503348] testsuite-17.sh[802]: cp: cannot stat '/etc/udev/udev.conf': No such file or directory

[0] 29eb35530b
2023-12-08 18:38:41 +01:00
Frantisek Sumsal
ad23ff13de test: reset systemd-udevd.service restart counter
Since we restart systemd-udevd here a couple of times, we might hit the
rate limit in later tests:

[   26.028355] testsuite-17.sh[2074]: + udevadm control -e
[   26.028355] testsuite-17.sh[2074]: + udevadm control -l emerg
[   26.126160] systemd[1]: systemd-udevd.service: Start request repeated too quickly.
[   26.126213] systemd[1]: systemd-udevd.service: Failed with result 'start-limit-hit'.
[   26.140310] systemd[1]: Failed to start systemd-udevd.service.
[   26.140897] systemd[1]: systemd-udevd-control.socket: Failed with result 'service-start-limit-hit'.
[   26.141286] systemd[1]: systemd-udevd-kernel.socket: Failed with result 'service-start-limit-hit'.
[   26.142225] testsuite-17.sh[2074]: + udevadm control -l alert
[   26.149206] udevadm[2088]: Failed to send request to set log level: No such file or directory

Follow-up to: 6ef512c0bb
2023-12-08 18:14:05 +01:00
Mike Yuan
b041175e08
core/executor: save argv for later use by rename_process()
Partially fixes #30352
2023-12-08 21:49:27 +08:00
Mike Yuan
c0e82e3a23
core/exec-invoke: voidify one rename_process call 2023-12-08 19:46:53 +08:00
Daan De Meyer
4ae703b2b5 repart: Don't look for --make-ddi= definitions inside --root=
It doesn't really make sense to go looking for these inside the
given root directory. While we should resolve specifiers and such
based on the given root directory, let's look up the image definitions
on the host system as there's a good chance they're coupled to the
repart version we're using so there's all kinds of chances for problems
if we use the definitions from the image we're building instead of those
from the host.
2023-12-08 09:33:24 +01:00
Luca Boccassi
6c75eff6af core: create workdir/upperdir when mounting a Type=overlay mount unit
So far we created the target directory, and the source for bind mounts,
but not workdir/upperdir for overlays, so it has to be done separately
and strictly before the unit is started, which is annoying. Check the
options when creating directories, and if upper/work directories are
specified, create them.
2023-12-08 11:22:14 +09:00
Frantisek Sumsal
fe6e0cfa19 install: don't translate unit instances to paths when reenabling them
For unit instances install_info_discover() returns path to the template,
which then generates confusing errors when passed to
do_unit_file_enable():

~# build/systemctl --root=/tmp/systemctl-test.N9ysbz reenable templ1@two.service
Unit name: templ1@two.service; p: /etc/systemd/system/templ1@.service
Removed "/tmp/systemctl-test.N9ysbz/etc/systemd/system/services.target.wants/templ1@two.service".
Failed to reenable templ1@.service, destination unit services.target is a non-template unit.

This can also be seen with a different reproducer using getty@.service
and a simple bind mount to / - there's no error this time, but it tries
to create a symlink for the default instance (from DefaultInstance=tty1),
which is also incorrect:

~# SYSTEMD_LOG_LEVEL=debug systemctl --root /mnt/bindroot/ reenable getty@test.service
Symlink /mnt/bindroot/etc/systemd/system/getty.target.wants/getty@tty1.service → /usr/lib/systemd/system/getty@.service already exists

Follow-up to: 29a7c59abb
Resolves: #24740
2023-12-08 11:20:12 +09:00