Commit graph

72040 commits

Author SHA1 Message Date
Yu Watanabe d47f83302e sd-dhcp-server: rearrange the parser of the leases file
No functional changes, just refactoring and preparation for later
commits.
2024-03-15 04:15:10 +09:00
Yu Watanabe 11b88419ae sd-dhcp-server: make sd_dhcp_server_set_lease_file() optionally take directory fd
Currently, though, no valid directory fd is passed to the function call.
Preparation for later commits.
2024-03-15 04:15:10 +09:00
Yu Watanabe 6e0abf5fb3 docs: fix typo
Follow-up for 34c6b7d9de.
2024-03-15 04:04:01 +09:00
Yu Watanabe 66c4be596e ptyfwd: drop redundant brackets 2024-03-15 03:47:26 +09:00
Yu Watanabe 0d1606df0b ptyfwd: do not erase line after NL
Otherwise, moving upwards in 'less' does not work.

Follow-up for d0aa368c85.
2024-03-15 03:47:04 +09:00
Yu Watanabe e852f10cb4 kbd-util: allow to override the default keymap directories
This introduces $SYSTEMD_KEYMAP_DIRECTORIES environment variable to
override the hardcoded keymap directories.

I think it is not necessary to provide the first class configuration
option for controlling the keymap directories, but it is not good to
hardcode the paths. So, let's introduce an environment variable to
override that.

Prompted by #31759.

Closes #31759.
2024-03-15 03:19:45 +09:00
Yu Watanabe 361c5b4beb locale: use O_PATH directory fd and faccessat() in find_converted_keymap()
Previously, it is assumed that the paths in KBD_KEYMAP_DIRS are ended
with a slash. But, in the next commit, paths will become controllable by
users, and each path may not be ended with a slash.

This should not change any effective behaviors.
Just refactoring and preparation.
2024-03-15 03:15:57 +09:00
Lennart Poettering afd20791ef update TODO 2024-03-14 19:09:55 +01:00
Lennart Poettering f63c1ada25
Merge pull request #31739 from poettering/pid1-sd-notify-tweaks
pid1: send various notifications via sd_notify() reporting boot progress
2024-03-14 18:43:57 +01:00
Yu Watanabe 134fe8d274 network: introduce link_requeue_request() 2024-03-15 02:28:48 +09:00
Yu Watanabe c91f8f90ba network: use link_start_dhcp4_server() at one more place
Otherwise, even if the persistent storage is not ready, the DHCP server
may be started e.g. by unplugging and plugging cable.

Follow-up for 5582b36c38.
2024-03-15 02:28:38 +09:00
Adrian Wannenmacher c6d0c6688e man: fix efi var vendor uuid for systemd-bless-boot.service
The specified vendor UUID is not actually a UUID. This changes it to an actual UUID.

