]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
12 months agoMerge pull request #27638 from YHNdnzj/upheldby-unit-file
Mike Yuan [Tue, 16 May 2023 13:53:24 +0000 (21:53 +0800)] 
Merge pull request #27638 from YHNdnzj/upheldby-unit-file

unit-file: support UpheldBy= in [Install] settings (adding Upholds= deps from .upholds/)

12 months agoMerge pull request #27573 from poettering/sd-bus-description
Lennart Poettering [Tue, 16 May 2023 13:46:29 +0000 (06:46 -0700)] 
Merge pull request #27573 from poettering/sd-bus-description

sd-bus: pass bus description (and comm name) to per via socket address binding on AF_UNIX

12 months agoMerge pull request #27648 from poettering/common-dissect-dir
Lennart Poettering [Tue, 16 May 2023 12:26:48 +0000 (05:26 -0700)] 
Merge pull request #27648 from poettering/common-dissect-dir

pid1: add common root dir inode to mount disk images to in private namespaces

12 months agoMerge pull request #27647 from poettering/mount-setup-tweaklets
Lennart Poettering [Tue, 16 May 2023 12:26:09 +0000 (05:26 -0700)] 
Merge pull request #27647 from poettering/mount-setup-tweaklets

mount-setup: minor tweaks

12 months agoMerge pull request #27658 from poettering/base-fs-run
Lennart Poettering [Tue, 16 May 2023 12:25:43 +0000 (05:25 -0700)] 
Merge pull request #27658 from poettering/base-fs-run

base-filesystem: also set up /run/ mount point if missing

12 months agoman: indicate that the JOB parameter to "systemctl cancel" is optional
Lennart Poettering [Tue, 16 May 2023 07:35:39 +0000 (09:35 +0200)] 
man: indicate that the JOB parameter to "systemctl cancel" is optional

As per:

https://social.treehouse.systems/@grawity/110376583742207755

12 months agobusctl: set a description for the bus connection 27573/head
Lennart Poettering [Fri, 5 May 2023 19:33:56 +0000 (21:33 +0200)] 
busctl: set a description for the bus connection

Unlike most other bus connections in our codebase this one is created
manually and every setting set invididually. It hence does not have a
description by default (as all automatic connections have). Set one
explicitly.

12 months agopid1: debug log client comm/description strings if available for incoming connections
Lennart Poettering [Fri, 5 May 2023 19:45:54 +0000 (21:45 +0200)] 
pid1: debug log client comm/description strings if available for incoming connections

Very useful for debugging, to see which clients actually connect.

12 months agotest: add testcase for the new sockaddr metainfo logic
Lennart Poettering [Fri, 5 May 2023 19:47:02 +0000 (21:47 +0200)] 
test: add testcase for the new sockaddr metainfo logic

12 months agosd-bus: use the new information in the client's sockaddr in the creds structure
Lennart Poettering [Fri, 5 May 2023 19:43:57 +0000 (21:43 +0200)] 
sd-bus: use the new information in the client's sockaddr in the creds structure

