Commit Graph
83859 Commits
Author SHA1 Message Date
Yu Watanabe b97b8fd4e3 machined: introduce per-user instance (#39123)
This is the first part of #38728, just the machined stuff, no the
importd stuff.

This definitely makes sense of its own, hence let's get this in first.

The original PR contains a tescase that tests machined + importd in
combination. This PR here hence is without a testcase, but it's there,
just in the other PR.

This looks large and is large, but do note that much of the machined
changes are very repetitive: they conditionalize PK checks to the system
version, as PK doesn't make sense in the use rversion.
2025-09-26 08:16:18 +09:00
Yu Watanabe a925cea9f2 core/cgroup: make sure deserialized accounting data is not voided (#39130) 2025-09-26 07:54:48 +09:00
Yu Watanabe 22fc89f54d man: fix typo
Follow-up for 73ee723aa7.
2025-09-26 07:24:17 +09:00
Yu Watanabe 5c60d3011f integration tests: do not adjust log level in the test script
We passes log level through kernel command line. It is not necessary to
set to debug level at the beginning, and set to info at the end.
This is important when a test has several subtests. If a subtest sets
log level to info at the end, then subsequent tests may not generate any
useful logs.
2025-09-26 07:20:04 +09:00
Matteo Croce ba8801a076 libseccomp: fix build error
When HAVE_SECCOMP is not set, a build error happens:

../src/analyze/analyze-security.c: In function ‘get_security_info’:
../src/analyze/analyze-security.c:2449:13: error: unused variable ‘r’ [-Werror=unused-variable]
 2449 |         int r;
      |             ^
cc1: some warnings being treated as errors

Fix it by removing the sometimes unused variable.
2025-09-26 07:19:29 +09:00
Mike Yuan 055a5a236c core/cgroup: make sure deserialized accounting data is not voided
Currently, cgroup_path is (de-)serialized after all the cached
accounting data. This is bogus though, since unit_set_cgroup_path()
destroys the CGroupRuntime object and starts afresh, discarding
all deserialized values. This matters especially for IP accounting,
whose BPF maps get recreated on reload/reexec and the previous values
are exclusively retrievable from deserialization. Let's hence swap things
around and serialize cgroup_path first, accounting data only afterwards.
2025-09-25 22:55:14 +02:00
Mike Yuan e99f741cdf core/cgroup: realign macro line continuation 2025-09-25 22:55:14 +02:00
Lennart Poettering d9c5566c0f machined: make image locking runtime scope aware, too
We cannot create an image lock in /run if we are unpriv, hence create it
in $XDG_RUNTIME_DIR instead.
2025-09-25 22:43:59 +02:00
Lennart Poettering 1966baf2d6 machinectl: add support for user-scoped operation 2025-09-25 22:43:59 +02:00
Lennart Poettering f5fa86f9f8 machined: allow running in --user mode 2025-09-25 22:43:59 +02:00
Lennart Poettering e1b3319b6c discover-image: support runtime scope also for .nspawn settings files and the pool dir
discover-image.[ch] largely already supports per-scope operations, let's
extend this however to also cover finding .nspawn settings files and
managing the pool dir.
2025-09-25 22:43:59 +02:00
Lennart Poettering b7f6bdbbd3 service-util: add generic parser for runtime scope 2025-09-25 22:43:59 +02:00
Lennart Poettering 0011ecd6fa path-lookup: add runtime_directory_generic() helper 2025-09-25 22:43:59 +02:00
Lennart Poettering abf518a8dc runtime-scope: add runtime_scope_to_socket_mode() helper 2025-09-25 22:43:59 +02:00
Yu Watanabe 3b6288f6be osc-context: fix typo: 8003 -> 3008
Follow-up for dadbb34919 (v258).
2025-09-26 05:42:04 +09:00
Luca Boccassi c5e48e3a66 machined: do not allow unprivileged users to shell into the root namespace
We intend to make self-registering machines an unprivileged operation,
but currently that would allow an unprivileged user to register a
process they own in the root namespace, and then login as any
user they like, including root, which is not ideal.

Forbid non-root from shelling into a machine that is running in
the root user namespace.
2025-09-25 22:13:05 +02:00
Mantas Mikulėnas 6cae201ca1 resolve: undo change to return code of next_search_domain() (#39119)
This caused resolved to only consider the 1st search domain of every
interface and ignore the rest.

Fixes a regression caused by 81ae2237c1 (v258).
Fixes #39118.
2025-09-26 04:52:18 +09:00
Lennart Poettering aaca6bd5d9 libseccomp: turn into dlopen() dependency 2025-09-26 03:30:11 +09:00
Yu Watanabe 04e434cedb find-esp: fix error handling
Follow-up for 4b2b2f3ab7.
2025-09-25 20:08:13 +02:00
Luca Boccassi d5eb732724 mkosi: pull in bsdutils for script, used by various integration tests
4971s TEST-74-AUX-UTILS.sh[1212]: + script -ec 'networkctl edit --runtime "$NETWORK_NAME"' /dev/null
4971s TEST-74-AUX-UTILS.sh[1269]: .//usr/lib/systemd/tests/testdata/units/TEST-74-AUX-UTILS.networkctl.sh: line 55: script: command not found

Currently works due to a transitive dependency somewhere else
that is being dropped, pull it in directly given the tool is
used by the tests
2025-09-25 15:11:17 +01:00
Daan De Meyer 2c4263f987 dissect: Add more debug logging
Currently it's next to impossible to find out why dissect_image()
has failed with EADDRNOTAVAIL, so let's add debug logging and use
EREMOTE for the different architectures error to help out with
debugging a bit.
2025-09-25 14:11:36 +02:00
Lennart Poettering 015025cba2 cgroup-util: add pidref+full counter parts for cg_pid_get_user_unit()
This completes the set of functions for getting the user unit of a
process, mirroring the four functions we already have for the system
unit.
2025-09-25 14:09:55 +02:00
Lennart Poettering ece4df0293 tmpfile: minor modernizations 2025-09-25 14:07:22 +02:00
Lennart Poettering 1a00afe0ff mountfsd: slightly relax restrictions on dir fds to mount
When establishing a idmapped mount for a directory with foreign mapping
we so far insisted in the dir being properly opened (i.e. via a
non-O_PATH fd) being passed to mountfsd. This is problematic however,
since the client might not actually be able to open the dir (which after
all is owned by the foreign UID, not by the user). Hence, let's relax
the rules, and accept an O_PATH fd too (which the client can get even
without privs). This should be safe, since the load-bearing security
check is whether the dir has a parent owned by the client's UID, and
for that check O_PATH or not O_PATH is not relevant.
2025-09-25 14:06:34 +02:00
Antonio Alvarez Feijoo e77566fbca libblkid: fix build with blkid disabled
Prompted by c349edfe49, but it didn't work before.
2025-09-25 11:03:24 +02:00
Lennart Poettering ec3139db8b loop-util: fully suppress unnecessary size changes
Typically we set the offset argument to UINT64_MAX in most calls, but
this caused us to not detect no-change invocations. Fix that.
2025-09-25 08:49:25 +02:00
Lennart Poettering de425dc72c libblkid → turn into dlopen() dependency (#39084)
Split out of #38861
2025-09-24 21:15:01 +02:00
Lennart Poettering 4b2b2f3ab7 blkid-util: add blkid_probe_lookup_value_id128() helper
And similar, add a blkid_probe_lookup_value_u64() helper
2025-09-24 18:13:10 +02:00
Lennart Poettering c349edfe49 libblkid: turn into dlopen() based dep 2025-09-24 18:13:10 +02:00
Lennart Poettering d71f2899bd meson: drop libblkid dep from components not using it directly 2025-09-24 18:11:12 +02:00
Yu Watanabe 77adf896ca firstboot: some love (#39070)
This is split out of #38764.

It mostly introduces the "chrome" stuff that puts a blue at the top of
bottom of the terminal screen when going through interactive tools such
as firstboot, homed-firstboot, and (in future) systemd-sysinstall).

it also introduces a generic "prompt_loop()" helper thatn queries the
user for some option in a loop until the rsponse matches certain
requirements. It's a generalization of a function of the same name that
so far only existed in firstboot.c. The more generic version will be
reused in a later PR by homed-firstboot and by sysinstall.
2025-09-25 00:38:23 +09:00
Daan De Meyer 938442ac27 man: Add missing parentheses 2025-09-24 16:32:44 +02:00
Yu Watanabe faa3cc2974 machine: fix wrong field name in varlink IDL
Follow-up for d5feeb373c (v258).
2025-09-24 23:23:37 +09:00
Yu Watanabe 513d91a159 boot: two trivial cleanups (#39093) 2025-09-24 23:18:00 +09:00
Lennart Poettering d7b966ad13 firstboot: don't call this thing a "wizard"
It isn't really, it's an initial setup tool, which is what GNOME calls
their equivalent too.
2025-09-24 15:46:30 +02:00
Lennart Poettering 875a618ed3 firstboot: modernize --help output 2025-09-24 15:46:30 +02:00
Lennart Poettering 73ee723aa7 firstboot: show blue "chrome" bar at top 2025-09-24 15:46:30 +02:00
Lennart Poettering 8191bbd23c prompt-util: add helpers that paint some "chrome" on top/bottom of screen
We'll soon have three different kind of interactive "wizard"-like console
UIs: systemd-firstboot, homectl firstboot and soon systemd-sysinstall.
Let's give them a limited, recognizable visual identity, to distinguish
them from the usual console output: let's add a bit of "chrome" to the
top and bottom of the screen, that we show during ther wizards, but hide
again afterwards.

This makes use of the DECSTBM sequence that reduces the scrolling area
by chopping off blocks from the top or bottom of the screen. The
sequence is quite standard, given it has been part of VT100 already.
xterm, vte, Linux console all support it just fine.
2025-09-24 15:46:30 +02:00
Lennart Poettering 71f3f1818f macro: add simple DEFER_VOID_CALL() helper 2025-09-24 15:46:30 +02:00
Lennart Poettering 32e0af0835 pretty-print: add WITH_BUFFERED_STDOUT() helper 2025-09-24 15:46:30 +02:00
Lennart Poettering 30aeab7883 terminal-util: add terminal_get_cursor_position() helper 2025-09-24 15:46:30 +02:00
Lennart Poettering fa350969ab prompt-util: add generic prompt loop implementation
This is a generalization of the logic in systemd-firstboot. This also
ports over firstboot.c to make use of the new generalization.
2025-09-24 15:46:30 +02:00
Lennart Poettering 74b8ab014b glyph-util: add more emojis 2025-09-24 15:45:28 +02:00
Luca Boccassi d80af3b97b machined: add PIDFD D-Bus variants for registering/creating machines
Current methods take a numeric PID, but we know that is unreliable for
the usual reasons. Add variants that take a PIDFD instead, or a
PID + PIDFDID combination for remote users.
2025-09-24 14:11:59 +01:00
Lennart Poettering 4284ef2f95 sd-boot: terminal handling tweaks (#39026)
Let's make sd-boot's terminal handling a bit cleaner, to the point that
uefi's weird handling allows this.
2025-09-24 14:40:38 +02:00
Lennart Poettering e27a530919 boot: let's make the one space we output early on invisible
let's place the cursor at the beginning of the line before/after, so we
know it's the first char we overwrite, and we return to the front again
right after.
2025-09-24 12:33:59 +02:00
Lennart Poettering f417a984c9 boot: return to beginning of line when enrolling 2025-09-24 12:33:59 +02:00
Lennart Poettering 8d36341cef boot: work around ansi color issues between sd-boot, uefi and terminals
So, UEFI's color texting is a bit weird. It translates everything to
ANSI sequences, but unlike ANSI sequences it has no understanding of a
distinct "default" bg/fg color, it assumes the ansi color "0" is always
equal to white on black, but that's of course not really true, most
terminal emulators at the very least support white background too.

tianocore then also tries to be smart and suppresses ANSI color changes
from a color to itself. But if the understanding of the color is wrong
in the first place, then any color change suppression like this hurts
more than it helps.

Then in addition there are certain terminal tools that will reset the bg
color on every line break ("less" for example) to the default.

Let's deal with that and improve the situation on all fronts:

1. force out color changes by doing two color changes whenever we really
   want it.

2. on every newline force out the color change again.

with this in place, using sd-boot on a terminal emulator is a lot nicer.
2025-09-24 12:33:59 +02:00
Yu Watanabe d88ecd2bca libacl → turn into dlopen() dependency (#39087) 2025-09-24 18:25:20 +09:00
Yu Watanabe 63dd548fb4 boot: rename ENROLL_TIMEOUT_TYPE_MAX -> ENROLL_TIMEOUT_MAX
To make it consistent with ENROLL_TIMEOUT_MIN.

Follow-up for 64376936c7.
2025-09-24 18:22:12 +09:00