Commit graph

67872 commits

Author SHA1 Message Date
Reto Schneider b1b16aa977 man/systemd.exec: Update service result table
exec-condition and oom-kill were added without updating this table.
2023-10-12 12:30:21 +02:00
Zbigniew Jędrzejewski-Szmek fed0a899b2 hibernate-resume: remove kernel/image version comparison when resuming
We already had a similar check that was removed, see
8340b762e4 (*). The kernel supports loading of a
resume image from a different kernel version. This makes sense, because the
goal of "resume" is to replace the running system by a saved memory image, so
it doesn't really matter that the short-lived kernel is different.

By removing the check, we make the process more reliable: for example, the user
may select a different kernel from a list, or not have the previously running
kernel in /boot at all, etc. Requiring the exact same kernel version makes the
process more fragile for no benefit.

Similar reasoning holds for the image version: the image may be updated, and
for example an older kernel+initrd might be used, with an embedded VERSION_ID
that is not the latest. This is fine, and the check is not useful.

I left the check for ID/IMAGE_ID: we probably don't want to use the resume
image if the hibernation was done from a different installation.

(Note: why not check VERSION_ID/IMAGE_VERSION? Because of the following
scenario: a user has an installation of Fedora 35, and they upgrade to Fedora
36, which means that the os-release file on disk gets replaced and now
specifies VERSION_ID=36. But the running kernel is not replaced, and its
package is not removed because the running kernel version is never removed, so
we still have a boot entry that in initrd-release says VERSION_ID=35. Without
rebooting, the user does hibernation. When resuming, we want to resume, no
matter if one of the new entries with VERSION_ID=36 or one of the old entries
with VERSION_ID=35 is picked in the boot loader menu.

If the installation is image-based, i.e. it has IMAGE_ID+IMAGE_VERSION, the
situation is similar: after an upgrade, we may still have an boot entry from
before the upgrade. Using an older kernel+initrd to boot and switch-root into a
newer installation is supported and is rather common.

In fact, it is a rather common situation that the version reported by the boot
entry (or stored internally in the initrd-release in the initrd) does not match
the actual system on disk. Generally, this metadata is saved when the boot menu
entry is written and does not reflect subsequent upgrades. Various
distributions generally keep at least 3 kernels after a upgrade, and during an
upgrade only install one new, which means that after a major upgrade, generally
there will be at least two kernels which have mismatched version information.)

OTOH, I think it is useful to *write* all the details to the EFI var. As
discussed in https://github.com/systemd/systemd/issues/29037, we may want to
show this information in the boot loader. It is also useful for debugging.

(*) Also again discussed and verified in
https://github.com/systemd/systemd/pull/27330#discussion_r1234332080.