Now that clients might convey comm/description strings via the sockaddr,
let's actually use them on the other side, read the data via
getpeername() parse it, and include it in the "owner" creds (which is
how we call the peer's creds).

12 months agobase-filesystem: mention why we don't carry an entry for /tmp/ for now 27658/head
Lennart Poettering [Tue, 16 May 2023 09:44:27 +0000 (11:44 +0200)] 
base-filesystem: mention why we don't carry an entry for /tmp/ for now

12 months agobase-filesystem: also set up /run/ mount point if missing
Lennart Poettering [Mon, 15 May 2023 19:20:36 +0000 (21:20 +0200)] 
base-filesystem: also set up /run/ mount point if missing

We don't support images without, hence create this one too, like we
create all other relevant mount points we definitely require for
booting.

12 months agosd-bus: bind outgoing AF_UNIX sockets to abstract addresses conveying client comm...
Lennart Poettering [Fri, 5 May 2023 19:35:19 +0000 (21:35 +0200)] 
sd-bus: bind outgoing AF_UNIX sockets to abstract addresses conveying client comm + bus description string

Let's pass some additional meta information along bus connections
without actually altering the communication protocol.

Pass the client comm and client description string of the bus via
including it in the abstract namespace client socket address we connect
to. This is purely informational (and entirely user controlled), but has
the benefit that servers can make use of the information if they want,
but really don't have to. It works entirely transparently.

This takes inspiration from how we convey similar information via
credential socket connections.

12 months agotest-bus-server: minor modernizations
Lennart Poettering [Fri, 5 May 2023 19:47:43 +0000 (21:47 +0200)] 
test-bus-server: minor modernizations

12 months agotest-bus-chat: modernize a few things
Lennart Poettering [Fri, 5 May 2023 18:01:05 +0000 (20:01 +0200)] 
test-bus-chat: modernize a few things

12 months agomount-setup: minor modernization 27647/head
Lennart Poettering [Mon, 15 May 2023 09:53:07 +0000 (11:53 +0200)] 
mount-setup: minor modernization

12 months agomount-setup: minor log improvement
Lennart Poettering [Mon, 15 May 2023 09:52:47 +0000 (11:52 +0200)] 
mount-setup: minor log improvement

12 months agomount-setup: port to logging about mount attempts via mount_*follow_verbose()
Lennart Poettering [Mon, 15 May 2023 09:52:33 +0000 (11:52 +0200)] 
mount-setup: port to logging about mount attempts via mount_*follow_verbose()

12 months agodissect-image: port mount_image_privately_interactively() to use /run/systemd/mount... 27648/head
Lennart Poettering [Mon, 15 May 2023 09:49:48 +0000 (11:49 +0200)] 
dissect-image: port mount_image_privately_interactively() to use /run/systemd/mount-rootfs/ too

Let's use the same common directory as the unit logic uses.

This means we have less to clean up, and opens the door to eventually
allow unprivileged operation of the
mount_image_privately_interactively() logic.

12 months agopid1: port unit namespacing to new /run/systemd/mount-rootfs dir
Lennart Poettering [Mon, 15 May 2023 10:32:54 +0000 (12:32 +0200)] 
pid1: port unit namespacing to new /run/systemd/mount-rootfs dir

12 months agonamespace: introduce a common dir in /run/ that we can use to see new root fs up on
Lennart Poettering [Mon, 15 May 2023 09:35:15 +0000 (11:35 +0200)] 
namespace: introduce a common dir in /run/ that we can use to see new root fs up on

This creates a new dir /run/systemd/mount-rootfs/ early in PID 1 that
thus always exists. It's supposed to be used by any code that creates
its own mount namespace and then sets up a new root dir to switch into.
So far in many cases we used a temporary dir (which needed explicit
clean-up) or a purpose-specific fixed dir.

Let's create a common dir instead, that always exists (as it is created
in PID 1 early on, always).

Besides making things more robust, as manual clean-up of the inode is
not necessary anymore this also opens the door for unprivileged programs
to use the same dir, since it now always exists.

Set the access mode to 555 (instead of the otherwise previously used
0755, 0700 or similar), so that unprivileged programs can access it, but
we make clear it's not supposed to be written directly to, by anyone,
not even root.

12 months agomount-util: add umount_and_free() helper
Lennart Poettering [Thu, 20 Apr 2023 16:45:09 +0000 (18:45 +0200)] 
mount-util: add umount_and_free() helper

12 months agoMerge pull request #27652 from keszybz/readme-more
Zbigniew Jędrzejewski-Szmek [Tue, 16 May 2023 06:51:19 +0000 (08:51 +0200)] 
Merge pull request #27652 from keszybz/readme-more

Add man page for libsystemd, extend readme and stability promise

12 months agodocs: list all public headers in stability promise 27652/head
Zbigniew Jędrzejewski-Szmek [Mon, 15 May 2023 20:48:50 +0000 (22:48 +0200)] 
docs: list all public headers in stability promise

We provide the same stability for all the headers that are public.

Also, mark id128 as portable to other systems. There is really nothing in the
code that would make it hard. It would probably work out-of-the-box.

12 months agoREADME: describe how our libraries are linked
Zbigniew Jędrzejewski-Szmek [Mon, 15 May 2023 20:35:10 +0000 (22:35 +0200)] 
README: describe how our libraries are linked

