Commit Graph
91425 Commits
Author SHA1 Message Date
Yu Watanabe daef042536 journal: also allow to store coredump by systemd-coredumpd.service 2026-08-27 05:52:53 +09:00
Yu Watanabe 264ca8f827 coredump: support kernel coredump socket protocol
Since kernel v6.17, we can set a path to unix socket to core_pattern
(with request mode). See also:
https://lore.kernel.org/all/20250603-work-coredump-socket-protocol-v2-0-05a5f0c18ecc@kernel.org/

This introduces a tiny service that prepares and listens on a UNIX
socket to be passed to the kernel core pattern. When a process is
crashed, the kernel connects to the socket, and sends information
about the crashed process and passes coredump through the socket.
The service accepts the connection, and forks a worker process that
receives coredump from the kernel.
2026-08-27 05:52:49 +09:00
Yu Watanabe 0351920ac7 coredump: do not coredump in setting up logger
If log_parse_environment() or log_set_target_and_open() triggers
assertion or so, then we may enter endless loop. Let's disable coredump
earlier.
2026-08-27 05:50:14 +09:00
Yu Watanabe 3fd564e876 coredump: do not try to read si_code more than once
This also renames coredump_context_read_pidfd_info() to
coredump_context_read_code(), as it only reads COREDUMP_CODE.

This does not change anything effectively, as the function is called
only once. Preparation for later change.
2026-08-27 05:50:14 +09:00
Yu Watanabe d81e6b93d6 process-util: split out procfs_get_stat_flags() from pid_is_kernel_thread() 2026-08-27 05:50:14 +09:00
Yu Watanabe 059b41654f include: add missing definition of PF_DUMPCORE 2026-08-27 05:50:14 +09:00
dongshengyuan 2ff5250ae7 homework: skip LUKS fallocate for metadata operations
UpdateHomeEx needs to set up the home temporarily so that it can
write the refreshed identity records. Inspect and password changes use
the same setup path for metadata-oriented work.

For LUKS homes with luksDiscard=no, home_setup_luks() fully
allocates the backing image while setting it up. If diskSize=max was
previously written to a sparse image, this can fail with ENOSPC before
the user can disable auto-resize mode again.

Add a setup flag that lets metadata operations skip the full-image
fallocate step. Real create, activate, and resize paths keep the
existing allocation behavior.

Before, reproduced on Ubuntu 26.04 with /home on tmpfs:

  homectl create reprohomed \
          --storage=luks \
          --fs-type=btrfs \
          --disk-size=300M \
          --auto-resize-mode=shrink-and-grow \
          --luks-discard=no
  homectl update reprohomed --disk-size=max
  dd if=/dev/zero of=/var/tmp/homed-repro/filler bs=1M count=500
  systemctl restart systemd-homed.service
  homectl update reprohomed --auto-resize-mode=off

  Operation on home reprohomed failed:
  Not enough disk space for home reprohomed

Fixes #34527

Follow-up for: ab3b6fcb40
2026-08-27 04:54:38 +09:00
quanyeyang a9ff124143 repart: Keep new partitions after existing same-type partitions
When a partition is deleted from a table containing multiple partitions
of the same type, filling the resulting partition-number gap can place
a new partition before an existing partition matched to an earlier
definition. This changes definition matching on the next invocation and
breaks idempotency.

Keep new partitions after existing partitions of the same type. If no
partition table slot is available after them, fall back to the first
unused slot.

Which existing partition is matched to which definition is still
determined by partition type and partition number order, as documented,
and is unchanged by this.

