Commit Graph
81558 Commits
Author SHA1 Message Date
Luca Boccassi 6946eed3fa core: Also refresh confext extensions when reloading notify-reload service (#33995)
`ExtensionImages=` and `ExtensionDirectories=` now let you specify
vpick-named extensions; however, since they just get set up once when
the service is started, you can't see newer versions without restarting
the service entirely. Here, also reload confext extensions when you
reload a service. This allows you to deploy a new version of some
configuration and have it picked up at reload time without interruption
to your workload.

Right now, we would only reload confext extensions and leave the sysext
ones behind, since it didn't seem prudent to swap out what is likely
program code at reload. This is made possible by only going for the
`SYSTEMD_CONFEXT_HIERARCHIES` overlays (which only contains `/etc`).

This PR:
- Adjusts `service.c` to also refresh extensions when needed. 
- Adds integration tests to check that a confext reload actually
occurred.
- Adds to the `systemd.exec` man pages to document this behavior.

This is a follow up to #24864 and #31364. Thank you to @bluca and
@goenkam for help in getting this up.
2025-05-20 11:27:34 +01:00
Luca Boccassi bcbf96a805 mkosi: update debian commit reference to b0bbe045f41789845ecf591fd29f50c564034104
* b0bbe045f4 systemd-boot: fix manpages installation
* db46ebd2ec Install new files for upstream build
* 648bfbad0b systemd-homed: add dependency on polkitd
* 5a5f1bd5a3 document requirement to sync *.link files with initrd
* 1f2b663871 d/README.Debian: update some outdated paragraphs
* 03e6ab9c93 Add version to systemd-boot-efi-signed virtual package
* 5d7a08916c d/control: bump Standards-Version to 4.7.2, no changes
* ace9e4beaf d/signing-template/copyright: use GPL URL instead of old FSF postal address
2025-05-20 12:27:10 +02:00
Mike Yuan 58f36cfd29 core/cgroup: also assume cgroup.events frozen attr is available (#37518) 2025-05-20 10:58:53 +02:00
Mike Yuan dbe592a067 cgroup-util: modernize cg_get_keyed_attribute()
- assert on supplied keys being unique
- Reject duplicate attributes with -EBADMSG
- Rename 'ret_values' to just 'values', given we don't
  allocate the array
- Remove now unused cg_get_keyed_attribute_graceful()
2025-05-19 21:24:18 +02:00
Mike Yuan 88f4bf8a8b core/cgroup: also assume cgroup.events frozen attr is available
Follow-up for 3c86a935ad
2025-05-19 21:01:39 +02:00
Zbigniew Jędrzejewski-Szmek 791847ea64 boot: fix ia32 build with clang
After 668d915a4b, the build fails:
[7/14] Linking target src/boot/systemd-bootia32.elf
FAILED: src/boot/systemd-bootia32.elf
clang  -o src/boot/systemd-bootia32.elf src/boot/systemd-bootia32.elf.p/boot.c.o src/boot/systemd-bootia32.elf.p/line-edit.c.o src/boot/systemd-bootia32.elf.p/bcd.c.o -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector src/boot/libefiia32.a -nostdlib -static-pie -Wl,--entry=efi_main -Wl,--fatal-warnings -Wl,-static,-pie,--no-dynamic-linker,-z,text -z common-page-size=4096 -z max-page-size=4096 -z noexecstack -z relro -z separate-code -Wl,-z,nopack-relative-relocs -fcf-protection=none -fno-asynchronous-unwind-tables -fno-exceptions -fno-unwind-tables -fno-sanitize=all -Wno-unused-command-line-argument -m32
/usr/sbin/ld: src/boot/libefiia32.a.p/console.c.o: in function `console_set_mode':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/console.c:267:(.text+0xb8f): undefined reference to `__moddi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/console.c.o: in function `get_auto_mode':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/console.c:228:(.text+0xf18): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/efi-string.c.o: in function `push_num':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:695:(.text+0x3c1a): undefined reference to `__moddi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:696:(.text+0x3c54): undefined reference to `__divdi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:702:(.text+0x3cda): undefined reference to `__umoddi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:703:(.text+0x3d0a): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/ticks.c.o: in function `time_usec':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:110:(.text+0x9d): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/ticks.c.o: in function `ticks_freq_arch':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:46:(.text+0x394): undefined reference to `__udivdi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:49:(.text+0x3ce): undefined reference to `__udivdi3'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Restore the use of -lgcc for 32-bit builds.

(FWIW, neither --rtlib=compiler-rt nor --rtlib=libgcc help.)
2025-05-19 16:00:28 +01:00
Daan De Meyer e53a3f4b40 sd-varlink: Expose sd_varlink_idl_parse() (#37513) 2025-05-19 16:13:44 +02:00
Daan De Meyer d94c24e9cc sd-varlink: Expose sd_varlink_idl_parse()
We're planning to do code generation based on the systemd varlink
APIs. To simplify this, let's expose the IDL parser, so we can use
it to do code generation instead of having to write our own IDL
parser.
2025-05-19 15:19:24 +02:00
Daan De Meyer 34f714349b sd-varlink: Fix argument names of sd_varlink_idl_parse() 2025-05-19 15:08:16 +02:00
maia x. 67ecc2c7fe man: document confext reload behavior for ExtensionDirectories/Images 2025-05-19 13:36:21 +01:00
maia x. 3998b30a04 test: check reloading notify-reload service refreshes vpick extensions
In TEST-50-DISSECT.dissect, this adds the following cases:
- testservice-50g: vpick extension in ExtensionDirectories
- testservice-50h: vpick extension in ExtensionImages
- testservice-50i: ExtensionDirectories + RootImage
- testservice-50j: ExtensionDirectories + RootDirectory
2025-05-19 13:36:21 +01:00
maia x.andLuca Boccassi dfdeb0b1cb core: reload confexts when reloading notify-reload services
`ExtensionImages=` and `ExtensionDirectories=` now let you specify
vpick-named extensions; however, since they just get set up once when
the service is started, you can't see newer versions without restarting
the service entirely.  Here, also reload confext extensions when you
reload a service. This allows you to deploy a new version of some
configuration and have it picked up at reload time without interruption
to your workload.

Right now, we would only reload confext extensions and leave the sysext
ones behind, since it didn't seem prudent to swap out what is likely
program code at reload. This is made possible by only going for the
`SYSTEMD_CONFEXT_HIERARCHIES` overlays (which only contains `/etc`).

Implementation wise, this uses the new kernel API and two collaborating
child processes under the host & child namespaces in order to gather the
right FDs needed:

  - (1) In child, set up the extension images and directories in a slave
	mountns, and obtain their FDs.
  - (2) Fork into a grandchild under target process namespace, and do a
        "fake" unmount to obtain the FD of the underlying target folder
	say /etc).
  - (3) In the child again, set up new overlay under host NS rights.

We do not want to do I/O heavy jobs inline in PID1 blocking the state
machine, so add separate async states to handle this case.

Co-authored-by: Luca Boccassi <luca.boccassi@gmail.com>
2025-05-19 13:36:21 +01:00
Mike Yuan 741a184a31 core/manager: do not pop gc_unit_queue before unit_gc_sweep()
Follow-up for 52e3671bf7

unit_gc_sweep() might try to add the unit to gc queue again.
While that becomes no-op as Unit.in_gc_queue is not cleared
yet, it induces minor inconsistency of states.
2025-05-18 05:33:09 +09:00
Yu Watanabe d766c75acd units: kill only udev services and keep udev sockets on switching root
This also makes initrd-cleanup.service explicitly start
initrd-switch-root.service with replace-irreversibly mode, to avoid
systemd-udevd.service being triggered by kernel events and the start
job of initrd-switch-root.service being cancelled.

Follow-ups for 676fb42aae.
Addresses https://github.com/systemd/systemd/pull/37374#issuecomment-2875990471.
2025-05-17 12:47:52 +01:00
Mike Yuan 13cb664181 terminal-util: restore terminal settings if fd_reopen() fails
Follow-up for a0c314d6b0
2025-05-17 12:33:26 +01:00
Lennart Poettering e7ce9e0954 sd-bus: drop a bunch of 'else'
With the new US taxes on bits and bytes let's reduce our footprint a
bit.
2025-05-17 00:18:24 +02:00
Yu Watanabe 7c087d802f Remove overzealous checks (#37493) 2025-05-17 01:37:18 +09:00
Zbigniew Jędrzejewski-Szmek f4bdf373c5 basic/terminal-util: simplify output param handling
Those static functions were written to support optional output params, but they
are only ever called with the output param set, and it doesn't make sense to
ever call them without the output param. Since those are internal functions,
drop this unused complexity.
2025-05-16 15:33:50 +02:00
Zbigniew Jędrzejewski-Szmek 5b5545f112 basic/terminal-util: drop 'U' suffix
C automatically casts a signed int to unsigned in binary operation with an
unsigned int. Thus that suffix is not useful. Also surrounding code doesn't use
it.
2025-05-16 15:33:10 +02:00
Zbigniew Jędrzejewski-Szmek 5ecd641ac8 src/boot: assume that intmax_t is the biggest integer
Same as in 81d7934882, intmax_t by definition is
the widest int. Strictly speaking, the check whether
  sizeof(intmax_t) == sizeof(long long)
in the code below is redundant, but I think it's nicer to keep it for symmetry
with the other cases.

Requested in
https://github.com/systemd/systemd/pull/37442#pullrequestreview-2840906908.
2025-05-16 15:31:58 +02:00
Yu Watanabe a31edb4e71 TEST-07-PID1: drop journal message flood test
This partially reverts f9b186c21a.

The test case is unstable, and fills debugging logs after journald
is restarted.
2025-05-16 22:24:54 +09:00
Lennart Poettering fbf43297dd man: reword recommendations around Accept=
Accept=yes has very valid usecases (i.e. for sporadically invoked
services) and strong benefits (i.e. better security because connections
can be sandboxed nicely, isolating them). Let's hence reword things and
stop claiming that Accept=yes was a legacy thing, because it really
isn't.

Some other man fixes, too
2025-05-16 21:47:46 +09:00
Lennart Poettering 59276b86dc catalog: add more entries
While message IDs are about more than catalog entries (they make
messages recognizable), I think it makes sense to document at least all
those messages that indicate problems with catalog entries, in an
attempt to be helpful to users.

Fixes: #36201
2025-05-16 21:45:25 +09:00
Lennart Poettering b177095bfa terminal-util: explicitly reset cursor
Apparently there are terminals where our usual reset is not enough to
turn the cursor back on. Hence do so explicitly.

Fixes: #22168
2025-05-16 21:42:32 +09:00
Daan De Meyer 96b9d4162f bpf-link: Add HAVE_LIBBPF check
Fixes compilation error in userns-restrict.c where we try to include
libbpf.h when it is not available.
2025-05-16 21:36:15 +09:00
AsciiWolf b2ef1818e6 hwdb: add missing PLUTO SDR vendor name 2025-05-16 19:46:11 +09:00
Yu Watanabe 8e958263d0 man/systemctl: fix typo
Follow-up for 652e4dd743.
2025-05-16 17:49:14 +09:00
Yu Watanabe ed3dce108d varlink: fix typo
Follow-up for 736349958e.
2025-05-16 17:47:54 +09:00
Yu Watanabe bfc8941098 journalctl: fix typo
Follow-up for d2f45c7681.
2025-05-16 17:46:20 +09:00
Lennart Poettering 645e35633f Clean up includes (#37467)
Split out of #37344 

More small components that shouldn't be all too controversial.
2025-05-16 10:07:19 +02:00
Lennart Poettering 22b5ddb90f tree-wide: fix use of flink_tmpfile()
Let's always make sure the temporary file returned by fopen_tmpfile()
and friends is removed on failure (via _cleanup_). Conversely, make sure
that once the file is renamed into its final place, we no longer try to
remove the temporary file (since it's not going to exist anymore).
2025-05-16 08:28:42 +02:00
Eisuke Kawashima b9df3d6447 shell-completion: improve completion of systemd-tmpfiles 2025-05-16 14:04:09 +09:00
Lennart Poettering edecb56216 man: document how to hook stuff into system wakeup
Fixes: #6364
2025-05-15 22:01:12 +01:00
Daan De Meyer ef10d4b526 Bugprone argument comment - round 5 (#37481) 2025-05-15 20:33:50 +02:00
Yu Watanabe 9fd936df77 man: fix path to version.h
Follow-up for 30d20907bd.
2025-05-15 15:42:33 +02:00
Jelle van der Waa 346c62f9ca treewide: correct argument comments 2025-05-15 15:39:20 +02:00
Jelle van der Waa f15dcafdb1 discover-image: correct argument comments 2025-05-15 14:50:33 +02:00
Mike Yuan 7762e9bbb2 core: always enable CPU accounting; cgtop: drop cgv1 handling (#37448) 2025-05-15 14:41:07 +02:00
Yu Watanabe abbdc33bca hwdb: add PLUTO SDR (#37471)
The goal of this PR is to replace the rules in
https://github.com/analogdevicesinc/plutosdr-fw/commit/76aa80a6d86f7b3b2c0fe83cca51f351991ee852.

The original rules file have some rules for a device that is now
deprecated and so, are not part of this change. AFAIU, 'plugdev' is also
a thing of the past and we now use 'uaccess' which should be given to
all ID_SOFTWARE_RADIO devices. So yeah, hopefully what I have here is
equivalent to the orginal .rules.

The request for this was done here:
https://github.com/analogdevicesinc/plutosdr-fw/issues/101
2025-05-15 20:19:09 +09:00
Luca Boccassi a49f3c3890 Update hwdb (#37470)
Update hwdb, even though we are pretty far from a release in order to:
- incrementally test upstream additions to hwdb
- allow backports to stable branches
2025-05-15 12:09:03 +01:00
Luca Boccassi ed5c3f4436 core: use socket cookie for naming per-connection service instances + set $SO_COOKIE env var to it (#37469) 2025-05-15 11:11:21 +01:00
Tommy Unger ef3a0478bb test: write file from systemd service in transient unit
This integration test demonstrates that a containerized systemd instance can
write to a bind mounted file observable to the host. Specifically, the bash
script uses systemd-run to start a systemd instance as a transient unit
container. This systemd-run command bind mounts a directory the container will
share with the host, and runs an internal service which creates and writes to a
file from the container's view of this directory. When finished writing, the
service runs the exit target, terminating the internal systemd instance, and
ending the lifetime of the container.

The script waits for the container to finish running, then verifies that the
expected file contents were written on the host side of the filesystem mount.

This test employs a workaround, creating an unmasked procfs mount on the host
which enables the privileged guest to create its own mounts internally. This
may indicate a systemd bug, as the privileged container should not rely on
the existence of an unmasked procfs on the host in order to mount its own
filesystems internally.
2025-05-15 11:33:23 +02:00
Lennart Poettering 62e5b90a49 varlink: two tweaks for method call handling (#37466) 2025-05-15 11:28:58 +02:00
Jelle van der Waa d495a31f9b test: correct argument comments 2025-05-15 11:14:04 +02:00
Jelle van der Waa 274da0b67b terminal-util: rename openpt_allocate_* ret_peer argument
Make it consistent with its implementation.
2025-05-15 11:12:43 +02:00
Jelle van der Waa 5ae4d7c9ba tpm2-util: correct argument comments 2025-05-15 11:12:43 +02:00
Jelle van der Waa ccf379b46e sd-varlink: fix argument comment
Follow-up for 52068c1e9c
2025-05-15 11:12:43 +02:00
Jelle van der Waa 2f75e5efa1 tpm2-util: rename tpm2_unseal arguments
To make it consistent with its implementation.
2025-05-15 11:12:28 +02:00
Zbigniew Jędrzejewski-Szmek 7bd6626a43 hwdb: run "update-hwdb-autosuspend"
As usual, mostly additions and a few removals.
2025-05-15 10:51:28 +02:00
Zbigniew Jędrzejewski-Szmek f41c0fa11e hwdb: run "update-hwdb"
As usual, it seems to be mostly additions and corrections.

The last update was in 0d740f4bc0, Dec 10th. I
think it's reasonable to update the hwdb more often. In particular, I want to
push an update to the stable branches, but it should be updated in 'main'
first.
2025-05-15 10:50:28 +02:00