Commit Graph
74976 Commits
Author SHA1 Message Date
Adrian Vovk c4cb49eb34 table: Improve mangling of JSON field names
First, when displaying JSON we convert dashes into underscores. We want
to avoid using dashes in JSON field names in new code, because some
JSON parsers don't support dashes very well.

Second, we make the first character of every word lower-case. This
better matches our JSON field name style, and makes the automatic
JSON name mangling a lot more useful for vertical tables, where fields
are given a display name. For example, "Foo Bar" would be converted into
"foo_bar" instead of "Foo_Bar", which much better matches our style.
We don't make the whole string lowercase to support cases like:
"fooBar" should stay as "fooBar".

Some situations don't behave quite perfectly, such as "Foo BarBaz" gets
converted into "foo_barBaz", or all-caps headings get mangled
incorrectly. In these situations, the JSON field should be overridden
manually. In most cases, or at least more cases than before, this
heuristic does good enough.
2024-07-17 14:15:43 -04:00
Adrian Vovk bf01601f11 table: Add TABLE_SET_JSON_FIELD_NAME
Lets you conveniently set JSON field names in table_add_many. Especially
useful for vertical tables. For example:

table_add_many(t,
               TABLE_FIELD, "Display Name",
               TABLE_STRING, obj->display_name,
               TABLE_SET_JSON_FIELD_NAME, "displayName",
               TABLE_FIELD, "Timestamp",
               TABLE_TIMESTAMP, obj->timestamp,
               TABLE_SET_JSON_FIELD_NAME, "timestampUSec");