Fixes #43449
2026-08-26 19:43:03 +01:00
Christian Glombek 9bb06d5cd6 resolved: only clamp cache TTLs when actually serving stale data
dns_cache_lookup() computes each answer item's expiry ('until', also the
basis of the SD_RESOLVED_CLAMP_TTL TTL patch) as "30s from now" whenever
the caller did not pass SD_RESOLVED_NO_STALE — keyed on the lookup mode,
not on whether the entry being returned is actually stale. That misfires
in both directions:

 * A fresh entry hit by a serve-stale retry (second transaction attempt
   with StaleRetentionSec= set) has its TTL reported as 30s instead of
   its real remaining TTL.

 * A lookup that passes neither SD_RESOLVED_NO_STALE nor
   SD_RESOLVED_CLAMP_TTL — as the mDNS browse path does for clients
   that set no flags — leaves 'current' at 0, so every answer item's
   expiry becomes the constant absolute time 30s after boot,
   permanently in the past. The RFC 6762 section 5.2 cache maintenance
   schedule that resolved-dns-browse-services.c derives from
   item->until then degenerates to its already-expired fallback.

Key the rewrite on the entry's actual staleness instead: an entry whose
TTL has lapsed keeps reporting "30s from now", so clients don't hold on
to stale data for long, and a fresh entry reports its real expiry. For
lookups with SD_RESOLVED_NO_STALE set nothing changes: a stale entry
already makes the whole chain miss, so every item returned in that mode
is fresh.
2026-08-26 18:43:26 +01:00
Yu Watanabe 64b98140fa coredumpctl: several cleanups (#43481)
This splits coredumpctl.c into small pieces, and fixes several minor
issues such that memleak, unremoved temporary files, and missing
uncompressed core file handling. This also makes `coredumpctl
dump/debug` command accept --json= option that was previously silently
ignored.
2026-08-27 00:28:18 +09:00
Yu Watanabe 9fab87df93 udev,network: skip reloading if already in stopping state (#43504)
Prompted by #43482.
2026-08-27 00:26:58 +09:00
Yu Watanabe 6fe09adf81 network: several follow-ups for proxy neighbor setting (#43408)
Follow-ups for 08bebda611.
2026-08-27 00:09:59 +09:00
Zbigniew Jędrzejewski-Szmek 34d4d50d08 Another batch of conversions to COMMAND and additions of --introspect-cli (#43512) 2026-08-26 15:22:50 +02:00
Lennart Poettering d704a21ef9 Chores for RC1 (#43527) 2026-08-26 14:26:04 +02:00
zouge666 eb020fc492 import: merge default OpenPGP keyrings
When an administrator installed a custom keyring under /etc,
signature verification selected it instead of the vendor keyring
under /usr. That could make vendor-signed system updates stop
verifying after adding local keys.

Collect all readable default keyrings, including the current and
legacy /etc paths, and pass temporary copies to GnuPG with
separate --keyring options. Keep SYSTEMD_OPENPGP_KEYRING as an
explicit override, add regression coverage for keyring
coexistence, override behavior, and current-path signing, and
silence the expected shellcheck false positive in the test
cleanup helper.

Closes: #40702
2026-08-26 11:35:55 +01:00
EJ Campbell 004db23cca test: run TEST-03-JOBS cycle starts at log level info
The transactions-with-cycles subtest starts 20 mutually cyclic
services, reads the manager's TransactionsWithOrderingCycle ids over
varlink, and then requires a journal entry matching "cycle starting
with" for every id. On a fedora rawhide CI run the entry for
transaction id 42 was missing for the entire boot and journalctl
printed "-- No entries --", failing the unit, while the manager had
correctly recorded all 20 ids. In the exported journal of that boot,
transaction 42 kept only its debug-level enqueue line

    transaction-cycle12.service: Trying to enqueue job
    transaction-cycle12.service/start/replace

while the other 19 transactions each also kept the three messages
that follow it ("Found ordering cycle", "Unable to break cycle
starting with", "unfixable cyclic ordering dependency"), and PID1's
next message, accepted about 2 ms after the enqueue line, shows
journald itself kept ingesting.

The messages were lost, not late. The test VM boots with
systemd.log_level=debug, and the 20 cyclic starts made PID1 emit
about 12,400 debug messages within 30 seconds, 4,100 of them in the
final second, during which journald stalled for 94 ms between two
consecutive entries. PID1 gives its journal socket a 10 ms send
timeout (src/basic/log.c), and a message whose send times out is
either dropped outright, because log_struct() ignores the sendmsg
result and falls back only on formatting errors, or, for the plain
log calls that do fall back to kmsg, reappears as _TRANSPORT=kernel
text stripped of its structured fields, where a TRANSACTION_ID=
match cannot find it. The asserted messages are log_struct() calls,
so they are in the dropped class. Either way the journalctl
assertion comes up empty. This is also why the "journalctl --sync"
added in ed0727fecd does not help here: it only flushes what journald
already received.

Run the whole section, including the daemon-reload, at log level
info, and drain what the earlier subtests queued at debug level with
one "journalctl --sync" before the first start. The daemon-reload is
itself a heavy debug emitter that returns before journald has
drained its burst, so opening the quiet window after it would leave
that backlog competing with the first cycle messages. The two
messages the subtest greps for are emitted at LOG_ERR ("Unable to
break cycle starting with") and LOG_WARNING ("Job ... deleted to
break ordering cycle starting with") in src/core/transaction.c, and
the ids are recorded into transactions_with_cycle on the same code
path directly before them, so the assertion keeps its full strength
while the debug flood that displaced it is gone.

A single at_exit handler installed at the start of the test restores
the boot-time log level when any subtest aborts, and cleans up the
transient unit the aborting subtest had in flight, guarded on the
unit file existing as in TEST-26-SYSTEMCTL.sh. It replaces the
per-subtest restart_randomized_delay_cleanup() handler, so the two
subtests that change the log level share one restore path.
2026-08-26 11:32:51 +01:00
Zbigniew Jędrzejewski-Szmek 04b996d0bb shutdown: mark as public 2026-08-26 12:25:23 +02:00
Zbigniew Jędrzejewski-Szmek a4145b8ca3 shutdown: convert to VERB_COMMAND and add --introspect-cli
systemd-shutdown parsed a bunch of options, but had no way to print
them. Add the standard --help and --version options and the CLI
introspection.

parse_argv() is moved before the PID 1 check, so that the new options
also work when the binary is invoked manually. As PID 1 we can never
return from main() (the kernel would panic), so in that case parse
errors still freeze(), and the help output is followed by a freeze()
too. Ctrl-Alt-Delete and console reopening are re-enabled before
freezing, so that the freeze can be escaped through the kernel and the
error is visible, as before.

The --help/--version/introspect-cli option names are already listed in
the kernel command line exclusion list in proc-cmdline.c.
2026-08-26 12:25:22 +02:00
Zbigniew Jędrzejewski-Szmek 4927588993 shutdown: convert to run() function 2026-08-26 12:22:15 +02:00
Zbigniew Jędrzejewski-Szmek 4f2b0e977c core: convert to VERB_COMMAND and add --introspect-cli
--introspect-cli follows the same deferred pattern as --help: parse_argv()
only records the action, and it is executed in the same place where
ACTION_HELP and ACTION_VERSION are handled.

The help is looked up by explicit name: in the multicall configuration
the systemd and systemd-executor commands share one binary, so the
"first COMMAND" default would depend on link order.

The "This program takes no positional arguments." line is dropped from
the help output — the default "[OPTION…]" synopsis already says so.
(And also, this is not quite true. It does take positional args when
called as init.)
2026-08-26 12:22:15 +02:00
Zbigniew Jędrzejewski-Szmek 044ebd7e54 executor: convert to VERB_COMMAND and add --introspect-cli
The help is looked up by explicit name: in the multicall configuration
the systemd and systemd-executor commands share one binary.
2026-08-26 12:15:35 +02:00
Zbigniew Jędrzejewski-Szmek 65510d4cba services: convert to VERB_COMMAND and add --introspect-cli
This converts systemd-homed, -hostnamed, -importd, -localed, -logind,
-machined, -networkd, -portebled, -resolved, -sysupdated, -timedated,
and -timesyncd.

The service name and description move from service_parse_argv() arguments
into a COMMAND() description that each daemon now defines. The
service_parse_argv() macro captures the calling binary's verb section,
where that COMMAND is found, while the options are still defined and
parsed in libshared, in the new "service" option namespace that each
COMMAND references. (The named namespace makes sure that options defined
by other translation units in libshared can never leak into the
services' parsers.)

The supported features are declared via option group filtering: each
COMMAND lists "Options" plus "Bus introspection" and/or "Runtime scope".
Unsupported options are now rejected by the parser as unknown options
(and are not shown in --help), replacing the runtime "This service does
not support …" errors.

The help output changes slightly: the "Bus introspection" and "Runtime
scope" option groups now get their own headings, and some descriptions
were reworded to the imperative form used elsewhere.
2026-08-26 12:15:25 +02:00
Zbigniew Jędrzejewski-Szmek ed595e6b67 basic/argv-util: drop unused code 2026-08-26 12:15:16 +02:00
Zbigniew Jędrzejewski-Szmek 9d2178b4a8 integritysetup: mark as public in meson
This means that the program is tested for --help and --version,
but doesn't mean that it's more or less supported.
2026-08-26 12:15:06 +02:00
Zbigniew Jędrzejewski-Szmek 477d08b3a9 integritysetup: convert to VERB_COMMAND and add --introspect-cli
Standard parse_argv() func is added. --version is now accepted
(previously only the help forms were recognized, via argv_looks_like_help()).

The synopsis changes from "systemd-integritysetup COMMAND ..." to the
standard "systemd-integritysetup [OPTION…] COMMAND …", and the help output
gains an Options section. "help" as the first argument keeps working via
the hidden common help verb.

Previously, we'd just print help and exit with success if no arguments
were given. This seems unexpected and wrong. The program now prints the
usual error message:
  Command verb required (one of attach, detach, help).
2026-08-26 12:15:06 +02:00
Zbigniew Jędrzejewski-Szmek 3694241e3f shared/verbs: add helper to call command_print_help_full with name only
I didn't do this previously because I thought that there wouldn't
be too many callers. But it turns out that there're quite a few.
2026-08-26 12:14:50 +02:00
Luca Boccassi 7a0129655a po: update translations 2026-08-26 10:59:02 +01:00
Luca Boccassi 0ba9f36af5 po: update template
ninja -C build systemd-pot
2026-08-26 10:59:01 +01:00
Luca Boccassi 25c6573345 hwdb: update autosuspend rules 2026-08-26 10:59:01 +01:00
Luca Boccassi 4c172b81cb hwdb: run update tool 2026-08-26 10:59:01 +01:00
totoro 2fa149f2c4 nspawn: set ping group range for userns containers
A newly created network namespace may disallow ICMP echo sockets for
unprivileged users even when their GIDs are mapped into the container.

When creating both user and network namespaces, initialize
net.ipv4.ping_group_range using the mapped GID range capped at INT32_MAX.
This follows the system-wide default from sysctl.d/50-default.conf while
respecting the user namespace mapping and the kernel's accepted limit.
Leave externally supplied network namespaces untouched and treat write
failures as non-fatal warnings.

Add regression coverage for the default 64K mapped range using the tools
already available in the minimal container image.

Fixes #41603
2026-08-26 11:45:35 +02:00
Luca Boccassi e1f9606096 News followups for v262 (#43524) 2026-08-26 10:29:35 +01:00
Jörg Behrmann 7824cc524d NEWS: IEC prefixes are binary 2026-08-26 10:56:12 +02:00
Jörg Behrmann e88adcdd2b NEWS: mark --introspect-cli as experimental 2026-08-26 10:51:53 +02:00
Zbigniew Jędrzejewski-Szmek 9843b23141 tar-util: several fixlets for tar_x/tar_c() (#43522) 2026-08-26 10:20:50 +02:00
Yu Watanabe 10adafa358 test-tar: log failure in loading libarchive on LOG_ERR
Other failures are logged on LOG_ERR.
2026-08-26 08:20:34 +09:00
Yu Watanabe 1e615d7e4e import: missing dlopen_libacl() before fork
tar_x() and tar_c() may use libacl. Hence, libacl should be loaded
before fork.
2026-08-26 08:20:34 +09:00
Yu Watanabe 06318e7b98 tar-util: add missing dlopen libarchive
Otherwise, if the library is not loaded yet, these functions will fail.

Note, currently, all callers of tar_x/tar_c() load libarchive before
calling them. So, this should not change any behavior. Just for safety
and following our usual coding style.
2026-08-26 08:20:34 +09:00
Yu Watanabe 32798431dd tar-util: do not call open_inode_done() twice on failure
Previously, if open_inode_finalize() for an object was failed, the number
count was not decremented, hence open_inode_done() is called twice for
the object: once in the failed open_inode_finalize(), and once in the
open_inode_free_array() invoked by the cleanup attribute.

Note, with the previous commit, open_inode_done() is idempotent. Hence,
calling open_inode_done() twice (or more) for the same object is
harmless. Just for safety.
2026-08-26 08:20:33 +09:00
Yu Watanabe 25d7cdc9f5 tar-util: clear xattrs and acls in open_inode_done()
Otherwise, if it is called multiple times for an object, then the
xattrs and acls may be freed multiple times.
2026-08-26 08:19:44 +09:00
Srijan KeshriandRobin Richard Rajan 4d6cea8de6 hwdb: stop lid open toggling airplane mode on HP ENVY x360 Convertible 13 (#43521)
The embedded controller on the HP ENVY x360 Convertible 13 emits atkbd
scancode e057 on every lid open. The generic HP block maps e057 to
KEY_WLAN, which desktop environments bind to the airplane-mode action, so
opening the lid switches off every radio. There is no physical key on this
machine that emits e057, it only ever arrives from the lid.

This is the same firmware behavior already quirked for the HP Spectre
x360 Convertible ("Prevents random airplane mode activation") and the HP
Pavilion Gaming 15-dk1 ("lid keys").

Add the property to the existing ENVY x360 13 record rather than to the
Spectre d7 block. The match line for this model already appears further
down the file, so duplicating it there is rejected by parse-hwdb.

e058 is emitted on lid close but carries no keycode in the generic HP
block, so it is already inert and is left alone here.

Replaces #43495.
Closes #43494.

Co-authored-by: Robin Richard Rajan <robinrichardrajan@gmail.com>
2026-08-26 05:40:36 +09:00
Luca Boccassi 1aec3dfbef NEWS: update up to b6c432be08 2026-08-25 19:27:50 +01:00
Yu Watanabe 385fa7641d coredumpctl: allow to dump uncompressed core file
Previously, if a core file is not compressed, `coredumpctl dump`
is failed with -EPROTONOSUPPORT, as the file was unconditionally passed
to decompress_stream_by_filename().
2026-08-26 02:13:11 +09:00
Yu Watanabe 89a5de18f3 coredumpctl: handle errors earlier
No functional change, just refactoring.
2026-08-26 02:13:11 +09:00
Yu Watanabe c616943f7e coredumpctl: split out acquire_core_from_journal() 2026-08-26 02:13:11 +09:00
Yu Watanabe ab9c1bdae0 coredumpctl: several cleanups for save_core()
- Rename to acquire_core().
- Make it take a fd rather than FILE*.
- Make it take two ret_ arguments to store paths so that callers can
  easily use _cleanup_(unlink_and_freep) for the created temp file.
2026-08-26 02:13:11 +09:00
Yu Watanabe f2496d862a coredumpctl: split out open_tmpfile() from save_core()
No functional change. Preparation for later change.
2026-08-26 02:13:11 +09:00
Yu Watanabe af8ff25a64 coredumpctl: use _cleanup_(unlink_and_free)
This fixes memleak on failure paths, and remaining temp file on failure
in reading coredump from journal.
2026-08-26 02:13:11 +09:00
Yu Watanabe d180614188 coredumpctl: check earlier if stdout is not connected to a tty 2026-08-26 02:13:11 +09:00
Yu Watanabe 8972b051a7 coredumpctl: allow to show coredump info in json format in dump and debug command
Previously `coredumpctl dump/debug` silently ignored --json= option.
Let's honor the option.
2026-08-26 02:13:11 +09:00