Commit Graph
72290 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek a1887f8b48 man: regenerate rules
Fixup for dfad86b838.
2024-04-04 12:18:30 +02:00
Zbigniew Jędrzejewski-Szmek 19e980eb92 man: update fedora example to F40
F40 will be out soon, so we can update the man page already. The example should
already work.

The cloud link was dropped in fd571c9df0, so
drop the unused variable too.
2024-04-04 09:19:24 +01:00
Julius Alexandre f8bfea5433 core/exec-invoke: replace basename() with path_extract_filename() (#32076) 2024-04-04 06:44:51 +09:00
Yu Watanabe 8c27f1ba4a vmspawn: fix error code 2024-04-04 04:42:55 +09:00
Daan De Meyer 50ad7cf934 mkosi: More package updates
- Install individual asan libraries instead of gcc
- Drop duplicate qrencode package from arch config
- Install dbus-user-session which provides default-dbus-session-bus
- Explicitly install dbus-broker on Arch Linux
2024-04-03 21:05:03 +02:00
Lennart Poettering dca15bd905 sysupdate: use log_syntax() when logging about a configuration file
All code around this does this too, hence do it here as well.

Also fix plural verb form.

Follow-up for: #32018
2024-04-04 04:04:14 +09:00
Yu Watanabe 94ad70989f man/example: also build example code with C90
Unfortunately, sd-bus-vtable.h, sd-journal.h, and sd-id128.h
have variadic macro and inline initialization of sub-object, these are
not supported in C90. So, we need to silence some errors.
2024-04-04 03:23:20 +09:00
Daan De Meyer 56e6bf9e04 mkosi: Install selinux tools in main image instead of initramfs
Also install setools-console and policycoreutils instead of setools
which pulls in the kitchen sink. Also install selinux-policy-targeted
to make sure the right policy is installed.
2024-04-03 20:09:04 +02:00
Daan De Meyer 5ed030a7ac mkosi: Install git-core where possible
This avoids pulling in the perl kitchen sink.
2024-04-03 20:09:04 +02:00
Lennart Poettering 4d619806d1 Revert "kernel-install: Add kernel version to title (#31581)"
This reverts commit 85b774de49.
2024-04-04 02:45:39 +09:00
Yu Watanabe 2893a1089e Merge pull request #32072 from YHNdnzj/no-ellipsize
core/manager: use cellescape and don't be too aggressive
2024-04-04 02:44:59 +09:00
Lennart Poettering 56efc39fbc resolved: return ExpectedMore error if we require "more" varlink flag on method call
Fixes: #32066
2024-04-04 02:43:20 +09:00
Yu Watanabe 3a6bee0510 Merge pull request #32043 from YHNdnzj/resume-clear-efi
units: introduce systemd-hibernate-clear.service that clears stale HibernateLocation EFI variable
2024-04-04 02:43:00 +09:00
Evgeny Vereshchagin a33a636b48 fuzz: check that ND options are parsed sucessfully
At that point the options have been parsed, sent and received again so
`ndisc_parse_options` should never fail there (unless ndisc_send corrupts
them somehow).

It's a follow-up to https://github.com/systemd/systemd/pull/31807
2024-04-04 02:42:21 +09:00
Yu Watanabe 040cb66458 man/examples: set _GNU_SOURCE in source, rather than by compile option
Addresses https://github.com/systemd/systemd/pull/32057#issuecomment-2034408569.
2024-04-04 02:30:29 +09:00
Lennart Poettering 5360b10f29 ssh-generator: create privsep dir via tmpfiles.d/ if we are told to
To make it easy to have a workable ssh-generator on various distros,
let's optionally generate the ssh privsep dir via tmpfiles.d/ drop-in.

This enables the concept with a path of /run/sshd/ as default. This is
the path Debian/Ubuntu uses, and means that we just work on those
distros. Debian/Ubuntu is the only distro (apparently?) that puts the
privsep dir under /run/, hence always needs the dir to be created
manually. Other distros don't need it that much, because they place the
dir in /usr/ (fedora, best choice!) or /var/ (others, not ideal, because
still mutable).

Also adds a longer explanation about this in NEWS, in the hope that
distro maintaines read that and maybe start cleaning this up.

Alternative to: #31543
2024-04-04 01:01:10 +09:00
Mike Yuan a2098d8bf7 core/manager: use cellescape and don't be too aggressive
Addresses https://github.com/systemd/systemd/pull/32068#issuecomment-2034799862
2024-04-03 23:51:11 +08:00
Mike Yuan 596c9e671a string-util: add missing assertion in cellescape 2024-04-03 23:51:11 +08:00
Luca Boccassi 1c6ca6d924 Merge pull request #32065 from bluca/dlopen_debug
dlopen: fix bpf symbol loading check and log at debug level when loading a library
2024-04-03 16:36:35 +01:00
Luca Boccassi 26cbb21449 Merge pull request #32019 from bluca/gcrypt_dlopen
gcrypt: dlopenify for libsystemd
2024-04-03 16:10:00 +01:00
Lennart Poettering 47fba8f925 notify-example: also send STOPPING=1 at exit
I think the example should reflect the full set of lifecycle messages,
including STOPPING=1, which tells the service manager that the service
is already terminating. This is useful for reporting this information
back to the user and to suppress repeated shutdown requests.

It's not as important as the READY=1 and RELOADING=1 messages, since we
actively wait for those from the service message if the right Type= is
set. But it's still very valuable information, easy to do, and completes
the state engine.
2024-04-03 15:52:07 +01:00
Mike Yuan 5f0cd5717f man/kernel-command-line: be clear that resumeflags= is about timeout opts only 2024-04-03 22:08:11 +08:00
Mike Yuan dfad86b838 units: introduce systemd-hibernate-clear.service that clears
stale HibernateLocation EFI variable

Currently, if the HibernateLocation EFI variable exists,
but we failed to resume from it, the boot carries on
without clearing the stale variable. Therefore, the subsequent
boots would still be waiting for the device timeout,
unless the variable is purged manually.

There's no point to keep trying to resume after a successful
switch-root, because the hibernation image state
would have been invalidated by then. OTOH, we don't
want to clear the variable prematurely either,
i.e. in initrd, since if the resume device is the same
as root one, the boot won't succeed and the user might
be able to try resuming again. So, let's introduce a
unit that only runs after switch-root and clears the var.

Fixes #32021
2024-04-03 22:07:43 +08:00
Mike Yuan 8f8e481f03 hibernate-resume: introduce --clear for clearing hibernate storage var 2024-04-03 22:07:17 +08:00
Mike Yuan 89c727e0f4 hibernate-resume: add options handling 2024-04-03 21:59:59 +08:00
Mike Yuan 9fa0f584ec hibernate-resume-config: expose get_efi_hibernate_location 2024-04-03 21:59:59 +08:00
Mike Yuan 667b0c48f2 hibernate-resume: EINVAL -> ENOTBLK where appropriate 2024-04-03 21:59:59 +08:00
Mike Yuan fbc88824b6 hibernate-util: make clear_efi_hibernate_location_and_warn return 1 if
actually cleared the variable
2024-04-03 21:59:59 +08:00
Luca Boccassi dd6c0df65c dlopen: log debug message when a library is dlopened
Useful to track what is being used and when
2024-04-03 14:23:04 +01:00
Luca Boccassi e5d4adb173 bpf: actually check for errors when loading symbols
Also restructure ifdef to avoid confusing vscode

Follow-up for 87e462f713
2024-04-03 14:22:07 +01:00
Luca Boccassi 2dcc499bb8 Merge pull request #32057 from yuwata/man-example
man: add simple build test for example code
2024-04-03 13:30:43 +01:00
Martin Wilck c072860593 99-systemd.rules: rework SYSTEMD_READY logic for device mapper
Device mapper devices are set up in multiple steps. The first step, which
generates the initial "add" event, only creates an empty container, which is
useless for higher layers. SYSTEMD_READY should be set to 0 on this event to
avoid premature device activation.

The event that matters is the "activation" event: the first "change" event on
which DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 is not set. When this event arrives,
the device is ready for being scanned by blkid and similar tools, and for being
activated by systemd.

Intermittent events with DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 should be ignored
as far as systemd or higher-level block layers are concerned. Previous device
properties and symlinks should be preserved: the device shouldn't be scanned or
activated, but shouldn't be deactivated, either.  In particular, SYSTEM_READY
shouldn't be set to 0 if it wasn't set before, because that might cause mounted
file systems to be unmounted. Such intermittent events may occur any time,
before or after the "activation" event.

DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 can have multiple reasons. One possible reason
is that the device is suspended. There are other reasons that depend on the
device-mapper subsystem (LVM, multipath, dm-crypt, etc.).

The current systemd rule set

1) sets SYSTEMD_READY=0 if DM_UDEV_DISABLE_OTHER_RULES_FLAG is set in "add"
events;
2) imports SYSTEMD_READY from the udev db if DM_SUSPENDED is set, and jumps to systemd_end;
3) sets SYSTEMD_READY=1, otherwise.