The new value matches the ones from the systemd-boot man page and [The Boot Loader Interface](https://systemd.io/BOOT_LOADER_INTERFACE/).
2024-03-14 16:54:49 +00:00
Lennart Poettering 34c6b7d9de docs: add a new document describing the VM interface of systemd
This mirrors the existing CONTAINER_INTERFACE.md document, but describes
extension points of systemd running in a VM with a machine manager
supervising it.
2024-03-14 17:25:04 +01:00
Lennart Poettering 83797ece91 docs: update various links 2024-03-14 17:25:00 +01:00
Lennart Poettering b6a24b87c1 docs: properly line break WRITING_VM_AND_CONTAINER_MANAGERS.md 2024-03-14 17:24:57 +01:00
Lennart Poettering 1e785c50c9 docs: document new sd_notify() extensions 2024-03-14 17:24:24 +01:00
Lennart Poettering e6ceea090a nspawn: add some debug logging for sd_notify() messages received by the container manager 2024-03-14 17:24:20 +01:00
Lennart Poettering 6dfa0a9d4c manager: send an sd_notify() message informing the container manager when systemd's special UNIX signals become available
From the outside it's difficult to determine whether (and when) the PID1
inside a container supports systemd's more complete set of UNIX process
signals or not. Let's make this easier, and simply send a notification
message when we are ready.
2024-03-14 17:24:16 +01:00
Lennart Poettering e62731f942 manager: modernize code that enables special signal delivery to PID 1 2024-03-14 17:24:13 +01:00
Lennart Poettering 95be59f907 ssh-generator: introduce ssh-access.target
This new passive target is supposed to be pulled in by SSH
implementations and should be reached when remote SSH access is
possible. The idea is that this target can be used as indicator for
other components to determine if and when SSH access is possible.

One specific usecase for this is the new sd_notify() logic in PID 1 that
sends its own supervisor notifications whenever target units are
reached. This can be used to precisely schedule SSH connections from
host to VM/container, or just to identify systems where SSH is even
available.
2024-03-14 17:23:28 +01:00
Lennart Poettering b2d6bb5b34 core: notify supervisor over targets we reach, as we reach them
Let's inform the the supervisor about various happenings of our service
manager, specifically the boot milestones we reach.

We so far have only a singular READY=1 message, to inform about bootup
completion. But sometimes it is interesting to have something for
finegrained, in particular something that indicates optional components
that have been activated.

Usecase for this: in a later PR I intend to introduce a generic
"ssh.target" that is supposed to be activated when SSH becomes available
on a host. A supervisor (i.e. a VMM/hypervisor/container mgr/…) can
watch for that, and know two things:

1. that SSH is generally available in the system
2. when it is available

In order to not flood the supervisor with events I only send these out
for target units. We could open this up later, in theory, but I think it
makes sense to tell people instead to define clear milestone target
units if they want a supervisor to be able to track system state.
2024-03-14 17:23:10 +01:00
Lennart Poettering ad60cdd050 manager: clean up audit/plymouth code a bit
Let's add assert()s, and let's put checks in similar order to emphasize
the symmetry. Also let's do cheap checks first.
2024-03-14 17:23:06 +01:00
Lennart Poettering e516c4d286 machine-id-setup: inform supervisor about chosen machine ID
Similar as the previous commit, it's useful for a supervisor to know
what machine ID we settlted on, in particular as various other things
are deterministically derived from it, for example MAC addresses and
such.
2024-03-14 17:23:02 +01:00
Lennart Poettering 2f3b55c4f1 hostname-setup: send chosen hostname to supervisor via sd_notify()
once we decided on a hostname, let's tell the supervisor about it. This
is useful for example in order to recognize the system via mDNS/LLMNR or
in a DHCP lease.
2024-03-14 17:22:58 +01:00
Lennart Poettering 5a515940e9 hostname-setup: various modernizations 2024-03-14 17:22:54 +01:00
Lennart Poettering 37d15cd132 manager: make manager_send_ready() more symmetric regarding per-user/per-service scope
Always check the scope explicitly, always assert(m), and name the two
functions in a symmetric way.
2024-03-14 17:22:49 +01:00
Lennart Poettering fb44dc646b core: normalize how we issue sd_notify() from PID 1
Always cast to (void) if we ignore the return value.

Always pass the first arg as boolean.

Always prefix the first arg with /* unset_environment= */.
2024-03-14 17:20:46 +01:00
Yu Watanabe 6b67cf808a json: introduce json_dispatch_int8() and json_dispatch_uint8() 2024-03-14 23:56:44 +08:00
Yu Watanabe d30d44883f stat-util: expose fd_is_read_only_fs()
Currently it is not used, but the fucntion is already quite generic and
useful.
2024-03-14 23:45:27 +08:00
Piotr Drąg 2c75cb8b51 po: add pkg/debian to POTFILES.skip
Debian packaging includes the exploded tarball, so scripts used to
detect files that should be in POTFILES.in, like intltool-update -m
used on https://l10n.gnome.org/module/systemd/, falsely detect its
files as needed to be translated. Avoid this behavior by putting
the whole submodule in POTFILES.skip.
2024-03-14 13:41:56 +00:00
Mike Yuan cd804013a6 shell-completion: add systemd-cat --namespace=
Follow-up for 45bcab66a9

Addresses https://github.com/systemd/systemd/pull/31754#discussion_r1524715062
2024-03-14 13:07:19 +00:00
Sam Leonard 071155a1fb
ssh-generator: support ssh.ephemeral-key.all-users 2024-03-14 11:55:54 +00:00
Sam Leonard 2042aebb55
vmspawn: generate ephemeral SSH keys for the VM 2024-03-14 11:55:54 +00:00
Yu Watanabe cdafb51ab4
Merge pull request #31754 from YHNdnzj/journal-fd-namespace
journal/cat: allow connecting output to specific journal namespace
2024-03-14 19:59:19 +09:00
Zbigniew Jędrzejewski-Szmek a954b427e9 src/partition: remove unnecessary uses of "make sure" 2024-03-14 11:15:55 +01:00
Zbigniew Jędrzejewski-Szmek 25e98e331d units: retitle systemd-bootctl*.{service,socket}
"Starting Boot Control…" would be a fairly confusing message in the boot logs.
Use "… Service" to mirror what we have in other services like
systemd-{hostnamed,timedated,portabled,machined,…}.service.
2024-03-14 11:15:55 +01:00
Zbigniew Jędrzejewski-Szmek 3986aa6d08 units: drop "(Varlink)"
We generally don't specify the protocol implementation in unit descriptions.

For journald, we have:
  $ git grep Description 'units/*journald*'
  units/systemd-journald-audit.socket:Description=Journal Audit Socket
  units/systemd-journald-dev-log.socket:Description=Journal Socket (/dev/log)
  units/systemd-journald-varlink@.socket:Description=Journal Varlink Socket for Namespace %i
  units/systemd-journald.service.in:Description=Journal Service
  units/systemd-journald.socket:Description=Journal Sockets
  units/systemd-journald@.service.in:Description=Journal Service for Namespace %i
  units/systemd-journald@.socket:Description=Journal Sockets for Namespace %i
so we need to keep "Varlink" in the name. But also use "Sockets" (plural)
for the "main" socket unit, since it opens multiple sockets.
2024-03-14 11:14:10 +01:00
Zbigniew Jędrzejewski-Szmek 8a753717f8 tools/elf2efi: rework exception messages
RuntimeError is documented as "Unspecified run-time error". It doesn't make
much sense for Python. (It originated in Java, where exceptions that can be
thrown by a function are declared in the function signature. All code calling
such a function must either explicitly catch all possible exception types, or
allow them to propagate by listing them in its own exception type list. This is
nice in theory, but in practice very annoying. Especially during development,
when the list of possible exception types is not finalized, we would end up
adding and removing exceptions to functions signatures all the time. Also for
code which is designed to call functions recursively, we would soon end up with
all functions declaring all possible exception types… To avoid this, people
would quite often do fake handling with a block that either prints and ignores
an exception, or has just a comment like "fix me later", or even nothing. This
often lead to people forgetting to adjust this later on and production code
containing such constructs. An escape hatch was opened with RuntimeException and
its subclasses, which do not need to be pre-declared. Various memory-related
exceptions were added as subclasses of RuntimeException. But later on, people
starting using this to not to have to declare all exception types everywhere.)

In Python, exceptions do no have to be pre-declared, and for code which just
encounters a failure, we should raise a specific exception type. The catch-all
class for unexpected input is ValueError.

For https://github.com/systemd/systemd/issues/31637:
BadSectionError: Section '.data' @0x28000 overlaps previous section @0x28000+0x300=@0x28300

Also, exception strings should not contain trailing periods, because they are
often embedded in sentences.
2024-03-14 11:08:41 +01:00
Lennart Poettering 7b14f85cd8 man: shorten unnecessarily long example 2024-03-14 11:05:04 +01:00
Lennart Poettering 837eda0522
Merge pull request #31770 from poettering/linkat-replace
introduce linkat_replace() helper, and port various things over to it
2024-03-14 11:03:59 +01:00
Zbigniew Jędrzejewski-Szmek 642f991b70 tools/elf2efi: split out function to create parser
main() is supposed to be lean and mean.
2024-03-14 10:32:17 +01:00
Zbigniew Jędrzejewski-Szmek a0797b4ad7 tools/elf2efi: align columns in tables, unify formatting
For tables which represent binary data structures, readability is greatly
enhanced if the part which shows field size and type is aligned. This follows
the usual style for tables in the rest of the systemd codebase.

Also, use the same style for functions: if the function signature is too long
to fit in one line, put each parameter on a separate line.

Also, for comprehension expressions, if they are split, use the usual Python
style.

Also, drop format annotations, since the code isn't automatically formatted
anymore, and automatic formatting is neither feasible nor a goal for the
systemd codebase.
2024-03-14 10:32:17 +01:00
Zbigniew Jędrzejewski-Szmek 4fd9ed3e41 units/systemd-machine-id-commit: retitle
Our docs say that the Description should be capitalized.
Also, change "commit" to "save" to make this more accessible.
2024-03-14 10:26:45 +01:00
Zbigniew Jędrzejewski-Szmek 3719dcb0bc units: retitle systemd-pcrextend.{service,socket}, change TPM2→TPM
I was looking at the logs in some bug and saw this:

Mar 13 15:55:12 fedora systemd[1]: systemd-pcrmachine.service - TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
Mar 13 15:55:12 fedora systemd[1]: Starting systemd-remount-fs.service - Remount Root and Kernel File Systems...
Mar 13 15:55:12 fedora systemd[1]: systemd-tpm2-setup-early.service - TPM2 SRK Setup (Early) was skipped because of an unmet condition check (ConditionSecurity=measured-uki).

This is overly technical, for most units we don't provide this level of
detail about the implementation. So retitle the units to be more accessible.

Also, the fact that it's a v. 2 of the TPM is not that important. We don't
support TPM 1.2, but computers without TPM v2 are getting rare. For other
units we don't advertise the version of hardware, and let's not do this here,
to reduce some complexity.
2024-03-14 10:26:45 +01:00
Yu Watanabe af02814a85 ptyfwd: fix typo
Follow-up for d0aa368c85.
2024-03-14 17:40:26 +09:00
Yu Watanabe fcaa510597 TODO: fix typo
Follow-up for 54b0e05ed0.
2024-03-14 17:39:12 +09:00
Yu Watanabe f03caa0d3e stat-util: fix typo
Follow-up for 7cff2b79f0.
2024-03-14 17:37:50 +09:00
Lennart Poettering 5655e5c955 creds-util: port make_credential_host_secret() over to link_tmpfile_at()
Let's simplify things by just reusing the primitives we already have.
2024-03-14 09:22:09 +01:00
Lennart Poettering ccec206498 tmpfile-util: port link_tmpfile_at() over to linkat_replace() 2024-03-14 09:22:09 +01:00
Lennart Poettering 1f27e7b724 fs-util: add new helper linkat_replace() 2024-03-14 09:22:09 +01:00