2024-07-17 14:15:41 -04:00
Daan De Meyer 473747b8cf Merge pull request #33752 from DaanDeMeyer/lsm
Two mkosi improvements
2024-07-17 20:15:17 +02:00
Daan De Meyer f5c44df929 mkosi: Remove enforcing=0 from default kernel command line
We already have selinux=0 in the default kernel command line so
enforcing=0 is redundant. Instead, pass in enforcing=0 when we
enable selinux in TEST-06-SELINUX.
2024-07-17 18:56:02 +02:00
Daan De Meyer 5319be5f0c mkosi: Stop setting apparmor=0
It doesn't get pulled in as a dependency anyway and kernel command
line space is precious so let's remove apparmor=0 as it's a noop
anyway.
2024-07-17 18:55:24 +02:00
Luca Boccassi 09edabe96a id128: add 'var-partition-uuid' verb
As per DPS the UUID for /var/ should be keyed by the local machine-id,
which is non-trivial to do in a script. Enhance 'systemd-id128' to
take 'var-partition-uuid' as a verb, and if so perform the
calculation.
2024-07-17 18:05:40 +02:00
Daan De Meyer d9b1ec27f7 Merge pull request #33714 from poettering/make-varlink-public
varlink: make API public as "sd-varlink.h"
2024-07-17 12:58:50 +02:00
migleeson cb2d6214ca docs: update mkosi version mentioned in HACKING.md (#33723)
* fix: update docs since the default config uses a setting only available in v23

* fix: update docs to only refer to installing from the mkosi repo
2024-07-17 09:45:26 +02:00
Hans de Goede fd820e76e4 rules: Add uaccess tag to /dev/udmabuf
In some cases userspace may need to create dmabuffers from userspace
on such example is the software ISP part of libcamera which needs to
allocate dma-buffers for the output of the software ISP.

At first the plan was to allow console users access to /dev/dma_heap/*,
this was discussed with various kernel folks here:
https://lore.kernel.org/all/bb372250-e8b8-4458-bc99-dd8365b06991@redhat.com/

Giving console users access to the dma_heap's was deemed a bad idea
because memory allocated this way is not accounted in cgroup limits.

Giving access to /dev/udmabuf OTOH was deemed acceptable so that
is what this patch adds.

Resolves: #32662
2024-07-17 09:36:45 +02:00
Mike Yuan fa96c55b7b id128: refuse --app-specific= if we're listing GPT types
Prompted by #33737

The intention of b37e8184a5
is to expose sd_id128_get_app_specific() on command line.
But combining that with GPT type list makes little sense.
2024-07-17 09:35:58 +02:00
Luca Boccassi f0b151ce86 gpt: add more architecture aliases
Same as the other aliases. Allows chaining commands like:

$ systemd-id128 show -P root-$(dpkg-architecture --query DEB_HOST_ARCH)
4f68bce3e8cd4db196e7fbcaf984b709
2024-07-16 23:12:48 +02:00
Daan De Meyer b209fff3a5 mkosi: List library packages explicitly in VolatilePackages=
These should already get pulled in as dependencies, but it doesn't
hurt to be explicit.
2024-07-16 14:53:55 +02:00
Daan De Meyer 68ee977114 mkosi: Build initrd as a subimage
Let's make things a little more consistent and build the initrd
explicitly as a subimage as well instead of relying on mkosi building
it as part of the main image build.

We drop the opensuse initrd postinst script as we don't use erofs by
default anymore. We can always reintroduce it again later if needed.
2024-07-16 13:59:47 +02:00
Daan De Meyer 244952b1ea mkosi: Drop CacheOnly=always from two subimages
This is a universal setting and can only be configured in the main
image so let's drop it from the subimages.
2024-07-16 12:14:32 +02:00
Lennart Poettering 2abad25b41 update TODO 2024-07-16 11:57:32 +02:00
Lennart Poettering 15d19cf86f sd-json/sd-varlink: downgrade assert() → assert_ret()
Our usual rule is that we are more lenient towards misuse for public
users of our code than for ourselves. Or in other words: when validating
parameters of our public functions (those starting with sd_…) we prefer
assert_ret() over assert().
2024-07-16 11:57:32 +02:00
Lennart Poettering 92100f14c3 libsystemd: use C23 explicit enum types where available
In C23 we can explicitly choose the integer type for an enum. Let's do
so to make our requirements for 64bit integers explicitly. Previously,
we'd rely on a GNU extension that would size the enum to 64bit if at
least one value outside the 32bit range is in the enum. Let's keep that
too, for compat with older compilers.

(Also, add the support for older compilers to the definition of
sd_json_dispatch_flags_t, where it was forgotten so far)
2024-07-16 11:57:32 +02:00
Lennart Poettering 25ff515b39 sd-varlink: make our internal Varlink API public as sd-varlink.[ch]
It's time. sd-json was already done earlier in this cycle, let's now
make sd-varlink public too.

This is mostly just a search/replace job of epical proportions.

I left some functions internal (mostly IDL handling), and I turned some
static inline calls into regular calls.
2024-07-16 11:57:32 +02:00
Daan De Meyer 923eeb38fb Merge pull request #33695 from DaanDeMeyer/epel
mkosi: Add CI for CentOS Stream 10
2024-07-16 11:43:49 +02:00
Daan De Meyer 5ac0dc70ff TEST-13-NSPAWN: make sure we don't load libnss_systemd
Let's make sure we don't load libnss_systemd.so from bash as the
necessary environment variables aren't set to make that work when
we're running with sanitizers enabled.

We can't add a sanitizer wrapper for bash as the wrapper runs using
bash so you end up in a loop.
2024-07-16 09:42:17 +02:00
Daan De Meyer 88221219a3 mkosi: Disable unique debug source names
We use -fdebug-prefix-map= because debugedit doesn't work for us (for
a currently unknown reason since it's the most obtuse code I've ever
had the pleasure of reading). With all the unique macros enabled, the
destination directory we pass to -fdebug-prefix-map= includes the package
release. The release is either the timestamp of the current commit or
the current time if the working tree is dirty. This means it generally
changes every time we rerun the build script. However, meson only reads
compiler arguments the first time it is invoked or if --wipe is specified.
This means that on a rerun -fdebug-prefix-map= will be configured wrong
and the build will fail.

Let's prevent this from happening by disabling the unique debug source
names by overriding the --unique-debug-src-base option that is passed to
find-debuginfo.sh by rpm via the _find_debuginfo_opts macro.
2024-07-16 09:41:22 +02:00
Daan De Meyer 985d5b4bc2 systemd-networkd-tests: Skip tests requiring dhcpd if it is not available
dhcpd is not available on CentOS Stream 10

See https://github.com/systemd/systemd/issues/33717
2024-07-15 16:17:33 +02:00
Daan De Meyer f65ec2e904 TEST-55-OOMD: Remove the opensuse user@ dropin
Required to make TEST-55-OOMD pass on OpenSUSE.
2024-07-15 16:17:33 +02:00
Daan De Meyer a1071c1249 mkosi: Install binutils 2024-07-15 16:17:33 +02:00
Daan De Meyer d97b48176b TEST-64-UDEV-STORAGE: Use max_ioqpairs instead of num_queues
Fixes a deprecation warning from qemu.
2024-07-15 16:17:33 +02:00
Daan De Meyer 6e212a6db9 mkosi: Use clang --print-runtime-dir 2024-07-15 16:17:33 +02:00
Daan De Meyer 54ab97e59d mkosi: Extend arch build script comment about symlinks 2024-07-15 16:17:33 +02:00
Daan De Meyer ff8c89aa5a test: do not attempt to set xattr on tmpfs
This is only possible since a recent kernel version, and fails otherwise,
like on CentOS 9
2024-07-15 16:17:33 +02:00
Daan De Meyer 8b32cc79ec mkosi: Add CI for CentOS Stream 10
We switch to the c10s-sig-hyperscale branch of the spec repository
as it will receive all the latest changes the earliest before they
end up in the c9s-sig-hyperscale branch.
2024-07-15 16:17:33 +02:00
Daan De Meyer 3cfb020cb9 mkosi: Use squashfs for sysext if mkfs.erofs is not available
CentOS Stream 10 does not have erofs-utils so let's add a fallback
to squashfs when building the sysext.
2024-07-15 16:17:33 +02:00
Daan De Meyer 0e4a7ab6d5 mkosi: Make epel repositories optional for CentOS Stream 9
This allows us to add CI for CentOS Stream 10 as EPEL 10 doesn't
exist yet and won't exist for quite some time.

CentOS Stream 10 will be enabled later as soon as
https://issues.redhat.com/browse/RHEL-46604 is resolved.
2024-07-15 16:17:33 +02:00
Daan De Meyer 7205fc7dc3 mkosi: Introduce build image
We want the exitrd image to be built with the latest systemd as well.
As the exitrd image is built as part of mkosi.images, and all subimages
are built before the main image, this implies the packages must be built
as a subimage in mkosi.images/ as well. So we introduce the build image and
move all logic related to building distribution packages there.

This also has the nice side effect of slimming down the main image as the
build dependencies are not installed into the main image anymore. It also
makes sure the packages are built in a "clean" chroot without any of the
other packages which we install in the main image available.
2024-07-15 16:17:33 +02:00
Daan De Meyer 72a8f508e5 mkosi: update fedora commit reference
* a3524fc837 Use a more precise Recommends for libkxbcommon
* 980ede8c0f Drop machined revert
* d569018a92 Rebuilt for the bin-sbin merge
* 8881fa94ee Version 256.2
* 1cc4f83002 Link systemd-executor statically
* 0319e62d9c Update dracut workaround
* c96f54de22 Fix ELN build
* 3f68c5d802 Only exclude dracut conflicts on non-fedora on upstream builds
* 7db154308b Conditionalize dracut Conflicts more
2024-07-15 16:17:33 +02:00
Daan De Meyer 9e8cfe5daa mkosi: Update to latest 2024-07-15 16:17:31 +02:00
Sean Rhodes d350651c47 Revert "hwdb: Added StarLabs StarLite position sensor mapping"
This reverts commit 1bd5db86f5.

The `kxcjk-1013` driver in Linux will parse the rotation matrix
from ACPI. This quirk is not specific enough to exist without
causing issues on different variations.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2024-07-15 12:34:08 +02:00
Lennart Poettering 4eca398c34 Merge pull request #33718 from YHNdnzj/machine-id-followup
core/main: several cleanups
2024-07-15 11:16:59 +02:00
Abderrahim Kitouni 22b414f185 sysupdate: fix return types according to style guide 2024-07-15 10:18:41 +02:00
chayleaf 21aa180b4a fstab-generator: add x-systemd.wants
This is an analog of x-systemd.requires that adds a Wants dependency
instead. This is useful for filesystems that support mounting in
degraded states (such as multi-device filesystems).
2024-07-15 10:18:18 +02:00
Jörg Behrmann 99d4575e54 kernel-install: Remove existing loader entries and UKIs
When boot counting is enabled, adding a new loader entry or UKI can conflict
with an existing one that has booted successfully and therefore has its boot
counter removed. systemd-bless-boot will fail to bless the new successful boot,
since a file without a boot counter already exists. Since kernel-install will
clobber existing files without boot counting, we should therefore remove files
without a boot count as well, when we add a file with one.

Fixes: #33504
2024-07-15 10:16:36 +02:00
Abderrahim Kitouni a31d32f6c4 sysupdate: fix size_t specifier 2024-07-15 10:15:13 +02:00
Mike Yuan 87c4f0f824 core/main: refuse to run if /usr/ is not populated
The support for split-usr has been dropped in v255.
So, rather than emitting a warning, let's refuse
such unsupported setups completely.
2024-07-13 22:58:24 +02:00
Mike Yuan 2bff236e70 core/main: move capability_ambient_set_apply() to initialize_runtime()
This is preparation for (user) manager, and we apply capability
settings for the system manager in initialize_runtime() too.
2024-07-13 22:58:24 +02:00
Mike Yuan 9100325690 core/main: respect skip_setup for RUNTIME_SCOPE_USER too 2024-07-13 22:58:24 +02:00
Mike Yuan 0acf4dfef5 core/main: merge second RUNTIME_SCOPE_SYSTEM block into switch above 2024-07-13 22:58:23 +02:00
Mike Yuan 20817cd272 core/main: modernize setup_os_release() a bit 2024-07-13 22:58:23 +02:00
Mike Yuan 0c7a2a5542 core/main: cast ignored retval of machine_id_setup() to void 2024-07-13 22:58:23 +02:00
Mike Yuan efa7a5cfe4 core/import-creds: use proc_cmdline_get_bool() 2024-07-13 22:58:23 +02:00
Mike Yuan 497b17bbad core/import-creds: use FOREACH_ARRAY and RET_GATHER where appropriate 2024-07-13 22:58:23 +02:00
Mike Yuan 77c3e07f93 basic/mkdir: merge two if blocks, return more accurate errno 2024-07-13 22:58:22 +02:00
Merlin Jehli 274a38c79a machine-id: Add cmdline argument to use VM behaviour on bare metal (#32086)
Closes #30707
2024-07-13 18:00:16 +02:00