Commit Graph
46559 Commits
Author SHA1 Message Date
Yu Watanabe 997ba18af1 find-esp: do not skip fstype check even when --root= or --image= is specified
The check was introduced by 63105f33ed,
but there is no reason to skip the check even in such cases.
2023-12-13 14:19:28 +09:00
Yu Watanabe 9bbd3c699c find-esp: introduce verify_esp_flags_init() helper function
And split VERIFY_ESP_RELAX_CHECKS into two.

No functional change, just refactoring.
2023-12-13 14:19:28 +09:00
Yu Watanabe 5c831ddec8 find-esp: do not fail when /boot on btrfs RAID on searching ESP or xbootldr
When /boot or friends is on btrfs RAID, btrfs_get_block_device_at() will
succeed with 0 and provide zero devnum. Then,
- if we are previleged, devname_from_devnum() maps the devnum to
  /run/systemd/inaccessible/blk, and the subsequent verification by blkid
  will fail,
- if we are unprevileged, sd_device_new_from_devnum() will fail.

This makes
- when find_esp() or find_xbootldr() is called without any paths, that
  is, called with the searching mode, then returns -ENOKEY, which should
  be handled gracefully by the caller,
- when they are called with an input path, then they provide the proper
  error message and suggestion.

Fixes RHBZ#2251262 (https://bugzilla.redhat.com/show_bug.cgi?id=2251262).
2023-12-13 14:19:28 +09:00
Yu Watanabe 0977039bdc Merge pull request #30433 from yuwata/network-nexthop-cleanups
network: introduce ManageForeignNextHops=
2023-12-13 14:16:27 +09:00
Yu Watanabe 740539835a Merge pull request #30453 from poettering/dissect-fixes
dissect-image: various fixes
2023-12-13 14:15:05 +09:00
Lennart Poettering 748e87a791 dissect-tool: right-align the partition number
The right-alignment was applied to the wrong column, because neither
ee8e497d24 nor
1474d7ac2d updated the column count as
they should have.
2023-12-13 00:56:48 +00:00
David Tardon 38e1035bef openssl-util: avoid freeing invalid pointer 2023-12-13 07:28:30 +08:00
Lennart Poettering 3f8229fbb0 dissect-image: move comment to right place
The image name is extracted from the image path originally passed in,
i.e. not the contents of the image. And the image UUID is directly
retrieved from the partition table, hence also not from the contents.
Let's hence move the comment to separate out the stuff extract from the
file systems (and thus only available when mounting/with privs/with
block devices) from the data available without any of that.
2023-12-12 16:20:10 +01:00
Lennart Poettering 8d5e61db43 dissect-image: fix fd leak in dissected_image_acquire_metadata()
We have to go through the "finish" label to properly close all pipes in
the error path, so that we don't leak them.
2023-12-12 16:19:50 +01:00
Lennart Poettering a8e8bcfb7d dissect-image: don't try to validate an extension release file with no image name
Otherwise we might validate the OS release file instead…
2023-12-12 16:19:31 +01:00
Lennart Poettering 29b4db7ede dissect-image: handle 'continue' event in metadata acquisition uniformly
Let's jump to the same label in all cases, that closes the associated
pipe, systematically.
2023-12-12 16:19:21 +01:00
Lennart Poettering 3ee413e632 dissect-image: path[] is now defined for all metadata fields
There's no point in handling a case that never can happen.
2023-12-12 16:19:05 +01:00
Lennart Poettering 026a8b022e execute: improve log message about TTY ownership reset failures 2023-12-12 16:06:08 +01:00
Yu Watanabe bbc05bec98 network/nexthop: introduce ManageForeignNextHops= boolean setting
Closes #29034.
2023-12-12 23:51:10 +09:00
Lennart Poettering f121efd392 execute: handle gracefully if we cannot lock /dev/console when resetting tty due to perms
This is the common case in --user instances, hence handle this
gracefully.

