Commit graph

74528 commits

Author SHA1 Message Date
Robin Lee 6efab8c343 vmspawn: define QEMU_MACHINE_TYPE for loongarch64
Use ["virt"](https://www.qemu.org/docs/master/system/loongarch/virt.html) as a commonly used generic platform on loongarch64.
2024-06-24 12:43:45 +02:00
Luca Boccassi 59a7019fee
Merge pull request #33452 from bluca/repart_pkg
mkosi: install new split-out systemd packages
2024-06-23 13:19:30 +01:00
Luca Boccassi 8a91a43197 mkosi: bump Debian Salsa commit to latest 2024-06-23 10:20:27 +01:00
Luca Boccassi 621a7fe064 mkosi: install new split-out systemd packages
repart and cryptsetup tools were moved out of the main package
to reduce dependencies.
2024-06-23 10:18:10 +01:00
Mike Yuan eb37c0c078 bus-unit-util: add PrivateTmpEx to bus_append_execute_property()
Follow-up for 9d50d053f3
2024-06-23 06:43:14 +09:00
Stuart Hayhurst 5e717db67c hwdb: Fix Logitech G915 TKL (Bluetooth) appearing as a mouse 2024-06-23 06:41:58 +09:00
Diego Viola a78394a49a man: fix double is typo in systemd-tmpfiles
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-06-22 17:06:26 +09:00
Lennart Poettering 18eaff4272 tree-wide: fix type of read() return variable at a couple of places
read() returns ssize_t (i.e. 64bit typically). We assigned it to int
variables in some cases (i.e. 32bit typically). Let's not be so sloppy,
and not accidentally drop 32bit on the floor.

(of course, this is not an issue IRL since we'll not have allocations
above 2^32 ever we could read into, but still, let's clean this up)
2024-06-22 17:05:36 +09:00
Lennart Poettering 57b41f15e5 varlink: yet another fix around handling of IDL comments
Skip over them when validating a message against the IDL.

Add test case that tests this.
2024-06-22 17:03:17 +09:00
Yu Watanabe af6e88432f
Merge pull request #33439 from YHNdnzj/private-tmp-followup
core: several follow-ups for recent changes to PrivateTmp
2024-06-22 16:34:55 +09:00
Yu Watanabe 5ab6845036
Merge pull request #33408 from poettering/install-change-fix
install: some follow-up fixes to #33254
2024-06-22 16:24:47 +09:00
Mike Yuan 9d50d053f3
core: expose PrivateTmp=disconnected
As discussed in https://github.com/systemd/systemd/pull/32724#discussion_r1638963071

I don't find the opposite reasoning particularly convincing.
We have ProtectHome=tmpfs and friends, and those can be
pretty much trivially implemented through TemporaryFileSystem=
too. The new logic brings many benefits, and is completely generic,
hence I see no reason not to expose it. We can even get more tests
for the code path if we make it public.
2024-06-21 17:31:44 +02:00
Mike Yuan d7f24848ba
core/namespace: add assertion for PRIVATE_TMP_CONNECTED 2024-06-21 17:24:08 +02:00
Mike Yuan 335b14ade5
core/exec-invoke: respect needs_sandboxing for PrivateTmp
Follow-up for 0e551b04ef
2024-06-21 17:24:08 +02:00
Mike Yuan 5f460ae1c2
core/dbus-util: move dbus setter/getter for PrivateTmp to dbus-execute
As with all other properties for ExecContext
2024-06-21 17:23:16 +02:00
Mike Yuan 41db82f206
core/dbus-execute: use FOREACH_ARRAY more, drop bus_ prefix for static funcs 2024-06-21 17:04:41 +02:00
Mike Yuan c3662116b9
man/org.freedesktop.systemd1: Status{Bus,Varlink}Error belongs to Service, not Scope
Follow-up for 9c025022d9

Ugh, shouldn't have done this bit when I was sleepy...
2024-06-21 16:47:28 +02:00
Lennart Poettering 64d61d1918 install: shorten code a bit
This changes behaviour a bit, since we now keep track of OOM errors in
install_changes_add(). Which I'd argue is a good thing.
2024-06-21 16:27:13 +02:00
Lennart Poettering 422f80d59b install: collect more install_changes_add() errors
We so far collected most unexpected errors from install_changes_add()
and propagated them – but for some invocations we forgot to do that. Add
that, and take care we only propagated unexpected errors (i.e. ENOMEM
and such), but treat expected errors as before.

Follow-up for 5163c9b1e5
2024-06-21 16:25:57 +02:00
Lennart Poettering 50df39f2dc cryptsetup: minor coding style tweaks
Don't cram function calls and assignment into if condition checks. It's
not how we usually do things.

Also, define variables at innermost scope.
2024-06-21 15:57:21 +02:00
Nick Rosbrook 82f57401d9 test: skip test-cgroup-id on ENOSYS from cg_cgroupid_open
Most container managers will block open_by_handle_at with seccomp to
mitigate a container escape attack. LXD in particular returns ENOSYS
rather than e.g. EPERM like nspawn. Skip this test if we get ENOSYS
from open_by_handle_at via cg_cgroupid_open.
2024-06-21 15:56:42 +02:00
Yu Watanabe 2c1ada796a
Merge pull request #33424 from poettering/machined-gc-rework
machined: clean up GC logic
2024-06-21 08:26:30 +09:00
Johannes Schneider b608bf5620 meson: bpf: propagate 'sysroot' for cross compilation
During cross-compilation of systemd, the compiler used to build the bpf's needs
to be pointed at the correct include searchpath. Which can be done by passing
the corresponding directory in through the cflags; for example in yocto/bitbake
this would work: CFLAGS += "--sysroot=${STAGING_DIR_TARGET}"

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
2024-06-21 08:25:58 +09:00
Lennart Poettering d42edbf1b8
Merge pull request #33430 from YHNdnzj/buserror-notify
core/service: store BUSERROR= & VARLINKERROR= received and show them through systemctl status
2024-06-20 23:05:32 +02:00
Lennart Poettering 5b272499dc
Merge pull request #33425 from poettering/json-enum-easier
json: make serializing/deserializing systemd-style enums easier in Varlink
2024-06-20 23:05:08 +02:00
Lennart Poettering 3fbbff83b6
Merge pull request #33428 from poettering/graceful-varlinkctl
varlinkctl: add new --graceful= switch for treating selected errors like a success
2024-06-20 23:04:45 +02:00
Lennart Poettering 1762c2c045 machined: watch leader PID's lifetime via pidfd
If we have a pidfd, we might as well track the machine's leader PID's
lifetime, and enqueue the machine for a GC run.

(This is similar to what we are already doing for logind's session
leaders)
2024-06-20 22:51:24 +02:00
Lennart Poettering 9b27811d49 machined: GC machines during runtime too
One major omission in machine's logic so far was that the GC was only
run at startup and on the check-idle timeout, which is really slow.

Let's make this more like the GC logic in homed or logind: make sure we
run it in a close-by event loop cycle.
2024-06-20 22:49:57 +02:00
Mike Yuan 4b89c55c3f
TEST-80-NOTIFYACCESS: introduce test for ERRNO= + BUS/VARLINKERROR= 2024-06-20 20:51:12 +02:00
Lennart Poettering 8ea918697a
busctl: send BUSERROR= to caller via sd_notify() protocol
varlinkctl has this nice feature that it sends the varlink error it gets
via sd_notify() to the caller. With previous commits this information
is collected and exposed in "systemctl status".

Let's make sure we can provide the same in busctl: also propagate errors
the same way.

With this we can comprehensively close #6073
2024-06-20 19:03:44 +02:00
Mike Yuan f488e97a75
systemctl-show: show Status{Bus,Varlink}Error in status 2024-06-20 19:03:44 +02:00
Mike Yuan 9c025022d9
core/service: store BUSERROR= & VARLINKERROR= received through notification
Closes #6073
2024-06-20 19:03:44 +02:00
Mike Yuan d319cbea45
sd-bus/bus-error: inline iterator var, use assert_return 2024-06-20 19:03:44 +02:00
Lennart Poettering 45840c2297 json: make it easy to dispatch our enums
This does the opposite of the previous patch: it undoes the "-" → "_"
mapping of enum values when we try to parse enums again.
2024-06-20 18:25:11 +02:00
Lennart Poettering a556a71e9c json: make it easy to serialize our enums to json
Most of our enums are mapped to strings that use dashes ("-") as word
separators, i.e. "foo-bar-baz". However, Varlink enums do not allow "-"
as separator, see:

https://varlink.org/Interface-Definition

Hence, let's add some simple glue to automatucally turn "-" into "_" for
use when serializing our enums.
2024-06-20 18:25:11 +02:00
Lennart Poettering ea441dbd9d ci: test new --graceful= switch of varlinkctl 2024-06-20 18:20:09 +02:00
Lennart Poettering da213bb5c0 varlinkctl: add --graceful= option for optionally marking some errors as successes
This is generally useful, but in some cases particularly: when
implementing enumeration calls that use the "more" flag to return
multiple replies then for the first reply we need to return an error in
case the list of objects to enumerate is empty, usually so form of
"NoSuchXYZ" error. In many cases this shouldn't really be treated as
error, as an empty list probably more than not is as valid as a list
with one, two or more entries.
2024-06-20 18:20:09 +02:00
Lennart Poettering 296027122b varlink: add helper that validates a qualified Varlink symbol name
Qualified Varlink symbol names are the combination of an interface name,
followed by a dot, followed by a symbol name. It's a primary concept,
after all it's what we send over the wire for method calls and get back
for error returns.

hence, let's add an explicit validator for it.
2024-06-20 18:20:09 +02:00
Yu Watanabe 912730a2d5
Merge pull request #33426 from aafeijoo-suse/conf-parser-parse-size-log
conf-parser: print why config_parse_iec_uint64() fails
2024-06-20 23:56:59 +09:00
Ludwig Nussel 0e10c3d872 logind: implement maintenance time
Update frameworks that work automatically in the background
occasionally need to schedule reboots. Systemd-logind already
provides a nice mechanism to schedule shutdowns, send notfications
and block logins short before the time. Systemd has a framework for
calendar events, so we may conveniently use logind to define a
maintenance time for reboots.

The existing ScheduleShutdown DBus method in logind expects a usec_t
with an absolute time. Passing USEC_INFINITY as magic value now tells
logind to take the time from the configured maintenance time if set.

"shutdown -r" leverages that and uses the maintenance time
automatically if configured. The one minute default is still used if
nothing was specified.

Similarly the new 'auto' setting for the --when parameter of systemctl
uses the maintenance time if configured or a one minute timer like the
shutdown command.
2024-06-20 14:37:42 +02:00
Kamil Szczęk e262205eb7 cryptenroll: support for enrolling FIDO2 tokens in manual mode
systemd-cryptsetup supports a FIDO2 mode with manual parameters, where
the user provides all the information necessary for recreating the
secret, such as: credential ID, relaying party ID and the salt. This
feature works great for implementing 2FA schemes, where the salt file
is for example a secret unsealed from the TPM or some other source.
While the unlocking part is quite straightforward to set up, enrolling
such a keyslot - not so easy. There is no clearly documented
way on how to set this up and online resources are scarce on this topic
too. By implementing a straightforward way to enroll such a keyslot
directly from systemd-cryptenroll we streamline the enrollment process
and reduce chances for user error when doing such things manually.
2024-06-20 14:26:24 +02:00
Antonio Alvarez Feijoo b3244d2b0a
conf-parser: print why config_parse_iec_uint64() fails
Print the same output as `config_parse_iec_size()` and
`config_parse_si_uint64()` if `parse_size()` fails, not only the `rvalue`.
2024-06-20 12:54:32 +02:00
Antonio Alvarez Feijoo 152f349385
conf-parser: set standard pointer alignment 2024-06-20 12:53:08 +02:00
Lennart Poettering ac6eb58f09
Merge pull request #33407 from poettering/varlink-idl-comment-fix
varlink: make comments on enum entries work
2024-06-20 12:13:59 +02:00
Lennart Poettering 8710bbfe96 bootctl: add comments to Varlink interface
This is mostly intended as test case for the early enum comment bugfix,
as this Varlink IDL description now contains such comments, and
test-varlink-idl will process it forth and back aleady.
2024-06-20 10:02:40 +02:00
Lennart Poettering 9e10f3a7e8 bootctl: normalize how we report no boot entries found
This normalizes how we report an empty list of boot entries in
ListBootEntries(). Our usual pattern is to return one item per method
call, but when there is none we usually return a NoSuchXYZ error. Do so
here too.

Before this we'd return a null item instead here, and only here.

This is a minor compat break, but given that this IPC interface is very
new and probably not used so far (we don't use it in our code at least,
and google doesn#t find any other use) I think this normalization is OK
at this point.
2024-06-20 10:02:40 +02:00
Lennart Poettering 5e542f8706 varlink: correctly format comments for enums too
I apparently never tested comments on enum values and hence they didn#t
work. Fix that.
2024-06-20 08:49:40 +02:00
Ludwig Nussel 8ce171bf51 bootctl: add --random-seed=yes/no 2024-06-20 14:26:13 +09:00
Yu Watanabe 8422d04e8d
Merge pull request #33420 from poettering/build-with-object
sd-json: add sd_json_build() flavour that implies we are building an object
2024-06-20 13:04:32 +09:00
Diego Viola 11b46dc117 man: fix typo in systemd-tmpfiles
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-06-20 13:02:06 +09:00