This logic has several flaws:

* 1) can cause file systems to be unmounted if an coldplug event arrives while
a file system is suspended. This rule shouldn't be applied for coldplug events
or in general, "synthetic" add events;
* 2) evaluates DM_SUSPENDED=1, which is a device-mapper internal property.
It's wrong to infer that a device is accessible if DM_SUSPENDED=0.
The jump to systemd_end may cause properties and/or symlinks to be lost;
* 3) is superfluous, because SYSTEMD_READY=1 is equivalent with SYSTEMD_READY
being unset, and can create the wrong impression that the device was explicitly
activated.

This patch fixes the logic as follows:

- apply 1) only if DM_NAME is empty, which is only the case for the first
"genuine add" event;
- change 2) to use DM_UDEV_DISABLE_OTHER_RULES_FLAG instead of DM_SUSPENDED,
and remove the GOTO directive;
- remove 3).

Fixes: b7cf1b6 ("udev: use SYSTEMD_READY to mask uninitialized DM devices")
Fixes: 35a6750 ("rules: set SYSTEMD_READY=0 on DM_UDEV_DISABLE_OTHER_RULES_FLAG=1 only with ADD event (#2747)")

Signed-off-by: Martin Wilck <mwilck@suse.com>
2024-04-03 12:48:14 +01:00
Luca Boccassi 8707c9b244 gcrypt: dlopenify for libsystemd
gcrypt is used only for journal sealing operations in libsystemd, so it
can be made into a dlopen dependency that is used only on demand. This
allows to reduce the footprint of libsystemd in the most common cases.