This should be safe since user instances won't get access to
/dev/console-related ttys anyway, but only their own ptys.
2023-12-12 22:02:12 +09:00
Yu Watanabe 1c860010ce Merge pull request #30441 from poettering/nspawn-fixlets
nspawn: two trivial nspawn tweaklets
2023-12-12 22:00:35 +09:00
Yu Watanabe 61738a1a92 Merge pull request #30437 from YHNdnzj/job-start-msg
core/job: emit job start message if we're only waiting for unit state
2023-12-12 21:59:34 +09:00
Mike Yuan 6cfce71b50 hibernate-resume: don't wait forever if hibernate info is from EFI 2023-12-12 12:36:58 +00:00
Lennart Poettering af255804b2 nspawn: drop redundant assignments 2023-12-12 12:06:34 +01:00
Lennart Poettering 1f87cc8cd9 nspawn: suffix some paths in log messages with /, as per coding style 2023-12-12 12:06:21 +01:00
Yu Watanabe 2527b725ba Merge pull request #30156 from yuwata/network-mtu
network: accept arbitrary size of MTU in .network
2023-12-12 19:03:21 +09:00
Yu Watanabe b0e2245219 Merge pull request #30426 from mrc0mmand/nft-shenanigans
network: show the reason why NFT operation failed
2023-12-12 18:56:57 +09:00
Frantisek Sumsal b7d435925d network: actually show the unexpected flags
The original version would yield a slightly _unexpected_ message for
this [Address] section:

[Address]
Address=10.9.3.1/24
HomeAddress=yes
ManageTemporaryAddress=yes

systemd-networkd[68396]: /run/systemd/network/25-address-static.network: unexpected address flags "n/a" were configured. Ignoring [Address] section from line 144.

Let's instead show the unexpected flags:

systemd-networkd[69160]: /run/systemd/network/25-address-static.network: unexpected address flags "home-address,manage-temporary-address" were configured. Ignoring [Address] section from line 144.
2023-12-12 18:56:43 +09:00
Mike Yuan d8deb18720 core/job: emit job start message if we're only waiting for unit state
Currently, start/stop messages for device units are not used, since
job_perform_on_unit() does nothing and we simply wait for unit status
change. I think we still want some nice log messages explaining what
the start jobs for devices are doing, so let's fix this.
2023-12-12 17:04:30 +08:00
Mike Yuan 3f4a7a472f core/device: add stopping job message
The use case for stopping a device unit is indeed narrow,
but we still want to show a clear message.

Preparation for later commits.
2023-12-12 16:45:30 +08:00
Yu Watanabe 60f4cfe4fc network: drop redundant 'struct' 2023-12-11 20:11:06 +00:00
Luca Boccassi bf8726d1ee Merge pull request #30363 from yuwata/analyze-find-template
analyze: also find template unit when an instance is specified
2023-12-11 15:56:21 +00:00
Luca Boccassi 1eeaa93de3 executor: don't duplicate FD array to avoid double closing
Just use ExecParam directly, as these are all internal to sd-exec now
anyway. Avoids double close when execution fails after FDs are set up
for inheritance and were already re-arranged.

Fixes https://github.com/systemd/systemd/issues/30412
2023-12-11 15:55:50 +00:00
Yu Watanabe a9235a9488 Merge pull request #30422 from yuwata/network-tiny-fixes
network: tiny fixes
2023-12-12 00:23:11 +09:00
Frantisek Sumsal 13b8fb98b9 network: show the reason why NFT operation failed 2023-12-11 15:28:02 +01:00
Frantisek Sumsal 4d9a30f14f network: add a missing space 2023-12-11 14:50:32 +01:00
Daan De Meyer dbab005645 kernel-install: Fix inspect with --root= when no version is specified
Using the kernel version from the host is incorrect in this case, so
fix the logic so it handles no version being specified correctly with
--root=.
2023-12-11 12:06:51 +00:00
ksaleem 9fb2a61830 bootctl: fix case-sensitive comparisons in reporting bootloader entries
Fixes #30159
2023-12-11 10:51:56 +00:00
Yu Watanabe 004e22412e Merge pull request #30389 from keszybz/test-ukify-du
Remove temporary directories created by test_ukify
2023-12-11 18:37:05 +09:00
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 WatanabeandJeff King 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
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
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 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 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 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