Commit Graph
91509 Commits
Author SHA1 Message Date
Stefan Agner 11e4e35f4c resolved: actually unregister DNS-SD services when the bus client vanishes
Since the D-Bus DNS-SD API was introduced in c3036641f0 ("resolved:
implement D-Bus API for DNS-SD", v236), RegisterService() has set up an
sd_bus_track object so that a registered service is destroyed when the
client that registered it disconnects from the bus — there's even a
handler logging "Client of active request vanished, destroying DNS-SD
service."

However, the track object was never stored anywhere: it is declared as
a _cleanup_(sd_bus_track_unrefp) local in bus_method_register_service()
and hence destroyed again when the method handler returns, taking the
tracking down with it. The vanish handler was thus dead code, and
services registered via D-Bus silently persisted after their client
disconnected — unowned, impossible to re-register (the identifier
stays taken, failing with DNSSD_SERVICE_EXISTS), and advertised until
systemd-resolved itself exited.

Store the track object in DnssdRegisteredService, pinning it for the
lifetime of the service, so that client tracking works as originally
intended. Route the vanish path through the full unregistration logic
(goodbye packets + removal from the per-link mDNS zones), since freeing
the service alone would leave its RRs published in the zones.

Note for fire-and-forget clients (e.g. one-shot busctl/gdbus calls):
these were never reliable — the registration silently vanished on any
resolved restart — and now behave as documented for the corresponding
Avahi API as well: the bus connection must be kept open for as long as
the service is to remain registered. Document that in the man page and
NEWS, and point to *.dnssd files for registrations independent of a
client's lifetime.
2026-09-02 10:40:34 +02:00
Stefan Agner a3a8e82f25 resolved: only send goodbye for the RRs of the service being unregistered
dns_scope_announce(scope, /* goodbye= */ true) is not scoped to a
specific service: it walks the whole per-link mDNS zone and flags every
established RR as goodbye (TTL 0). Unregistering a single DNS-SD
service via the UnregisterService() D-Bus call hence withdrew the
host's own A/AAAA records and every other published service on the
link from remote caches, with nothing re-announcing them afterwards.

Introduce dns_scope_send_goodbye(), which sends an unsolicited response
for a caller-provided RR set, and let the DNS-SD unregistration path
send goodbye only for the RRs of the service actually being removed,
mirroring the flag logic of dns_scope_announce().

The goodbye answer is built per scope, and only includes records
actually established in the respective zone (or under re-verification,
in which case they are still served from it): a per-service goodbye
must take care not to withdraw records that are still being probed for
uniqueness, were withdrawn again after a conflict (in which case the
name belongs to the neighbor), or were never published in the scope in
the first place (e.g. on MulticastDNS=resolve links, which have an mDNS
scope but do not publish DNS-SD services).

This becomes more important with the next commit, which promotes
unregistration from an explicit method call to an automatic consequence
of the registering client disconnecting from the bus.
2026-09-02 10:40:34 +02:00
Stefan Agner 27ea9761ac resolved: split out dnssd_registered_service_unregister() helper
Move the logic that sends goodbye messages, removes a registered DNS-SD
service's RRs from all mDNS zones and frees the service out of
bus_dnssd_method_unregister() into a new helper. While at it, add the
nowadays customary parameter comments and ", ignoring" log message
suffix to the moved code. No functional change.

This is preparation for unregistering services when the D-Bus client
that registered them disconnects: that path needs the full teardown as
well, not just dnssd_registered_service_free(), which would leave the
service's RRs published in the per-link mDNS zones.
2026-09-01 14:29:04 +02:00
Konstantin Shkolnyy d1697c4ff8 kmod-setup: support early loading for virtio-ccw devices
Before this change, the code checked for presence of virtio-pci
devices to decide whether transport-agnostic virtio drivers needed
to be loaded early.

Do it also if virtio-ccw devices are present, that is, devices with
the control unit type (CU type) 0x3832, under /sys/devices/css0.
(This CU type value is documented in "Virtio Over Channel I/O" virtio
specification section.)

In other words, extend to virtio-ccw devices the fix previously
done for virtio-pci:
  #40161: commit 356cc4a1c3
  #40503: commit 6d36e5fae6

Tested-by: Marc Hartmayer <marc@linux.ibm.com>
Reviewed-by: Marc Hartmayer <marc@linux.ibm.com>
2026-08-31 19:40:33 +09:00
Siteshwar Vashisht d56d8d43ee ukify: fix cleaning up a temporary file (#43544)
Current code does not hold a reference to object returned from
`tempfile.NamedTemporaryFile()`. This would cause the object to be
immediately garbage collected and the temporary file is deleted. A new
file is created with `linux.write_bytes()` which never gets cleaned up.
Keeping a reference to this object would automatically clean up the
temporary file when `make_uki()` function returns.
2026-08-31 17:18:07 +09:00
Siteshwar Vashisht a6a831d0d9 nsresourced: Fix reading from NULL pointers (#43566)
`TAKE_PTR(userns_name)` sets `userns_name` to `NULL` earlier.

Follow-up for ee6fd7ef82.
2026-08-31 17:10:20 +09:00
cverorg 91927a2a12 Revert "hwdb: add support for PineTab2 to 60-sensor.hwdb (#35304)"
This reverts commit bc4a027f9c.

The match key names the chip, not the machine. `of:N<name>T<type>C<compatible>`
describes the sensor node, and the Pine64 PineNote carries the same silan
sc7a20 mounted in a different orientation, so it presents an identical
modalias:

    $ cat /sys/bus/iio/devices/iio:device2/../modalias
    of:NaccelerometerT(null)Csilan,sc7a20

On a device-tree machine there is no `/sys/class/dmi/id/modalias` to narrow it
with, so 60-sensor.rules looks up `sensor:modalias:of:...:` with the DMI half
empty and both boards land on the one entry. A second, PineNote-scoped entry
cannot be written: it would carry the same match string and simply shadow the
first.

The entry also overrides a correct value. The PineNote's device tree supplies
the matrix and the kernel publishes it:

    $ cat /sys/bus/iio/devices/iio:device2/mount_matrix
    -1, 0, 0; 0, 1, 0; 0, 0, 1

but udev then replaces it with the PineTab2's, and the four orientations
collapse into two, both landscape -- iio-sensor-proxy only ever reports
`normal` and `bottom-up`, so the display never selects portrait.

Where the kernel supplies a mount matrix, hwdb has nothing to add here; where
it does not, a local hwdb entry remains available. Tested on a PineNote v1.2,
kernel 6.12.11, systemd 257.

Closes #43321
2026-08-31 07:18:52 +09:00
Bone NI 6ede84602c po: Translated using Weblate (Lao)
Currently translated at 100.0% (286 of 286 strings)

Co-authored-by: Bone NI <bounkirdni@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/lo/
Translation: systemd/main
2026-08-30 15:35:31 +09:00
Zbigniew Jędrzejewski-Szmek 048970650c List -V option in help and man (#43560) 2026-08-29 10:42:36 +02:00
Yu Watanabe e7e91b9bc1 man: also document -V option for udevd and run0
The option -V has been documented in their help message, but not in the
corresponding man pages.
2026-08-29 07:40:43 +09:00
Yu Watanabe 69a54c37ac options: introduce OPTION_COMMON_VERSION_WITH_V and version_only()
The man page udevadm(8) have explicitly documented that the option -V is
a short form of --version. Let's not hide the short form in the help
message.

This introduces OPTION_COMMON_VERSION_WITH_V then use it in udevadm,
udevd, and run0.

Alos, this moves print_version() to build.c, and renames it to
version_only(). Now the function is also used in udevd amd test-libudev.

With this change, the -V option is hidden only in dmi_memory_id and
scsi_id. So, this removes the OPTION_COMMON_VERSION_WITH_HIDDEN_V macro
and explicitly list the hidden option in their code.
2026-08-29 07:40:35 +09:00
Yu Watanabe 39cf979007 Final batch of conversions to COMMAND and additions of --introspect-cli (#43558) 2026-08-29 04:26:12 +09:00
Zbigniew Jędrzejewski-Szmek 852f193560 shared/format-table: make one more function static 2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek 52c063713e shared/verbs: drop unused variable
Also add a note that the function does not support multiple groups. I
think that's fair, it doesn't make sense to generalize the functionality
when we're unlikely to ever use that. (Verb options are only used by
udevadm right now.)
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek 05fb4c6e27 Ignore $SYSTEMD_INVOKED_AS if empty
Let's treat unset SYSTEMD_INVOKED_AS and SYSTEMD_INVOKED_AS='' the same.
I encountered this when testing various --help outputs. It is often
more convenient to override a variable with VAR= instead of removing it,
in particular on the commandline. But we'd then print help with the
program name missing. We look at the variable in two places, so adjust
both as in $subject.
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek d04d0b0627 shared: fold help-util.c into verbs.c
Only one trivial function needs to be non-static and that is not
enough to justify two separate files.
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek 8313fbb859 shared/verbs: drop help helpers obsoleted by the COMMAND conversions
All programs print their help through the COMMAND machinery now:

- the VERB_COMMON_HELP() and VERB_COMMON_HELP_HIDDEN() macros which
  wired the help verb to a hand-written help() implementation are
  unused — everything uses the VERB_COMMON_HELP_AUTO*() family,

- the verbs help table is only built internally, so the function
  becomes static, as the TODO promised,

- help_abstract() and help_man_page_reference() are unused — the
  generated help renders the abstract via print_wrapped() and the man
  page links via print_man_links().
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek e90de9e2db shared/options: drop option_parser_get_help_table() and its wrappers
The hand-written help() functions were the only users of the
namespace+group help table builder, and they are all gone. The one
remaining caller in the verbs machinery is ported to
options_find_namespace() + options_get_help_table_group(), which
build the identical table.

Also drop OPTION_COMMON_INTROSPECT_CLI_ENTRY: it has no users, and
references the no-longer-existing _OPTION_ENTRY() macro, so it could
not even be used.
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek e348b263ce shared/format-table: drop unused table_sync_column_widths()
The variadic pair-wise variant was only used by the hand-written help()
functions to synchronize their verb and option tables. Those are all
gone, and the verbs machinery uses table_sync_all_column_widths().
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek 37900a6265 tests: convert manual test binaries to VERB_COMMAND and --introspect-cli
The last five hand-written help() functions are replaced by COMMAND()
descriptions: test-homectl-prompts, test-libudev,
test-modem-manager-mock, test-chase-manual, and test-journal-append
(which open-coded the help inside the option parsing loop). None of the
binaries are installed, so no man pages are referenced and they are not
added to the introspection smoke test.
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek 274d366eb3 report-sign-tpm2: convert to VERB_COMMAND and add --introspect-cli
The custom help() is replaced by a COMMAND() description, matching the
other report-sign services. The abstract is now wrapped at 80 columns
in the help output.
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek a677a39c1e test-journal-append: use DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE
Negative return values, e.g. from option parsing, were propagated verbatim
as the exit status of main() and truncated to meaningless values (-EINVAL
became 234). The positive-failure variant is needed because the binary may
exit with EXIT_TEST_SKIP.

Also propagate EXIT_TEST_SKIP instead of suppressing it.
2026-08-28 14:50:10 +02:00
Zbigniew Jędrzejewski-Szmek 51636f3c39 repart: clamp copied timestamps to $SOURCE_DATE_EPOCH (#43545)
This greatly helps reproducibility, and we can actually achieve it with
https://github.com/dosfstools/dosfstools/commit/8da7bc93315c.
2026-08-28 13:22:41 +02:00
Zbigniew Jędrzejewski-Szmek 57a8bac815 shared/service-util: adjust comment
Fixup for 65510d4cba.
2026-08-28 13:15:57 +02:00
Zbigniew Jędrzejewski-Szmek e427a58c48 Convert udevadm to COMMAND and add --introspect-cli (#43529)
Unfortunately udevadm is special, so some more infra extensions turned
out to be necessary.

Retroactively, we might want to apply some of the new functionality in
other places too, but I'm leaving that for later.
2026-08-28 12:46:45 +02:00
Michael Vogt 3b4c759a07 hostname-wordlist: replace "petnames" wordlists
The petnames wordlist added in [1] is Apache-2.0 and this
causes problems with the distribution of systemd as the
GPL-2 and Apache-2.0 are considered incompatible by the FSF.

So this commit replaces the previous wordlist with
a new one:
- weather (basic english weather adjectives)
- colors (basic english color names)
- worlds (planets, moons, minor bodies of the solar system)

All common vocabulary and compiled for this project, not taken
from anywhere.

An example with the new list:
- wintry-rust-dione-9393
- warm-yellow-saturn-39f9

The "worlds" are picked on the following principles:
- well-known
- memorable
- short(ish)
- cool

This is why e.g. we have "thetis" (an astroid) instead of
"tethys" (a moon): easier to spell and more well known.

[1] https://github.com/systemd/systemd/pull/42566
2026-08-28 12:45:23 +02:00
Martin Pitt ab2ab441f7 mkfs-util: forward a validated $SOURCE_DATE_EPOCH to mkfs.*
The previous commit uses `parse_source_date_epoch()` for creating FAT
time stamps. Do the same in `mtools_exec()`, `mkfs.*`, and
`$E2FSPROGS_FAKE_TIME` instead of passing the raw environment variable.

That avoids these programs creating time stamps from a value we would
have rejected ourselves (unparsable, overflowing), read differently
(e.g. octal numbers), or from one that `secure_getenv()` declines to
look at under AT_SECURE.

Note: mtools derives file and directory timestamps from
$SOURCE_DATE_EPOCH since v4.0.20 (2018).
2026-08-28 11:16:34 +02:00
Martin Pitt 94bb5f8e4d repart: clamp copied timestamps to $SOURCE_DATE_EPOCH
Use the new copy timestamp clamping mechanism from the previous commit
to fix unreproducible wall-clock files in the generated images.

That covers both modes: online mode writes through the kernel, and
offline mode stages the tree in a temporary directory before handing it
to mkfs or mcopy. `mcopy -m` then carries the clamped mtimes into the
FAT.

This complements commit 34c3d57474 (directory times) and commit
f191ca982c (FAT insertion order).

Cover all combinations (online/offline, with and without epoch) in the
new `testcase_vfat_reproducibility()`. Update `testcase_make_symlinks()`
to cover the symlink creation/re-fix their parent directory code paths.

Sadly, images are still not reproducible byte for byte. Document
systemd-repart's $SOURCE_DATE_EPOCH handling and remaining
reproducibility issues in the manpage.
2026-08-28 11:16:29 +02:00
Martin Pitt edbf043333 copy: support clamping the timestamps of copied inodes
Add a `ts_clamp` argument to `copy_tree_at_full()` and
`copy_times_full()` that clamps copied inodes to a given time stamp.
This is the recommended `$SOURCE_DATE_EPOCH` semantics [1] for
reproducible builds. Their non-`_full` APIs keep existing behaviour by
clamping to `USEC_INFINITY`.

atime and mtime are clamped separately: a file that was merely read
after the epoch has to keep its mtime and still lose its atime. E.g. FAT
(EFI partition) stores an access date.

[1] https://reproducible-builds.org/specs/source-date-epoch/
2026-08-28 11:12:56 +02:00
Zbigniew Jędrzejewski-Szmek 378e6c544b udevd: convert to VERB_COMMAND and add --introspect-cli
systemd-udevd is the same binary as udevadm, so the introspection data
describes both commands, from either name. The COMMAND intentionally
owns no verbs — all of udevadm's verbs are defined in udevadm.c right
after its own COMMAND, so that they are attributed to it.

The -V/--version output (GIT_VERSION) is preserved.
2026-08-28 09:59:16 +02:00
Zbigniew Jędrzejewski-Szmek b1a68327bb udevadm-wait: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-wait" option namespace. The verb's one-line
description from the abstract is retained, I think it is good enough
but shorter.
2026-08-28 09:58:38 +02:00
Zbigniew Jędrzejewski-Szmek 2775c49688 udevadm-verify: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-verify" option namespace.
2026-08-28 09:58:38 +02:00
Zbigniew Jędrzejewski-Szmek 2f15edc2ab udevadm-trigger: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-trigger" option namespace.
2026-08-28 09:58:38 +02:00
Zbigniew Jędrzejewski-Szmek 580587643a udevadm-test-builtin: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-test-builtin" option namespace. The list of
built-in commands is appended after the generic help. The man page
reference is now printed before the command list. It'd be somewhat
nicer to have it _after_, but that'd require a lot of plumbing to
split the help generated in two and just doesn't seem worth effort.

The list of commands is now printed to stdout (it went to stderr before),
arguably a backportable bugfix.
2026-08-28 09:58:38 +02:00
Zbigniew Jędrzejewski-Szmek 2ac1195458 udevadm-test: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-test" option namespace.
2026-08-28 09:58:38 +02:00
Zbigniew Jędrzejewski-Szmek 4a7a683d71 udevadm-settle: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-settle" option namespace.
2026-08-28 09:58:38 +02:00
Zbigniew Jędrzejewski-Szmek d77ecb5c37 udevadm-monitor: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-monitor" option namespace.
2026-08-28 09:58:38 +02:00
Zbigniew Jędrzejewski-Szmek d8b733d6dd udevadm-lock: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-control" option namespace. The synopsis
makes use of the new nulstr-argspec functionality:
  > udevadm [OPTION…] lock [OPTION…] COMMAND
  > udevadm [OPTION…] lock [OPTION…] --print
2026-08-28 09:58:36 +02:00
Zbigniew Jędrzejewski-Szmek e939427d5d udevadm-info: use common verb help and add --introspect-cli
The arg_no_pager variable is lifted to udevadm, so that it can be
referenced in the command structure. It's only used for 'udevadm info',
but that's OK. We can later generalize it if wanted.

The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in udevadm.c
and the "udevadm-info" option namespace. --help now goes through the
pager, like other commands with --no-pager.
2026-08-28 09:47:36 +02:00
Zbigniew Jędrzejewski-Szmek 0ba8647c6d udevadm-hwdb: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in udevadm.c
and the "udevadm-control" option namespace. The new VERB_DEPRECATED flag
is used.
2026-08-28 09:47:36 +02:00
Zbigniew Jędrzejewski-Szmek da4f84ae4a udevadm-control: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-control" option namespace. The synopsis
is now "udevadm [OPTION…] control OPTION…".
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 96b091a6b4 udevadm-cat: use common verb help and add --introspect-cli
The custom help() is replaced by the common verb help, which derives the
synopsis, abstract, and option list from the verb declaration in
udevadm.c and the "udevadm-cat" option namespace.
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek a35f5d5eba udevadm: convert to VERB_COMMAND and add --introspect-cli
The verbs declare their subcommand option namespaces, so the
introspection data describes the options of every subcommand, nested in
the verb objects.

The bare version number output (a dracut compatibility requirement) is
preserved for --version/-V and the "version" verb.

The "lock" verb's argument specification is simplified to "COMMAND" --
other verbs do not mention their options in the argspec either, and the
subcommand help states where the options may go.
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 868d22628c shared/verbs: add flag VERB_DEPRECATED
Previously, verbs were skipped in --help automatically when their
.help field was nil. But this doesn't work in two ways:
- in introspection data we want to show the option, but marked as
  deprecated
- in udevadm (and maybe other programs with verbs with own options in
  the future), we need to show help for the verb.

So add an explicit flag to mark verbs as deprecated and skip them in
help even if .help is set. If there's a footer, print it highlighted
in red automatically.
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 4aea8cedd2 shared/verbs: add a footer for verbs
This will be needed for 'udevadm hwdb' which carries a footer.
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 84d19dc8f9 shared/verbs: add flag VERB_OPTION_REQUIRED 2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 3cfe456323 shared/verbs: add command_print_verb_help()
A helper to print the help of a single verb, derived entirely from the
data in the SYSTEMD_VERBS and SYSTEMD_OPTIONS sections: the synopsis is
built from the verb name and argspec, the one-line verb help serves as
the abstract, the options come from the verb's option namespace, and the
man page links from the command the verb belongs to. A flag allows
suppressing the man page links for callers which append custom sections.
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek efd63ddfbf shared/verbs: turn verb argument specification into nulstr
Like the command-level CommandDescription.argspec, a verb's argspec is now
a nulstr, so that a verb may declare multiple alternative usage lines. The
verbs help table renders one synopsis line per nulstr entry in the
synopsis cell.

All verb argument specifications must gain an explicit NUL suffix. This
is a lot of churn, but I think this needs to be done. For now, there'll
be only one user of the new functionality (i.e. a verb with more than
one argspec), but I think we'll eventually want to use this in other
places too.
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 057fc4251a shared/verbs: allow verbs to declare an option namespace
Verbs like udevadm's subcommands parse their own options from a dedicated
option namespace. Allow the namespace to be declared in the verb
definition (via the new VERB_SCOPE_NS* macros), and report the options of
that namespace in the verb's CLI introspection object.

This is conformant with the CLI-Introspection Specification: verbs are
represented as nested command objects, which may carry their own "options"
array just like the top-level command object.
2026-08-28 09:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 23e8e4e80f shared/verbs: rename "footer" to "postscript" in introspection
The spec PR uses that term now. I didn't change the internal
variable name because I don't like the new name.
2026-08-28 09:28:23 +02:00