Keep systemd-pull and systemd-resolved with normal linking, as they are
executables, and usually built with OpenSSL support anyway.
2024-04-03 11:50:25 +01:00
Yu Watanabe e98d4c3599 man/meson: add simple build test for example code 2024-04-03 17:58:39 +09:00
Yu Watanabe e10409ad55 sd-bus-vtable: add dummy macro to support compile without GNU extension
If SD_BUS_METHOD_WITH_ARGS() is set with SD_BUS_NO_ARGS and/or SD_BUS_NO_RESULT,
then it introduces
_SD_VARARGS_FOREACH_EVEN(_SD_ECHO, NULL)
    -> _SD_VARARGS_FOREACH_SEQ(_01, …, _50, NULL)
Hence, the variadic argument `...` in _SD_VARARGS_FOREACH_SEQ() has no
argument, but it is not allowed if built without GNU extension, e.g. -std=c11.

Let's introduce one more unused dummy argument to support such situation.
2024-04-03 17:58:39 +09:00
Yu Watanabe 2548ce6a30 man/examples: fix sd- header path 2024-04-03 17:58:39 +09:00
Yu Watanabe e84f70e16d man/examples: use strerror() instead of %m 2024-04-03 17:58:35 +09:00
Yu Watanabe 06d0dcc009 man/example: fix build failure of hwdb-usb-device.c
STRLEN() and xsprintf() is our internal macros.
2024-04-03 17:44:41 +09:00
Yu Watanabe c099e8f21f Merge pull request #32060 from YHNdnzj/timespec-minor-cleanup
Minor cleanup for timespec/efivars
2024-04-03 13:48:56 +09:00
Mike Yuan 80d1d9f5db efivars: minor modernization for efi_set_variable 2024-04-03 10:03:53 +08:00
Mike Yuan 1ca89d32ae signal-util: make struct timespec const 2024-04-03 10:03:53 +08:00
Mike Yuan 65b584334d time-util: drop unneeded 'struct' 2024-04-03 10:03:53 +08:00
Yu Watanabe dcc6256593 git-contrib: use 'git shortlog' command
Also, this drops Weblate (again) and dependabot from the contributers list.

Moreover, this makes the contributers sorted by git command, rather
than sort command. Then, the authors are sorted by their first name, e.g.
- before
Xiaotian Wu, Yuri Chornoivan, Yu Watanabe, Zbigniew Jędrzejewski-Szmek,
- after
Xiaotian Wu, Yu Watanabe, Yuri Chornoivan, Zbigniew Jędrzejewski-Szmek,

Suggested-by: Matteo Croce <teknoraver@meta.com>
2024-04-03 10:07:54 +09:00
Yu Watanabe ffeb6a2e3b Merge pull request #32059 from bluca/doc
Docs and TODO fixes
2024-04-03 09:15:15 +09:00
Daan De Meyer c89b3e1dfd test: Always exit with 77 if we skip a test
Prep work for running the integration tests with meson, which requires
tests to exit with 77 to indicate they are skipped.

Note this only deals with the easy cases where there's only tests. The
hard ones where there's subtests of which only some are skipped are left
for another PR.
2024-04-03 09:14:15 +09:00
Luca Boccassi 485bb19d55 docs: notify example was moved to sd_notify manpage
Reference in the portability doc was forgot

Follow-up for 383917ac67
2024-04-02 22:24:38 +01:00
Luca Boccassi edc2c26d54 TODO: drop line about bzip2/gzip
These are only used in the importd binary, which is a leaf optional
binary that also depends on libcurl, so it's not worth the
additional complications
2024-04-02 22:22:29 +01:00
Luca Boccassi 52c15e9c9b Merge pull request #32055 from mrc0mmand/pre-rc-coccinelle
Coccinelle-suggested tweaks, pre-rc edition
2024-04-02 21:58:39 +01:00
Luca Boccassi 792b942405 Merge pull request #32052 from mrc0mmand/even-more-test-tweaks
A couple of assorted tweaks
2024-04-02 21:49:05 +01:00
Luca Boccassi 72270f29e4 resolve: avoid reusing 'r' for encoded packet size
This is a footgun, as using r between the encoded length being
taken and it being used risks it being overwritten accidentally
2024-04-02 20:28:11 +01:00