Commit graph

64698 commits

Author SHA1 Message Date
Daan De Meyer 78c49d012c mkosi: Always pull in network-online.target
Let's always pull this in so that we always activate
systemd-networkd-wait-online for extra coverage.
2023-05-15 15:41:53 +02:00
Daan De Meyer 1fb59099f6 mkosi: Drop squashfs dropin
This accidentally got pulled into a commit even though it was only
for local testing, let's drop it again so we correctly use erofs
when building local images.
2023-05-15 15:41:53 +02:00
Frantisek Sumsal 3426ec8efb nspawn: file system namespace -> mount namespace 2023-05-15 14:05:15 +02:00
Frantisek Sumsal 55d3c136d9 nspawn: fix a typo in an error message 2023-05-15 14:01:58 +02:00
Robert Scheck c06d2e440c portable, meson: allow statically linked build
Build option "link-portabled-shared" to build a statically linked
systemd-portabled by using

  -Dlink-portabled-shared=false

on systems with full systemd stack except systemd-portabled, such
as CentOS/RHEL 9.
2023-05-15 13:30:04 +02:00
Daan De Meyer 3dca0b3661 mkosi: Install tmux in the final image
We currently have to resort to SSH to get more than one interactive
terminal in a mkosi qemu VM. Let's increase our options by installing
tmux in the final image, which can multiplex the serial console into
many unique terminal sessions.
2023-05-15 11:45:58 +01:00
Luca Boccassi f9c91eea78
Merge pull request #27644 from mrc0mmand/fuzz-nspawn
test: update nspawn's basic config file used for fuzzing
2023-05-15 11:45:15 +01:00
Frantisek Sumsal 806b18240a test: make $BUILD_DIR writable when rootfs is mounted read-only
Adjust two systemd-nspawn invocations where rootfs is mounted read-only,
to avoid gcov complaining.
2023-05-15 10:15:24 +02:00
Frantisek Sumsal 786f6d81f7 test: pass $BUILD_DIR as $COVERAGE_BUILD_DIR to the system manager
To make additional coverage-related tweaks slightly easier.
2023-05-15 10:06:54 +02:00
Mike Yuan b5b1351317
test: add tests for UpheldBy= in [Install] section 2023-05-15 15:04:38 +08:00
Mike Yuan 38f901791f
unit-file: support UpheldBy= in [Install] settings (adding Upholds= deps
from .upholds/)