", ignored" is dropped, since this failure is likely to cause the following
check to fail. Better not to say anything then to say the misleading thing.
2023-10-12 12:30:12 +02:00
Jordan Williams 465104b4d4 Revert "Revert "meson: use c_args in generator scripts (#10289)""
This reverts commit 0e3cc902fa.

Fixes #10288.
I have confirmed that this does now fix cross-compilation.
It appears that changes upstream in Meson, probably mesonbuild/meson#5263, have made the original MR, #10289, work now.

This needs to be tested to ensure that it doesn't break Travis CI like when it was reverted in #10361.
2023-10-12 12:24:57 +02:00
Lennart Poettering 9ff6876555
Merge pull request #29523 from keszybz/kernel-install-dtb-files
Do not look for dtb files in /boot, add support in 60-ukify.install
2023-10-12 10:43:24 +02:00
Yu Watanabe 9a551ccd1f
Merge pull request #29472 from yuwata/network-dhcp-ipv6-only-mode
network/dhcp: add IPv6 only mode support
2023-10-12 13:06:54 +09:00
Michael Biebl 6f9409eebb test: use kill-whom instead of kill-who (the latter is deprecated) 2023-10-12 13:06:12 +09:00
Mike Yuan 242fc1427a
Merge pull request #29537 from poettering/varlink-tweaks
varlink: some smaller usability tweaks + bugfixes
2023-10-12 02:36:37 +08:00
Mike Yuan 2cb6b3b734 core/exec-credential: use rmdir_and_freep at one more place 2023-10-12 02:36:15 +08:00
Yu Watanabe 3bb424c837 core/execute: suppress logs if LogLevelMax= is specified
Fixes #29532.
2023-10-12 02:35:57 +08:00
Daan De Meyer fe2a6dce6c sd-device: Support matching all properties
Let's support enumerating over devices that match all of the given
properties instead of any of the given properties by adding a new
function sd_device_enumerator_add_match_property_required() which
specifies properties that should all be matched instead of just one.

Fixes #28372
2023-10-11 19:57:49 +02:00
Lennart Poettering 9f3ed6fd19 update TODO 2023-10-11 18:20:16 +02:00
Lennart Poettering 80f6507c83 varlink: use the right validator for error replies 2023-10-11 18:19:36 +02:00
Lennart Poettering 041a66b843 varlink: didn't generate a varlink error reply if a failed method call handler already did
It might happen that a method call handler already generated an error
reply and then still propagated the error back to the varlink logic.
Let's not try to generate a 2nd reply from that error code then, but
simply proceed without. This simplifies handling of errors in method
call handlers, because they can uniformly return errno-style error
codes, and only if they want return a full Varlink errror.
2023-10-11 18:19:36 +02:00
Lennart Poettering c270fc448e varlink: don't bother replying about validation errors on method calls with 'oneway' set 2023-10-11 18:19:36 +02:00
Lennart Poettering 47c9bbb1ab varlink: automatically send ExpectedMore error message back when we were called without more=true set, but need it
Various Varlink calls only make sense if they are called with more=true
(i.e. in a mode where multiple replies are expected to be sent). If a
method call assumes it is called with more (manifested in the fact it
calls varlink_notify(), the call to reply to such messages) let's return
a recognizable error code for the violated expectation.

This adds a new error for this, org.varlink.service.ExpectedMore. Note
we are squatting the official org.varlink.service namespace, but for
such a basic thing it makes sense to add it there.
2023-10-11 18:19:36 +02:00
Zbigniew Jędrzejewski-Szmek 02d8d787f3 kernel-install/60-ukify: also support the convention with 'devicetree' file
Requested in https://github.com/systemd/systemd/pull/28582#issuecomment-1673300596.
The is the last requested changed, so fixes #28771.

90-loaderentry.install is modified to also check $KERNEL_INSTALL_CONF_ROOT
when looking for the devicetree file. For normal use this is probably not
needed, but it's nice to be consistent and it also makes it much easier to
write the tests.

In tests, also do 'ukify inspect' now that we have it.
2023-10-11 17:34:43 +02:00
Zbigniew Jędrzejewski-Szmek e3696e6f63 ukify: fix .dtb section name in 'inspect'
Fixup for df4a46733a.
2023-10-11 17:34:43 +02:00
Zbigniew Jędrzejewski-Szmek 40c0c9d4bc kernel-install/60-ukify: add helper function for locating input files
Also rename config_file_location() to uki_conf_location() to make
it obvious which config file was meant.
2023-10-11 17:34:43 +02:00
Zbigniew Jędrzejewski-Szmek 7a9d86bceb man/kernel-install: fix formatting and document /etc/kernel/devicetree
Each filename should be a separate <term>, so that they separated in the
formatted text. Also, we list files in documentation in priority order, but
here they were in reverse order. Also, rework the description of
$KERNEL_INSTALL_CONF_ROOT to say that it makes kernel-install not look at the
other files. This requires some more words, so make this a separate paragraph
and refer from individual items to it. Also, drop some sentences with "Read by
...", they were already outdated.

Partial fix for #28771.

Co-authored-by: Emil Renner Berthing <systemd@esmil.dk>
2023-10-11 17:34:43 +02:00
Zbigniew Jędrzejewski-Szmek 91767ab082 kernel-install/90-loaderentry: do not read dtbs from /boot
/boot is not trusted, so we shouldn't use load files from there. Also, space in
/boot is limited, so it doesn't make sense to install the files under one
location there and then copy them to a different location. We should only copy
the files from /usr somewhere and then install it in the appropriate place under
/boot.

Also use "/usr/lib" instead of the "/lib" prefix. We don't support unmerged-user
anymore.

Addresses some of the feedback in
https://github.com/systemd/systemd/pull/28582#discussion_r1285820556.
2023-10-11 17:28:29 +02:00
PhylLu 4f10005e17 timedate: Extend timeout for setting NTP
One of the steps in setting up NTP is to enable/disable the
'systemd-timesyncd.service' and then perform a daemon reload.
we use an extra-long timeout for reload in timedated as same as used in
systemd daemon reload to avoiding certain situation have longer reload
times (which exceed the 25 second default timeout used for
dbus-communication), potentially leading to setting NTP failure.
2023-10-11 17:06:16 +02:00
Michal Sekletar 7ad3a37022 dns-domain: fix the RFC reference 2023-10-11 23:09:18 +09:00
Yu Watanabe 46f2eb517c test-network: add tests for DHCP IPv6 only mode
For [DHCPv4] IPv6OnlyMode= and [DHCPServer] IPv6OnlyPreferredSec=.
2023-10-11 21:42:13 +09:00
Yu Watanabe fc35a9f8d1 network/dhcp4: support IPv6 only mode (RFC 8925)
Co-authored-by: Susant Sahani <ssahani@gmail.com>
2023-10-11 21:42:13 +09:00
Yu Watanabe a91b888fff sd-dhcp-client: support IPv6 only mode
This makes sd-dhcp-client optionally request IPv6 only preferred
option (RFC 8925).
2023-10-11 21:42:13 +09:00
Susant Sahani 34bea0a1e9 network/dhcp-server: allow to configure IPv6 only preferred option
Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2023-10-11 21:42:13 +09:00
Susant Sahani 14bd102e3c sd-dhcp-server: support IPv6 only mode
This makes sd-dhcp-server send IPv6 only preferred option (RFC 8925).

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2023-10-11 21:42:13 +09:00
Mike Yuan a65f67aeaf
Merge pull request #29530 from poettering/debug-log-tweaks
pid1: various debug logging tweaks
2023-10-11 20:29:00 +08:00
Lennart Poettering ce4801c42b doc: readd vanished ```
This disappeared in 1e8f5f79e1, let's
restore it.
2023-10-11 11:41:56 +02:00
Lennart Poettering 6fd38dc83a killall: suppress debug log if some cgroup doesn't have survive_final_kill_signal xattr set
This is the default case, hence really no reason to be noisy about that.
2023-10-11 11:39:48 +02:00
Lennart Poettering 58f1bd9b4a bpf-lsm: suppress noisy debug log message if we remove a unit from the bpf-lsm table where it was never added
There's really no point in logging about one of the most common cases we
have: that no BPF-LSM policy was installed for a specific unit.
2023-10-11 11:39:48 +02:00
Lennart Poettering 91a6447607 fdset: improve debug logging for left-over fds
Let's show which fds are closed as part of the left-over fd set logic on
daemon reload/reexec cycles.

This is useful to debug accidentally unclaimed fds.
2023-10-11 11:39:48 +02:00
Luca Boccassi 86f99bdbe1 docs: clarify difference between kernel stub and sd-stub in UEFI doc 2023-10-11 10:33:38 +01:00
Lennart Poettering bde7e12255 limits-util: suppress noisy debug message when reading tasks in top-level cgroup
We have the "tasks.max" cgroup attribute only if we run in a cgroup
namespace, but not on the host. Hence let's handle ENODATA silently
simply to reduce the debug noise generated.
2023-10-11 11:30:53 +02:00
Lennart Poettering 98d8c37595
Merge pull request #29427 from ddstreet/cryptenroll_specify_handle_index
Cryptenroll specify handle index
2023-10-11 10:47:01 +02:00
Roland Hieber 7c6dd20046 sd-gpt: add defines for big-endian MIPS/MIPS64
According to the respective change in the DPS:
<https://github.com/uapi-group/specifications/pull/86>

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
2023-10-11 10:10:49 +02:00
Lennart Poettering 79d956db34 namespace: make setup_namespace() less crazy
Let's replace the ridiculous number of arguments with a structure, to
make this function less weird.

No change in behaviour, just some refactoring.
2023-10-11 12:39:30 +09:00
Lennart Poettering 22d7fb6646 docs: document that in future we'll do EV_EVENT_TAG only, no EV_IPL 2023-10-10 23:31:33 +01:00
Mike Yuan e533dad10f loginctl: *-status: set minimum table column width if extra info will be printed
Follow-up for bf366954fa

Before this commit, we hardcode "prefix" to the widest field
possible in the table. However, there's no guarantee that the
field would actually be used/added, so it could potentially
result in misalignment. Therefore, let's set the minimum width
of the cell to the hardcoded width too.
2023-10-10 23:30:52 +01:00
Mike Yuan 8fff78a1dd networkctl: use proper vertical table for status
Also modernize macro definition and error handling.
2023-10-10 23:28:28 +01:00
Dan Streetman 9c18019787 tpm2: don't use GetCapability() to check transient handles
The kernel tpm "resource manager" interface doesn't report that any transient
handles exist, even if they do, so don't bother asking if the handle is
transient.
2023-10-10 16:55:39 -04:00
Laszlo Gombos 63947fede8 man: fix example for systemd.swap-extra 2023-10-10 21:44:45 +02:00
Lennart Poettering 66cd3537f9 dissect: don't show non-JSON arch + sector size in JSON mode 2023-10-10 21:44:20 +02:00
Abderrahim Kitouni e8868e8354 doc-sync: add support for uploading the documentation for main
It will refuse running on any other branch than main or stable branches.

Also update the release instructions to run it on the stable branch.
2023-10-10 17:50:04 +01:00
Mike Yuan 3759a17418 man/systemd.exec: document behavior of SetLoginEnvironment= when unset
Follow-up for 854eca4a95

Addresses https://github.com/systemd/systemd/pull/29493#discussion_r1351980046
2023-10-10 12:08:32 +01:00
Dan Streetman 1524184dd1 tpm2: do not call Esys_TR_Close()
Unfortunately, the tpm2-tss library doesn't reference count handles, and a call
to Esys_TR_Close() will remove the handle that could be in use by other
code. So stop calling Esys_TR_Close(), and leave the handle around until we
cleanup the entire ESYS_CONTEXT.
2023-10-10 05:56:45 -04:00
Dan Streetman adcd3266ec test: add tests for systemd-cryptenroll --tpm2-seal-key-handle
In TEST-70-TPM2, test systemd-cryptenroll --tpm2-seal-key-handle using the
default (0) as well as the SRK handle (0x81000001), and test using a non-SRK
handle index after creating and persisting a primary key.

In test/test-tpm2, test tpm2_seal() and tpm2_unseal() using default (0), the SRK
handle, and a transient handle.
2023-10-10 05:56:45 -04:00
Dan Streetman 382bfd90c3 cryptenroll: allow specifying handle index of key to use for sealing
This defaults to the SRK index.
2023-10-10 05:40:27 -04:00
Lennart Poettering b5ac77e9a5
Merge pull request #29493 from YHNdnzj/unit-always-set-user-home
core/execute: always set $USER and introduce SetLoginEnvironment=
2023-10-10 10:16:07 +02:00
Luca Boccassi 795e80c7ed
Merge pull request #29507 from abderrahim/doc-sync-improvement
Improvements to the doc-sync target
2023-10-10 08:59:33 +01:00