In https://github.com/systemd/systemd/pull/27637#issuecomment-1547517316
we discussed disclaiming warranty when distros do version mixing.
But to make this disclaimer meaningful, we need to document what options are
available.

12 months agomeson: fix description for link-udev-shared option
Yu Watanabe [Mon, 15 May 2023 23:30:44 +0000 (08:30 +0900)] 
meson: fix description for link-udev-shared option

12 months agoman: use correct name for --bank option
nikstur [Mon, 15 May 2023 21:34:27 +0000 (23:34 +0200)] 
man: use correct name for --bank option

12 months agohwdb: fix keyboard entry for IdeapadFlex5 (#27643)
saikat0511 [Mon, 15 May 2023 20:58:50 +0000 (02:28 +0530)] 
hwdb: fix keyboard entry for IdeapadFlex5 (#27643)

Fixes a bug caused by 19db450f3a243fcaf0949beebafc3025f8e3a98e (#27211).

Also this makes the model more specific.

12 months agoman: add libsystemd(3)
Zbigniew Jędrzejewski-Szmek [Mon, 15 May 2023 13:17:13 +0000 (15:17 +0200)] 
man: add libsystemd(3)

Before libsystemd-daemon, libsystemd-journal, libsystemd-id128, etc., were
merged into libsystemd, it was enough to have individual man pages for them.
But they have been delivered as one thing for many years, so it's better to
have a landing page for libsystemd. It mostly directs to individual pages
anyway.

12 months agomeson: add sd_pid_notify_barrier link
Zbigniew Jędrzejewski-Szmek [Mon, 15 May 2023 20:37:20 +0000 (22:37 +0200)] 
meson: add sd_pid_notify_barrier link

Fixup for 0de343187127f6a5a93602608812e60fc4092c9a.

12 months agowatchdog: always disarm watchdog properly before closing it
Lennart Poettering [Sat, 13 May 2023 14:44:50 +0000 (07:44 -0700)] 
watchdog: always disarm watchdog properly before closing it

If we change the watchdog device we should disarm the old one first.

Similar, if we open the watchdog, but then fail setting it up, disarm it
before closing it again.

12 months agoRevert "units: Add missing dependencies on initrd-switch-root.target"
Daan De Meyer [Mon, 15 May 2023 11:52:41 +0000 (13:52 +0200)] 
Revert "units: Add missing dependencies on initrd-switch-root.target"

This reverts commit f0ad3e6b9652fe785245934ff8604cc897d3b8f4.

12 months agomkosi: Always pull in network-online.target
Daan De Meyer [Mon, 15 May 2023 12:09:08 +0000 (14:09 +0200)] 
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.

12 months agomkosi: Drop squashfs dropin
Daan De Meyer [Mon, 15 May 2023 12:08:22 +0000 (14:08 +0200)] 
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.

12 months agoportable, meson: allow statically linked build
Robert Scheck [Sun, 14 May 2023 01:17:47 +0000 (03:17 +0200)] 
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.

12 months agomkosi: Install tmux in the final image
Daan De Meyer [Mon, 15 May 2023 09:54:14 +0000 (11:54 +0200)] 
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.

12 months agoMerge pull request #27644 from mrc0mmand/fuzz-nspawn
Luca Boccassi [Mon, 15 May 2023 10:45:15 +0000 (11:45 +0100)] 
Merge pull request #27644 from mrc0mmand/fuzz-nspawn

test: update nspawn's basic config file used for fuzzing

12 months agotest: make $BUILD_DIR writable when rootfs is mounted read-only 27644/head
Frantisek Sumsal [Mon, 15 May 2023 08:15:24 +0000 (10:15 +0200)] 
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.

12 months agotest: pass $BUILD_DIR as $COVERAGE_BUILD_DIR to the system manager
Frantisek Sumsal [Mon, 15 May 2023 08:06:18 +0000 (10:06 +0200)] 
test: pass $BUILD_DIR as $COVERAGE_BUILD_DIR to the system manager

To make additional coverage-related tweaks slightly easier.

12 months agotest: add tests for UpheldBy= in [Install] section 27638/head
Mike Yuan [Mon, 15 May 2023 06:41:29 +0000 (14:41 +0800)] 
test: add tests for UpheldBy= in [Install] section

12 months agounit-file: support UpheldBy= in [Install] settings (adding Upholds= deps
Mike Yuan [Sun, 14 May 2023 09:48:25 +0000 (17:48 +0800)] 
unit-file: support UpheldBy= in [Install] settings (adding Upholds= deps
from .upholds/)

Closes #26896

12 months agotest: update nspawn's basic config file used for fuzzing
Frantisek Sumsal [Mon, 15 May 2023 07:00:17 +0000 (09:00 +0200)] 
test: update nspawn's basic config file used for fuzzing

12 months agomachine-id-setup: Do not overwrite if /etc/machine-id contains uninitialized
Daan De Meyer [Wed, 10 May 2023 13:16:09 +0000 (15:16 +0200)] 
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.

12 months agoMerge pull request #27640 from mrc0mmand/more-tests
Luca Boccassi [Sun, 14 May 2023 22:35:05 +0000 (23:35 +0100)] 
Merge pull request #27640 from mrc0mmand/more-tests

test: more TEST-13-NSPAWN-SMOKE follow-ups

12 months agotest: rename TEST-13-NSPAWN-SMOKE to TEST-13-NSPAWN 27640/head
Frantisek Sumsal [Sun, 14 May 2023 16:42:11 +0000 (18:42 +0200)] 
test: rename TEST-13-NSPAWN-SMOKE to TEST-13-NSPAWN

To make it consistent with the rest of the tests.

12 months agotest: slightly extend the systemd-nspawn tests
Frantisek Sumsal [Sun, 14 May 2023 16:24:33 +0000 (18:24 +0200)] 
test: slightly extend the systemd-nspawn tests

12 months agotest: wait after sending a signal if necessary
Frantisek Sumsal [Sun, 14 May 2023 12:20:51 +0000 (14:20 +0200)] 
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.

12 months agonspawn: simplify error handling
Frantisek Sumsal [Sun, 14 May 2023 12:16:44 +0000 (14:16 +0200)] 
nspawn: simplify error handling

12 months agotest: install the overlayfs/loop modules unconditionally
Frantisek Sumsal [Sun, 14 May 2023 11:13:24 +0000 (13:13 +0200)] 
test: install the overlayfs/loop modules unconditionally

12 months agotest: create merged-usr containers
Frantisek Sumsal [Sun, 14 May 2023 10:39:08 +0000 (12:39 +0200)] 
test: create merged-usr containers

12 months agotest: bind mount the $BUILD_DIR into nspawn containers
Frantisek Sumsal [Sun, 14 May 2023 09:28:30 +0000 (11:28 +0200)] 
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).

12 months agotest: use dropins to override system configuration
Frantisek Sumsal [Sun, 14 May 2023 06:15:33 +0000 (08:15 +0200)] 
test: use dropins to override system configuration

Instead of touching the configuration files directly.

12 months agovimrc: use 109ch text width for shell scripts as well
Frantisek Sumsal [Sat, 13 May 2023 19:59:34 +0000 (21:59 +0200)] 
vimrc: use 109ch text width for shell scripts as well

12 months agopo: Translated using Weblate (Belarusian)
Maksim Kliazovich [Sat, 13 May 2023 19:20:55 +0000 (21:20 +0200)] 
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

12 months agosd-dhcp-server: also send DNS servers or friends on DHCPOFFER
Yu Watanabe [Thu, 11 May 2023 07:42:27 +0000 (16:42 +0900)] 
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.

12 months agoMerge pull request #27605 from YHNdnzj/dbus-activation-followup
Luca Boccassi [Sat, 13 May 2023 10:49:21 +0000 (11:49 +0100)] 
Merge pull request #27605 from YHNdnzj/dbus-activation-followup

core: only refuse Type=dbus service enqueue if dbus has pending stop job

12 months agoMerge pull request #27571 from DaanDeMeyer/mkosi
Luca Boccassi [Sat, 13 May 2023 10:09:00 +0000 (11:09 +0100)] 
Merge pull request #27571 from DaanDeMeyer/mkosi

mkosi: Package a erofs usr partition with signed verity

12 months agoMerge pull request #27634 from mrc0mmand/TEST-13-shenanigans
Luca Boccassi [Sat, 13 May 2023 09:23:14 +0000 (10:23 +0100)] 
Merge pull request #27634 from mrc0mmand/TEST-13-shenanigans

test: clean up & extend the nspawn/machinectl test suite

12 months agomkosi: Package a erofs usr partition with signed verity 27571/head
Daan De Meyer [Mon, 8 May 2023 14:06:41 +0000 (16:06 +0200)] 
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.

12 months agomkosi: Store /etc under /usr/share/factory/mkosi
Daan De Meyer [Tue, 9 May 2023 11:47:43 +0000 (13:47 +0200)] 
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.

12 months agomkosi: Do not enable ACL usage by default
Daan De Meyer [Fri, 12 May 2023 15:24:39 +0000 (17:24 +0200)] 
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.

12 months agosulogin: Read SYSTEMD_SULOGIN_FORCE from kernel cmdline
Daan De Meyer [Mon, 8 May 2023 09:03:32 +0000 (11:03 +0200)] 
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.

12 months agomachine,portable: fix a typo in an info message 27634/head
Frantisek Sumsal [Fri, 12 May 2023 19:36:50 +0000 (21:36 +0200)] 
machine,portable: fix a typo in an info message

12 months agotest: merge machinectl edit/cat tests into TEST-13
Frantisek Sumsal [Fri, 12 May 2023 15:59:54 +0000 (17:59 +0200)] 
test: merge machinectl edit/cat tests into TEST-13

12 months agotest: always install the script utility
Frantisek Sumsal [Fri, 12 May 2023 15:56:22 +0000 (17:56 +0200)] 
test: always install the script utility

12 months agotest: add a couple of tests for machinectl
Frantisek Sumsal [Fri, 12 May 2023 15:39:41 +0000 (17:39 +0200)] 
test: add a couple of tests for machinectl

12 months agoMerge pull request #27633 from DaanDeMeyer/repart-dropin
Luca Boccassi [Fri, 12 May 2023 20:29:38 +0000 (21:29 +0100)] 
Merge pull request #27633 from DaanDeMeyer/repart-dropin

repart: Make sure we look up dropin files in the root directory

12 months agounits: Add missing dependencies on initrd-switch-root.target
Daan De Meyer [Sun, 7 May 2023 09:15:27 +0000 (11:15 +0200)] 
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.

12 months agoFix Positivo CF40CM-V2 key toggle touchpad
drosdeck [Fri, 12 May 2023 14:33:54 +0000 (10:33 -0400)] 
Fix Positivo CF40CM-V2 key toggle touchpad

12 months agomachine: fix a memory leak when showing multiple machines
Frantisek Sumsal [Fri, 12 May 2023 12:50:52 +0000 (14:50 +0200)] 
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).

12 months agomachine: fix a memory leak when showing multiple images
Frantisek Sumsal [Fri, 12 May 2023 12:43:23 +0000 (14:43 +0200)] 
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).

12 months agotest: clean up the nspawn tests a bit
Frantisek Sumsal [Fri, 12 May 2023 08:14:06 +0000 (10:14 +0200)] 
test: clean up the nspawn tests a bit

12 months agorepart: Make sure we look up dropin files in the root directory 27633/head
Daan De Meyer [Fri, 12 May 2023 15:16:21 +0000 (17:16 +0200)] 
repart: Make sure we look up dropin files in the root directory

12 months agoconf-parser: Add root argument to config_parse_many()
Daan De Meyer [Fri, 12 May 2023 15:14:46 +0000 (17:14 +0200)] 
conf-parser: Add root argument to config_parse_many()

12 months agocore: fix memory leak during deserialization
Frantisek Sumsal [Fri, 12 May 2023 08:23:56 +0000 (10:23 +0200)] 
core: fix memory leak during deserialization

when activation-details-unit-name is encountered multiple times.

Resolves: #27623

12 months agorepart: Make sure r is declared last
Daan De Meyer [Fri, 12 May 2023 15:16:45 +0000 (17:16 +0200)] 
repart: Make sure r is declared last

12 months agorepart: Read arguments directly instead of passing them in
Daan De Meyer [Fri, 12 May 2023 15:08:28 +0000 (17:08 +0200)] 
repart: Read arguments directly instead of passing them in

12 months agomkosi: Use zstd compression on non-centos distros
Daan De Meyer [Tue, 9 May 2023 13:04:56 +0000 (15:04 +0200)] 
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.

12 months agomkosi: Update .gitignore to account for changed output locations
Daan De Meyer [Mon, 8 May 2023 14:04:43 +0000 (16:04 +0200)] 
mkosi: Update .gitignore to account for changed output locations

12 months agomkosi: Only build initrd if Bootable= is enabled or set to "auto"
Daan De Meyer [Sat, 6 May 2023 09:36:58 +0000 (11:36 +0200)] 
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.

12 months agomkosi: Use initrd symlink without format/compression
Daan De Meyer [Sat, 6 May 2023 09:50:22 +0000 (11:50 +0200)] 
mkosi: Use initrd symlink without format/compression

This way, we can change the compression (and even the output format)
in the future without having to modify the final preset.

12 months agomkosi: Update to latest
Daan De Meyer [Mon, 8 May 2023 14:13:37 +0000 (16:13 +0200)] 
mkosi: Update to latest

12 months agoRevert "core/manager: export manager_dbus_is_running" and partially "core: refuse... 27605/head
Mike Yuan [Thu, 11 May 2023 10:55:43 +0000 (18:55 +0800)] 
Revert "core/manager: export manager_dbus_is_running" and partially "core: refuse dbus activation if dbus is not running"

This reverts commit e8863150653931ae2ffc91757623f179ce763628
and partially 53964fd26b4a01191609ffc064aa8ccccd28e377.

Specifically, changes to signal_activation_request()
is not desired.

12 months agocore: only refuse Type=dbus service enqueuing if dbus has stop job
Mike Yuan [Wed, 10 May 2023 05:54:15 +0000 (13:54 +0800)] 
core: only refuse Type=dbus service enqueuing if dbus has stop job

Follow-up for #27579

In #27579 we refused all StartUnit requests for Type=dbus units
if dbus is not running, which means if dbus is manually stopped,
user can't use systemctl to start Type=dbus units again, which
is incorrect.

The only culprit that leads to the cancellation of the whole
transaction mentioned in #26799 is job type conflict on dbus.
So let's relax the restriction and only refuse job enqueuing
if dbus has a stop job.

To summarize, the case we want to avoid is:

1. dbus has a stop job installed
2. StartUnit/ActivationRequest is received
3. Type=dbus service gets started, which has Requires=dbus.socket
4. dbus is pulled in again, resulting in job type conflict

What we can support is:

1. dbus is already stopped
2. StartUnit is received (possibly through systemctl, i.e. on private bus)
3. Type=dbus service gets started, which will wait for dbus to start
4. dbus is started again, thus the job for Type=dbus service

Replaces #27590
Fixes #27588

12 months agocore: Try to initialize TERM from systemd.tty.term.console as well
Daan De Meyer [Mon, 8 May 2023 09:27:31 +0000 (11:27 +0200)] 
core: Try to initialize TERM from systemd.tty.term.console as well

We already have the systemd.tty.xxx kernel cmdline arguments for
configuring tty's for services, let's make sure the term cmdline
argument applies to pid1 as well.

12 months agoMerge pull request #27565 from yuwata/static-destruct
Daan De Meyer [Fri, 12 May 2023 06:36:43 +0000 (08:36 +0200)] 
Merge pull request #27565 from yuwata/static-destruct

static-destruct: support clearing array on exit

12 months agomkfs-util: Add quiet argument to make_filesystem()
Daan De Meyer [Sun, 7 May 2023 19:39:10 +0000 (21:39 +0200)] 
mkfs-util: Add quiet argument to make_filesystem()

We default to quiet operation everywhere except for repart, where
we disable quiet and have the mkfs tools write to stdout.

We also make sure --quiet or equivalent is implemented for all mkfs
tools.

12 months agocore: Check if any init exists before switching root
Daan De Meyer [Mon, 8 May 2023 11:48:25 +0000 (13:48 +0200)] 
core: Check if any init exists before switching root

If we switch root and can't execute an init program afterwards, we're
completely stuck as we can't go back to the initramfs to start
emergency.service as it will have been completely removed by the switch
root operation.

To prevent leaving users with a completely undebuggable system, let's
at least check before we switch root whether at least one of the init
programs we might want to execute actually exist, and fail early if
none of them exists.

12 months agocore: Make sure systemctl exit <X> works outside of a container
Daan De Meyer [Thu, 11 May 2023 06:47:38 +0000 (08:47 +0200)] 
core: Make sure systemctl exit <X> works outside of a container

When running in a VM, we now support propagating the exit status
via a vsock notify socket, so drop the restrictions on propagating
an exit status when not in a container to make sure this works
properly.

12 months agoMerge pull request #27618 from DaanDeMeyer/fstab-generator
Yu Watanabe [Thu, 11 May 2023 19:23:54 +0000 (04:23 +0900)] 
Merge pull request #27618 from DaanDeMeyer/fstab-generator

Fstab generator fixes

12 months agotest-network: add tests for static lease matching with chaddr
Yu Watanabe [Thu, 11 May 2023 08:08:27 +0000 (17:08 +0900)] 
test-network: add tests for static lease matching with chaddr

Follow-up for 4646cdaa378fa2aab7334a80228d8a94b316763b (#27313).

12 months agoMerge pull request #27611 from yuwata/core-mount-escape-utf8
Yu Watanabe [Thu, 11 May 2023 16:40:32 +0000 (01:40 +0900)] 
Merge pull request #27611 from yuwata/core-mount-escape-utf8

core/mount: escape invalid utf8 chars

12 months agofstab-generator: Fix log message 27618/head
Daan De Meyer [Wed, 10 May 2023 13:25:34 +0000 (15:25 +0200)] 
fstab-generator: Fix log message

12 months agofstab-generator: Unset kernel cmdline options if empty value is given
Daan De Meyer [Wed, 10 May 2023 08:35:16 +0000 (10:35 +0200)] 
fstab-generator: Unset kernel cmdline options if empty value is given

12 months agofstab-generator: Take systemd.verity= into account
Daan De Meyer [Wed, 10 May 2023 08:34:43 +0000 (10:34 +0200)] 
fstab-generator: Take systemd.verity= into account

Disable verity logic if systemd.verity= switch is disabled.

12 months agocryptenroll: actually allow using multiple "special" strings when wiping
Frantisek Sumsal [Wed, 10 May 2023 09:47:57 +0000 (11:47 +0200)] 
cryptenroll: actually allow using multiple "special" strings when wiping

The systemd-cryptenroll man page states:

    Takes a comma separated list of numeric slot indexes, or the special
    strings ..., or any combination of these strings or numeric
    indexes, in which case all slots matching either are wiped.

but we'd allow only one special string at any given time as the value
was not ORed when assigning. So, for example, --wipe=recovery,password
would actually become --wipe=password, etc.

12 months agoMerge pull request #27610 from DaanDeMeyer/mkosi-trivial
Daan De Meyer [Thu, 11 May 2023 12:04:34 +0000 (14:04 +0200)] 
Merge pull request #27610 from DaanDeMeyer/mkosi-trivial

mkosi: Trivial fixes

12 months agocore/mount: escape invalid UTF8 char in dbus reply 27611/head
Yu Watanabe [Thu, 11 May 2023 10:21:57 +0000 (19:21 +0900)] 
core/mount: escape invalid UTF8 char in dbus reply

When What= or Options= may contain invalid UTF8 chars.

Replaces aaf7b0e41105d7b7cf30912cdac32820f011a219 (#27541).

12 months agoRevert "core/mount: replace invalid UTF-8 code points in "what" and "options""
Yu Watanabe [Thu, 11 May 2023 10:13:51 +0000 (19:13 +0900)] 
Revert "core/mount: replace invalid UTF-8 code points in "what" and "options""

This reverts commit aaf7b0e41105d7b7cf30912cdac32820f011a219.

Not only /proc/mountinfo, .mount units not started yet may contain
invalid UTF-8 chars.

12 months agomkosi: Install apt in Debian/Ubuntu images 27610/head
Daan De Meyer [Wed, 10 May 2023 16:55:24 +0000 (18:55 +0200)] 
mkosi: Install apt in Debian/Ubuntu images