Closes #26896
2023-05-15 15:04:38 +08:00
Frantisek Sumsal 1c8bf49b67 test: update nspawn's basic config file used for fuzzing 2023-05-15 09:00:17 +02:00
Daan De Meyer 62281c78bb machine-id-setup: Do not overwrite if /etc/machine-id contains uninitialized
When we're building OS images, we never want /etc/machine-id to contain
anything other than "uninitialized" until we actually boot the image. So
let's allow image builders to write "uninitialized" to /etc/machine-id
and if systemd-machine-id-setup is called after, make sure we don't
overwrite it.
2023-05-15 10:16:27 +09:00
Luca Boccassi 048eb301ec
Merge pull request #27640 from mrc0mmand/more-tests
test: more TEST-13-NSPAWN-SMOKE follow-ups
2023-05-14 23:35:05 +01:00
Frantisek Sumsal 08d547a481 test: rename TEST-13-NSPAWN-SMOKE to TEST-13-NSPAWN
To make it consistent with the rest of the tests.
2023-05-14 19:32:07 +02:00
Frantisek Sumsal 703766408f test: slightly extend the systemd-nspawn tests 2023-05-14 19:32:07 +02:00
Frantisek Sumsal 8416a15e5c test: wait after sending a signal if necessary
On overloaded systems it might take a bit until the signal is sent,
processed, and the respective file is created.
2023-05-14 19:32:07 +02:00
Frantisek Sumsal fee9f7b5c7 nspawn: simplify error handling 2023-05-14 19:32:07 +02:00
Frantisek Sumsal 807626d1ce test: install the overlayfs/loop modules unconditionally 2023-05-14 19:32:07 +02:00
Frantisek Sumsal 9f596939e4 test: create merged-usr containers 2023-05-14 19:32:07 +02:00
Frantisek Sumsal 3b2823a749 test: bind mount the $BUILD_DIR into nspawn containers
when collecting coverage. This applies only to containers started
via machinectl (or directly via the systemd-nspawn@.service unit).
2023-05-14 19:32:07 +02:00
Frantisek Sumsal ceea144ed8 test: use dropins to override system configuration
Instead of touching the configuration files directly.
2023-05-14 19:32:07 +02:00
Frantisek Sumsal f339240ad0 vimrc: use 109ch text width for shell scripts as well 2023-05-13 22:02:37 +02:00
Maksim Kliazovich 3f01456032 po: Translated using Weblate (Belarusian)
Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Maksim Kliazovich <maxklezovich@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/be/
Translation: systemd/main
2023-05-13 21:51:46 +02:00
Yu Watanabe 0c3ea0c222 sd-dhcp-server: also send DNS servers or friends on DHCPOFFER
From RFC 2131 section 4.3.1 (https://www.rfc-editor.org/rfc/rfc2131#section-4.3.1):
----
The server MUST return to the client:
- Parameters requested by the client, according to the following rules:
  -- IF the server has been explicitly configured with a default
     value for the parameter, the server MUST include that value
     in an appropriate option in the 'option' field,
----
The sentence is not only for ACK, but for all (positive) responses, that
is DHCPOFFER and DHCPACK.

Fixes #27471.
2023-05-13 12:37:17 +01:00
Luca Boccassi d5e6c4be91
Merge pull request #27605 from YHNdnzj/dbus-activation-followup
core: only refuse Type=dbus service enqueue if dbus has pending stop job
2023-05-13 11:49:21 +01:00
Luca Boccassi e0226959ae
Merge pull request #27571 from DaanDeMeyer/mkosi
mkosi: Package a erofs usr partition with signed verity
2023-05-13 11:09:00 +01:00
Luca Boccassi 942afbad2a
Merge pull request #27634 from mrc0mmand/TEST-13-shenanigans
test: clean up & extend the nspawn/machinectl test suite
2023-05-13 10:23:14 +01:00
Daan De Meyer 47e5e12866 mkosi: Package a erofs usr partition with signed verity
Let's start moving towards a more involved partitioning setup to
test our stuff more when using mkosi.

The root partition is generated on boot with systemd-repart.

CentOS supports neither erofs nor btrfs so we use squashfs and xfs
instead.

We also enable SecureBoot= locally for additional coverage. This
and the use of verity means users need to run `mkosi genkey` once
to generate the keys necessary to do secure boot and verity.
2023-05-13 10:49:17 +02:00
Daan De Meyer 724683c27f mkosi: Store /etc under /usr/share/factory/mkosi
If we're making a /usr only image, we still want to populate /etc
fully on first boot. To make that possible, let's copy /etc to
/usr/share/factory/mkosi in a finalize script, which runs after
all changes to the image have been made. Let's also add a tmpfiles
snippet that merges /usr/share/factory/mkosi with /etc on boot to
populate /etc.
2023-05-13 09:17:15 +02:00
Daan De Meyer 79255d86ba mkosi: Do not enable ACL usage by default
This is only useful to be able to remove generated files using rm -rf
instead of mkosi clean and has some implications for the generated
rootfs so let's not enable it by default.
2023-05-13 09:17:15 +02:00
Daan De Meyer fecbce1fc6 sulogin: Read SYSTEMD_SULOGIN_FORCE from kernel cmdline
This allows setting it on the kernel cmdline and having it work
automatically without having to write any dropins or such.

Also enable the option in mkosi so that we can debug the initrd
properly with a locked root account.
2023-05-13 09:16:55 +02:00
Frantisek Sumsal 7362947c3f machine,portable: fix a typo in an info message 2023-05-13 00:26:38 +02:00
Frantisek Sumsal a1ff1ac273 test: merge machinectl edit/cat tests into TEST-13 2023-05-13 00:26:38 +02:00
Frantisek Sumsal 990b629e12 test: always install the script utility 2023-05-13 00:26:38 +02:00
Frantisek Sumsal 378db9e2b9 test: add a couple of tests for machinectl 2023-05-13 00:26:38 +02:00
Luca Boccassi 27cead47be
Merge pull request #27633 from DaanDeMeyer/repart-dropin
repart: Make sure we look up dropin files in the root directory
2023-05-12 21:29:38 +01:00
Daan De Meyer f0ad3e6b96 units: Add missing dependencies on initrd-switch-root.target
These are all services that valid to be run in the initrd, so let's
make sure they have the appropriate dependencies on
initrd-switch-root.target so that they are stopped when we're about
to switch root.
2023-05-13 02:14:02 +08:00
drosdeck e71254edb0 Fix Positivo CF40CM-V2 key toggle touchpad 2023-05-13 03:13:24 +09:00
Frantisek Sumsal efdaa92ecb machine: fix a memory leak when showing multiple machines
+ machinectl status long-running long-running long-running
=================================================================
==986==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1568 byte(s) in 2 object(s) allocated from:
    #0 0x7fe57caba097 in calloc (/lib64/libasan.so.8+0xba097)
    #1 0x7fe57b891e8e in message_from_header ../src/libsystemd/sd-bus/bus-message.c:372
    #2 0x7fe57b892dfd in bus_message_from_malloc ../src/libsystemd/sd-bus/bus-message.c:421
    #3 0x7fe57b9089a8 in bus_socket_make_message ../src/libsystemd/sd-bus/bus-socket.c:1165
    #4 0x7fe57b90affe in bus_socket_read_message ../src/libsystemd/sd-bus/bus-socket.c:1294
    #5 0x7fe57b92db71 in bus_read_message ../src/libsystemd/sd-bus/sd-bus.c:2082
    #6 0x7fe57b933352 in sd_bus_call ../src/libsystemd/sd-bus/sd-bus.c:2483
    #7 0x7fe57b84da61 in sd_bus_call_methodv ../src/libsystemd/sd-bus/bus-convenience.c:183
    #8 0x7fe57b2789e8 in bus_call_method ../src/shared/bus-locator.c:109
    #9 0x40f71c in show_machine ../src/machine/machinectl.c:713
    #10 0x7fe57b65c8cf in dispatch_verb ../src/shared/verbs.c:103
    #11 0x42e9ce in machinectl_main ../src/machine/machinectl.c:2980
    #12 0x42ebf9 in run ../src/machine/machinectl.c:3005
    #13 0x42ed1f in main ../src/machine/machinectl.c:3008
    #14 0x7fe579e4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
Indirect leak of 234 byte(s) in 2 object(s) allocated from:
    #0 0x7fe57cab95b5 in __interceptor_realloc.part.0 (/lib64/libasan.so.8+0xb95b5)
    #1 0x7fe57b909822 in bus_socket_read_message ../src/libsystemd/sd-bus/bus-socket.c:1214
    #2 0x7fe57b92db71 in bus_read_message ../src/libsystemd/sd-bus/sd-bus.c:2082
    #3 0x7fe57b933352 in sd_bus_call ../src/libsystemd/sd-bus/sd-bus.c:2483
    #4 0x7fe57b84da61 in sd_bus_call_methodv ../src/libsystemd/sd-bus/bus-convenience.c:183
    #5 0x7fe57b2789e8 in bus_call_method ../src/shared/bus-locator.c:109
    #6 0x40f71c in show_machine ../src/machine/machinectl.c:713
    #7 0x7fe57b65c8cf in dispatch_verb ../src/shared/verbs.c:103
    #8 0x42e9ce in machinectl_main ../src/machine/machinectl.c:2980
    #9 0x42ebf9 in run ../src/machine/machinectl.c:3005
    #10 0x42ed1f in main ../src/machine/machinectl.c:3008
    #11 0x7fe579e4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
Indirect leak of 4 byte(s) in 2 object(s) allocated from:
    #0 0x7fe57ca7243b in strdup (/lib64/libasan.so.8+0x7243b)
    #1 0x7fe57b8c1543 in message_parse_fields ../src/libsystemd/sd-bus/bus-message.c:4125
    #2 0x7fe57b893586 in bus_message_from_malloc ../src/libsystemd/sd-bus/bus-message.c:443
    #3 0x7fe57b9089a8 in bus_socket_make_message ../src/libsystemd/sd-bus/bus-socket.c:1165
    #4 0x7fe57b90affe in bus_socket_read_message ../src/libsystemd/sd-bus/bus-socket.c:1294
    #5 0x7fe57b92db71 in bus_read_message ../src/libsystemd/sd-bus/sd-bus.c:2082
    #6 0x7fe57b933352 in sd_bus_call ../src/libsystemd/sd-bus/sd-bus.c:2483
    #7 0x7fe57b84da61 in sd_bus_call_methodv ../src/libsystemd/sd-bus/bus-convenience.c:183
    #8 0x7fe57b2789e8 in bus_call_method ../src/shared/bus-locator.c:109
    #9 0x40f71c in show_machine ../src/machine/machinectl.c:713
    #10 0x7fe57b65c8cf in dispatch_verb ../src/shared/verbs.c:103
    #11 0x42e9ce in machinectl_main ../src/machine/machinectl.c:2980
    #12 0x42ebf9 in run ../src/machine/machinectl.c:3005
    #13 0x42ed1f in main ../src/machine/machinectl.c:3008
    #14 0x7fe579e4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
SUMMARY: AddressSanitizer: 1806 byte(s) leaked in 6 allocation(s).
2023-05-12 18:05:32 +02:00
Frantisek Sumsal 4b6ce580ee machine: fix a memory leak when showing multiple images
+ machinectl image-status container1 container1 container0 container1 container2 container3 container4
 =================================================================
 ==1354==ERROR: LeakSanitizer: detected memory leaks
 Direct leak of 4704 byte(s) in 6 object(s) allocated from:
     #0 0x7fc3670ba097 in calloc (/lib64/libasan.so.8+0xba097)
     #1 0x7fc365e91e8e in message_from_header ../src/libsystemd/sd-bus/bus-message.c:372
     #2 0x7fc365e92dfd in bus_message_from_malloc ../src/libsystemd/sd-bus/bus-message.c:421
     #3 0x7fc365f089a8 in bus_socket_make_message ../src/libsystemd/sd-bus/bus-socket.c:1165
     #4 0x7fc365f0affe in bus_socket_read_message ../src/libsystemd/sd-bus/bus-socket.c:1294
     #5 0x7fc365f2db71 in bus_read_message ../src/libsystemd/sd-bus/sd-bus.c:2082
     #6 0x7fc365f33352 in sd_bus_call ../src/libsystemd/sd-bus/sd-bus.c:2483
     #7 0x7fc365e4da61 in sd_bus_call_methodv ../src/libsystemd/sd-bus/bus-convenience.c:183
     #8 0x7fc3658789e8 in bus_call_method ../src/shared/bus-locator.c:109
     #9 0x413b76 in show_image ../src/machine/machinectl.c:1014
     #10 0x7fc365c5c8cf in dispatch_verb ../src/shared/verbs.c:103
     #11 0x42e992 in machinectl_main ../src/machine/machinectl.c:2981
     #12 0x42ebbd in run ../src/machine/machinectl.c:3006
     #13 0x42ece3 in main ../src/machine/machinectl.c:3009
     #14 0x7fc36444a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
 Indirect leak of 666 byte(s) in 6 object(s) allocated from:
     #0 0x7fc3670b95b5 in __interceptor_realloc.part.0 (/lib64/libasan.so.8+0xb95b5)
     #1 0x7fc365f09822 in bus_socket_read_message ../src/libsystemd/sd-bus/bus-socket.c:1214
     #2 0x7fc365f2db71 in bus_read_message ../src/libsystemd/sd-bus/sd-bus.c:2082
     #3 0x7fc365f33352 in sd_bus_call ../src/libsystemd/sd-bus/sd-bus.c:2483
     #4 0x7fc365e4da61 in sd_bus_call_methodv ../src/libsystemd/sd-bus/bus-convenience.c:183
     #5 0x7fc3658789e8 in bus_call_method ../src/shared/bus-locator.c:109
     #6 0x413b76 in show_image ../src/machine/machinectl.c:1014
     #7 0x7fc365c5c8cf in dispatch_verb ../src/shared/verbs.c:103
     #8 0x42e992 in machinectl_main ../src/machine/machinectl.c:2981
     #9 0x42ebbd in run ../src/machine/machinectl.c:3006
     #10 0x42ece3 in main ../src/machine/machinectl.c:3009
     #11 0x7fc36444a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
 Indirect leak of 12 byte(s) in 6 object(s) allocated from:
     #0 0x7fc36707243b in strdup (/lib64/libasan.so.8+0x7243b)
     #1 0x7fc365ec1543 in message_parse_fields ../src/libsystemd/sd-bus/bus-message.c:4125
     #2 0x7fc365e93586 in bus_message_from_malloc ../src/libsystemd/sd-bus/bus-message.c:443
     #3 0x7fc365f089a8 in bus_socket_make_message ../src/libsystemd/sd-bus/bus-socket.c:1165
     #4 0x7fc365f0affe in bus_socket_read_message ../src/libsystemd/sd-bus/bus-socket.c:1294
     #5 0x7fc365f2db71 in bus_read_message ../src/libsystemd/sd-bus/sd-bus.c:2082
     #6 0x7fc365f33352 in sd_bus_call ../src/libsystemd/sd-bus/sd-bus.c:2483
     #7 0x7fc365e4da61 in sd_bus_call_methodv ../src/libsystemd/sd-bus/bus-convenience.c:183
     #8 0x7fc3658789e8 in bus_call_method ../src/shared/bus-locator.c:109
     #9 0x413b76 in show_image ../src/machine/machinectl.c:1014
     #10 0x7fc365c5c8cf in dispatch_verb ../src/shared/verbs.c:103
     #11 0x42e992 in machinectl_main ../src/machine/machinectl.c:2981
     #12 0x42ebbd in run ../src/machine/machinectl.c:3006
     #13 0x42ece3 in main ../src/machine/machinectl.c:3009
     #14 0x7fc36444a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
 SUMMARY: AddressSanitizer: 5382 byte(s) leaked in 18 allocation(s).
2023-05-12 18:05:32 +02:00
Frantisek Sumsal c2df08b5b8 test: clean up the nspawn tests a bit 2023-05-12 18:05:29 +02:00
Daan De Meyer 34f2fd5096 repart: Make sure we look up dropin files in the root directory 2023-05-12 17:52:47 +02:00
Daan De Meyer 947f59ba2b conf-parser: Add root argument to config_parse_many() 2023-05-12 17:52:32 +02:00
Frantisek Sumsal e8dba80626 core: fix memory leak during deserialization
when activation-details-unit-name is encountered multiple times.

Resolves: #27623
2023-05-13 00:42:25 +09:00
Daan De Meyer 9b05a3715b repart: Make sure r is declared last 2023-05-12 17:38:00 +02:00
Daan De Meyer 4b047310f6 repart: Read arguments directly instead of passing them in 2023-05-12 17:38:00 +02:00
Daan De Meyer 104afc7300 mkosi: Use zstd compression on non-centos distros
Just because centos doesn't support it doesn't mean we can't use it
on the other distros.
2023-05-12 11:38:02 +02:00
Daan De Meyer 39886236e8 mkosi: Update .gitignore to account for changed output locations 2023-05-12 11:38:02 +02:00
Daan De Meyer 33ad6163ba mkosi: Only build initrd if Bootable= is enabled or set to "auto"
With this change, Bootable= can be set to "no" for a faster build
intended for booting in systemd-nspawn but not qemu.
2023-05-12 11:38:02 +02:00