]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agoMerge pull request #29629 from bluca/mount_tunnel_pidref
Luca Boccassi [Thu, 19 Oct 2023 17:59:22 +0000 (18:59 +0100)] 
Merge pull request #29629 from bluca/mount_tunnel_pidref

mount tunnel: use PidRef

7 months agoMerge pull request #29623 from YHNdnzj/core-followup
Luca Boccassi [Thu, 19 Oct 2023 17:04:40 +0000 (18:04 +0100)] 
Merge pull request #29623 from YHNdnzj/core-followup

Follow-ups for recent changes to core/

7 months agotest: skip Protect{Home,System}= tests with coverage builds
Frantisek Sumsal [Thu, 19 Oct 2023 13:13:07 +0000 (15:13 +0200)] 
test: skip Protect{Home,System}= tests with coverage builds

With coverage builds we disable Protect{Home,System}= via a service.d
dropin in /etc, which has, unfortunately, higher priority than our
transient systemd-run stuff. Let's just skip the affected tests in that
case instead of making the test setup even more complicated.

7 months agopid1,vconsole-setup: lock /dev/console instead of the tty device
Zbigniew Jędrzejewski-Szmek [Tue, 17 Oct 2023 17:43:31 +0000 (19:43 +0200)] 
pid1,vconsole-setup: lock /dev/console instead of the tty device

As requested in https://github.com/systemd/systemd/pull/27867#pullrequestreview-1567161854.
/dev/console, /dev/tty0, and /dev/ttyN are "different" device nodes
that may point to a single underlying device. We want to use a single
lock so that we don't get a race if different writers are using a different
device path, so let's just always lock around /dev/console.
This effectively makes the locking less granular.

Fixup for a0043bfa51281c2374878e2a98cf2a3ee10fd92c.
Fixes https://github.com/systemd/systemd/issues/28721.
Maybe fixes https://github.com/systemd/systemd/issues/28778 and
https://github.com/systemd/systemd/issues/28634.

7 months agotest: unify checking for user xattrs support in cgroupfs
Frantisek Sumsal [Thu, 19 Oct 2023 10:28:37 +0000 (12:28 +0200)] 
test: unify checking for user xattrs support in cgroupfs

Also, run the coredump forwarding test only if user xattrs are
supported.

7 months agomeson: generate proper version tag when git fails on permission errors
Zbigniew Jędrzejewski-Szmek [Thu, 19 Oct 2023 10:55:59 +0000 (12:55 +0200)] 
meson: generate proper version tag when git fails on permission errors

When building with mkosi I would get the following:

    [1/477] Generating version.h with a custom command
    fatal: detected dubious ownership in repository at '/work/src'
    To add an exception for this directory, call:

            git config --global --add safe.directory /work/src

and then the tag would be generated as 'v254-'. This is obviously some problem
with the setup, but we should handle this gracefully. Let's fall back to 'v254'
instead.

In the case where we have a repo but no tags, use --dirty=^ too, as in the case
with tags.

I tested four cases:
- normal checkout
- checkout with .git removed
- checkout with .git chowned to root
- checkout wiht all tags removed

7 months agoUpdate TODO 29629/head
Luca Boccassi [Thu, 19 Oct 2023 15:00:21 +0000 (16:00 +0100)] 
Update TODO

7 months agomount tunnel: use PidRef
Luca Boccassi [Thu, 19 Oct 2023 15:00:00 +0000 (16:00 +0100)] 
mount tunnel: use PidRef

7 months agocore/service: check error first and log about errno 29623/head
Mike Yuan [Wed, 18 Oct 2023 15:29:00 +0000 (23:29 +0800)] 
core/service: check error first and log about errno

Follow-up for becdfcb9f1cb555c50dcfe51894cb0b155f7f01e

7 months agocgroup-util: use RET_GATHER more, return first error
Mike Yuan [Thu, 19 Oct 2023 12:23:54 +0000 (20:23 +0800)] 
cgroup-util: use RET_GATHER more, return first error

7 months agocore/exec-invoke: use correct exit status
Mike Yuan [Wed, 18 Oct 2023 13:22:19 +0000 (21:22 +0800)] 
core/exec-invoke: use correct exit status

These calls can fail not only due to OOM.

7 months agocore/namespace: merge if blocks
Mike Yuan [Wed, 18 Oct 2023 11:23:42 +0000 (19:23 +0800)] 
core/namespace: merge if blocks

7 months agoexecutor: fix double free of MountOptions
Luca Boccassi [Thu, 19 Oct 2023 11:24:19 +0000 (12:24 +0100)] 
executor: fix double free of MountOptions

This list is owned by ExecContext, which is cleaned up when sd-executor
fails, but it is also cleaned up when namespace setup exits, so we get
a double free.

Fixes https://github.com/systemd/systemd/issues/29610

Follow-up for bb5232b6a3

7 months agoMerge pull request #29617 from keszybz/efi-no-xmalloc0
Luca Boccassi [Thu, 19 Oct 2023 13:23:54 +0000 (14:23 +0100)] 
Merge pull request #29617 from keszybz/efi-no-xmalloc0

efi: drop duplicate initialization to 0

7 months agocgroup-util: drop dead code block
Yu Watanabe [Thu, 19 Oct 2023 09:40:10 +0000 (18:40 +0900)] 
cgroup-util: drop dead code block

Follow-up for 4d1b2df199227ed4b934bbcb054364e92e93a1a6.

Fixes CID#1522888.

7 months agoMerge pull request #29595 from YHNdnzj/systemctl-failed-system
Luca Boccassi [Thu, 19 Oct 2023 11:07:37 +0000 (12:07 +0100)] 
Merge pull request #29595 from YHNdnzj/systemctl-failed-system

systemctl: is-failed: check if system is degraded when no unit given

7 months agoefi: drop unused xmalloc0() 29617/head
Zbigniew Jędrzejewski-Szmek [Tue, 17 Oct 2023 08:56:45 +0000 (10:56 +0200)] 
efi: drop unused xmalloc0()

Keeping this separate to make it easy to revert if it's ever needed again.

7 months agoefi: do not memzero fields before initializing them
Zbigniew Jędrzejewski-Szmek [Tue, 17 Oct 2023 08:55:57 +0000 (10:55 +0200)] 
efi: do not memzero fields before initializing them

In all three cases we immediately overwrite the whole field anyway,
so the call to memzero is not needed.

7 months agovarlink: Add new varlink_collect method
Arthur Shau [Wed, 20 Sep 2023 01:52:39 +0000 (18:52 -0700)] 
varlink: Add new varlink_collect method

varlink_collect is meant to be used when the client is willing to wait for the reply from the varlink method, much like varlink_call.
However, unlike varlink_call, it allows the client to collect all "more" replies that may be sent by method before the "final" reply is enqueued.
It aggregates all of these replies into a json variant array that it returns to the client.

7 months agofuzz: unify logging setup
Frantisek Sumsal [Wed, 18 Oct 2023 21:11:13 +0000 (23:11 +0200)] 
fuzz: unify logging setup

Make sure we don't log anything when running in "fuzzing" mode. Also,
when at it, unify the setup logic into a helper, pretty similar to
the test_setup_logging() one.

Addresses:
  - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607
  - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663

7 months agoMerge pull request #29611 from mrc0mmand/execute-serialize-fuzz
Luca Boccassi [Wed, 18 Oct 2023 22:33:00 +0000 (23:33 +0100)] 
Merge pull request #29611 from mrc0mmand/execute-serialize-fuzz

test: add a fuzzer for exec_{serialize,deserialize}_invocation()

7 months agocore: don't assert when serializing malformed state 29611/head
Frantisek Sumsal [Wed, 18 Oct 2023 17:57:06 +0000 (19:57 +0200)] 
core: don't assert when serializing malformed state

7 months agotest: add a fuzzer for exec_{serialize,deserialize}_invocation()
Frantisek Sumsal [Fri, 28 Jul 2023 08:33:08 +0000 (10:33 +0200)] 
test: add a fuzzer for exec_{serialize,deserialize}_invocation()

7 months agosystemctl: is-failed: check if system is degraded when no unit given 29595/head
Mike Yuan [Tue, 17 Oct 2023 12:47:54 +0000 (20:47 +0800)] 
systemctl: is-failed: check if system is degraded when no unit given

Closes #3335

7 months agosystemctl: minor modernization
Mike Yuan [Tue, 17 Oct 2023 12:35:31 +0000 (20:35 +0800)] 
systemctl: minor modernization

7 months agoMerge pull request #29594 from poettering/cgroup-rename-ret-params
Lennart Poettering [Wed, 18 Oct 2023 15:25:44 +0000 (17:25 +0200)] 
Merge pull request #29594 from poettering/cgroup-rename-ret-params

more pidfdification

7 months agotest: use Type=exec for the test unit
Frantisek Sumsal [Wed, 18 Oct 2023 12:11:33 +0000 (14:11 +0200)] 
test: use Type=exec for the test unit

Make sure everything we need is set up before continuing further with
the test. This should, hopefully, help with a race where we check
a dynamic user before it's created by NFTSet= stuff.

Before:
$ journalctl -o short-monotonic --grep '(test-nft|NFT|testsuite-75)' --no-hostname
...
[ 3657.929223] testsuite-75.sh[48]: + systemd-run -u test-nft.service -p DynamicUser=yes -p 'NFTSet=cgroup:inet:sd_test:c user:inet:sd_test:u group:inet:sd_test:g' sleep 10000
...
[ 3657.977372] systemd[1]: test-nft.service: Changed dead -> running
[ 3657.977388] systemd[1]: test-nft.service: Job 376 test-nft.service/start finished, result=done
[ 3657.977407] testsuite-75.sh[853]: Running as unit: test-nft.service; invocation ID: 8776af2ec7864a60a058cb5d403d1ca6
[ 3657.982437] testsuite-75.sh[856]:                 elements = { "system.slice/test-nft.service" }
[ 3657.984570] testsuite-75.sh[48]: + grep -qF test-nft.service /tmp/tmp.uqXKfyzcpJ
[ 3657.985400] testsuite-75.sh[859]: ++ getent passwd test-nft
[ 3657.986434] systemd[1]: varlink-12: New incoming message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{"userName":"test-nft","service":"io.systemd.DynamicUser"}}
[ 3657.986503] systemd[1]: varlink-12: Sending message: {"error":"io.systemd.UserDatabase.NoRecordFound","parameters":{}}
[ 3657.986643] systemd[1]: testsuite-75.service: Child 48 belongs to testsuite-75.service.
[ 3657.986660] systemd[1]: testsuite-75.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
[ 3657.986681] systemd[1]: testsuite-75.service: Failed with result 'exit-code'.
...
[ 3657.989885] systemd[1]: test-nft.service: User lookup succeeded: uid=64568 gid=64568
[ 3657.989936] systemd[1]: Added NFT set: family inet, table sd_test, set u, ID 64568
[ 3657.989965] systemd[1]: Added NFT set: family inet, table sd_test, set g, ID 64568

After:
$ journalctl -o short-monotonic --grep '(test-nft|NFT|testsuite-75)' --no-hostname
[ 1523.874408] testsuite-75.sh[49]: + systemd-run -u test-nft.service --service-type=exec -p DynamicUser=yes -p 'NFTSet=cgroup:inet:sd_test:c user:inet:sd_test:u group:inet:sd_test:g' sleep 10000
...
[ 1523.924091] systemd[1]: Starting test-nft.service...
[ 1523.928891] systemd[1]: test-nft.service: User lookup succeeded: uid=64568 gid=64568
[ 1523.929102] systemd[1]: Added NFT set: family inet, table sd_test, set u, ID 64568
[ 1523.929220] systemd[1]: Added NFT set: family inet, table sd_test, set g, ID 64568
...
[ 1523.933263] systemd[1]: Started test-nft.service.
[ 1523.933626] testsuite-75.sh[849]: Running as unit: test-nft.service; invocation ID: d1a5c3eacbc647a7a5fcbd46c7b2f863
[ 1523.940810] testsuite-75.sh[852]:                 elements = { "system.slice/test-nft.service" }
[ 1523.942880] testsuite-75.sh[49]: + grep -qF test-nft.service /tmp/tmp.gWka2x3mQq
[ 1523.944031] testsuite-75.sh[855]: ++ getent passwd test-nft
[ 1523.945496] systemd[1]: varlink-18: New incoming message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{"userName":"test-nft","service":"io.systemd.DynamicUser"}}
[ 1523.951593] systemd[1]: varlink-18: Sending message: {"parameters":{"record":{"userName":"test-nft","uid":64568,"gid":64568,"realName":"Dynamic User",...

7 months agomanager: move idle_pipe allocation to manager.c and make it atomic
Lennart Poettering [Wed, 18 Oct 2023 11:37:45 +0000 (13:37 +0200)] 
manager: move idle_pipe allocation to manager.c and make it atomic

Let's make sure it either fails or suceeds, but never fails half-way
leaving a half-initialized array around.

7 months agoMerge pull request #29583 from poettering/deserialize-fd-many
Luca Boccassi [Wed, 18 Oct 2023 15:06:22 +0000 (16:06 +0100)] 
Merge pull request #29583 from poettering/deserialize-fd-many

add serialize_fd_many() + deserialize_fd_many() helpers

7 months agoupdate TODO 29594/head
Lennart Poettering [Tue, 17 Oct 2023 08:57:26 +0000 (10:57 +0200)] 
update TODO

7 months agotest-cgroup: make test case a bit more robust towards previous aborted runs
Lennart Poettering [Tue, 17 Oct 2023 12:31:11 +0000 (14:31 +0200)] 
test-cgroup: make test case a bit more robust towards previous aborted runs

7 months agokillall: port killing spree loop over to PidRef
Lennart Poettering [Tue, 17 Oct 2023 11:43:29 +0000 (13:43 +0200)] 
killall: port killing spree loop over to PidRef

7 months agotest: port tests over to new /proc/ enumeration API
Lennart Poettering [Tue, 17 Oct 2023 11:43:59 +0000 (13:43 +0200)] 
test: port tests over to new /proc/ enumeration API

7 months agoprocess-util: add API for enumerating processes in /proc/ and pinning them via PidRef
Lennart Poettering [Tue, 17 Oct 2023 11:41:08 +0000 (13:41 +0200)] 
process-util: add API for enumerating processes in /proc/ and pinning them via PidRef

7 months agoprocess-util: add pidref_is_unwaited() and make pid_is_unwaited() return errors
Lennart Poettering [Tue, 17 Oct 2023 10:32:00 +0000 (12:32 +0200)] 
process-util: add pidref_is_unwaited() and make pid_is_unwaited() return errors

7 months agoprocess-util: add pidref_is_my_child()
Lennart Poettering [Tue, 17 Oct 2023 10:20:16 +0000 (12:20 +0200)] 
process-util: add pidref_is_my_child()

7 months agoprocess-util: change pid_is_alive() to not eat up errors, and add pidref_is_alive()
Lennart Poettering [Tue, 17 Oct 2023 10:12:05 +0000 (12:12 +0200)] 
process-util: change pid_is_alive() to not eat up errors, and add pidref_is_alive()

Let's no eat up errors, but propagate unexpected ones.

7 months agoprocess-util: add pidref_get_uid() and rename get_process_uid() → pidref_get_uid()
Lennart Poettering [Tue, 17 Oct 2023 09:27:06 +0000 (11:27 +0200)] 
process-util: add pidref_get_uid() and rename get_process_uid() → pidref_get_uid()

7 months agocore: port unit/process kill logic to pidref
Lennart Poettering [Tue, 17 Oct 2023 08:34:00 +0000 (10:34 +0200)] 
core: port unit/process kill logic to pidref

7 months agopidref: add new pidref_is_self() helper
Lennart Poettering [Tue, 17 Oct 2023 08:17:49 +0000 (10:17 +0200)] 
pidref: add new pidref_is_self() helper

This simply checks if the specified PidRef refers to the process we are
running in.

(In case you wonder why this is not a static inline: to avoid cyclic
header inclusion problems between pidref.h + process-util.h)

7 months agoprocess-util: add pidref_get_comm() and rename get_process_comm() to pid_get_comm()
Lennart Poettering [Tue, 17 Oct 2023 08:16:31 +0000 (10:16 +0200)] 
process-util: add pidref_get_comm() and rename get_process_comm() to pid_get_comm()

7 months agodbus-unit: make sure GetProcesses() D-Bus call internally uses pidfd
Lennart Poettering [Mon, 16 Oct 2023 21:18:37 +0000 (23:18 +0200)] 
dbus-unit: make sure GetProcesses() D-Bus call internally uses pidfd

This way we can be sure to provide an atomic view of the process tree of
a unit.

7 months agoprocess-util: add pidref_is_kernel_thread()
Lennart Poettering [Mon, 16 Oct 2023 21:18:05 +0000 (23:18 +0200)] 
process-util: add pidref_is_kernel_thread()

7 months agoprocess-util: add pidref_get_cmdline()
Lennart Poettering [Mon, 16 Oct 2023 21:17:29 +0000 (23:17 +0200)] 
process-util: add pidref_get_cmdline()

7 months agocgroup-show: use size_t for array sizes
Lennart Poettering [Mon, 16 Oct 2023 21:13:29 +0000 (23:13 +0200)] 
cgroup-show: use size_t for array sizes

7 months agopidref: we never have to verify PID 1
Lennart Poettering [Mon, 16 Oct 2023 21:11:58 +0000 (23:11 +0200)] 
pidref: we never have to verify PID 1

The process exists as long as the kernel/userns exists at all, hence we
don't have to verify a pidfd to it.

7 months agocgroup-util: make cg_pidref_get_path() PidRef parameter const
Lennart Poettering [Wed, 18 Oct 2023 08:24:28 +0000 (10:24 +0200)] 
cgroup-util: make cg_pidref_get_path() PidRef parameter const

7 months agopidref: make signal sending calls take const PidRef
Lennart Poettering [Wed, 18 Oct 2023 12:38:07 +0000 (14:38 +0200)] 
pidref: make signal sending calls take const PidRef

7 months agofd-util: use close_many() where appropriate 29583/head
Lennart Poettering [Wed, 18 Oct 2023 12:03:47 +0000 (14:03 +0200)] 
fd-util: use close_many() where appropriate

7 months agofd-util: add new helper close_many_unset()
Lennart Poettering [Wed, 18 Oct 2023 12:03:36 +0000 (14:03 +0200)] 
fd-util: add new helper close_many_unset()

7 months agoexecute: use close_many_and_free() more
Lennart Poettering [Wed, 18 Oct 2023 10:12:30 +0000 (12:12 +0200)] 
execute: use close_many_and_free() more

7 months agoserialize: add serialize_fd_many() helper
Lennart Poettering [Mon, 16 Oct 2023 13:56:58 +0000 (15:56 +0200)] 
serialize: add serialize_fd_many() helper

7 months agoserialize: change order of deserialize_strv() parameters 29481/head
Lennart Poettering [Fri, 6 Oct 2023 15:56:30 +0000 (17:56 +0200)] 
serialize: change order of deserialize_strv() parameters

The other deserializers put value first, and return parameter second,
let's do so here too.

7 months agoserialize: modernize deserialize_{usec|dual_timestamp}() a bit
Lennart Poettering [Fri, 6 Oct 2023 15:53:13 +0000 (17:53 +0200)] 
serialize: modernize deserialize_{usec|dual_timestamp}() a bit

Rename the return parameters "ret", and use compound initialization. Add
an assert() on input.

7 months agoserialize: add new helper deserialize_fd()
Lennart Poettering [Fri, 6 Oct 2023 15:50:48 +0000 (17:50 +0200)] 
serialize: add new helper deserialize_fd()

Currently, when we deserialize an fd we do a lot of manual work. Add a
common helper that makes this more robust and uniform.

Note that this sometimes changes behaviour slightly, but in ways that
shouldn't really matter: if we fail to deserialize an fd correctly we'll
unset (i.e. set to -EBADF) the fd in the deserialized data structure.
Previously, we'd leave the old value in place.

This should not change effective result (as in either case we'll be in a
bad state afterwards, just once we mix old/invalidated state with new
state, while now we'll reset the state explicitly to invalidated state
on failure). In particular as deserialization starts from an empty
structure generally, hence the old value should be unset anyway.

Another slight change is that if we fail to deserialize some object half
way, and we already have taken out one fd from the serialized fdset
we'll now just close it instead of returning it to/leaving it in the
fdset. Given that such "orphaned" fds are blanket closed after
deserialization finishes this also shouldn't change behaviour IRL.

Also, the idle_pipe was previously incorrectly serialized: we'd
serialize invalidated fds, which would fail, but because parsing errors
on this were ignored on the deserializatin noone noticed. This is fixed.

7 months agopidref: make pidref_verify() parameter const
Lennart Poettering [Wed, 18 Oct 2023 08:26:11 +0000 (10:26 +0200)] 
pidref: make pidref_verify() parameter const

7 months agocgroup-util: rename all return parameters in cgroup-util to ret_xyz
Lennart Poettering [Mon, 16 Oct 2023 20:45:56 +0000 (22:45 +0200)] 
cgroup-util: rename all return parameters in cgroup-util to ret_xyz

7 months agotree-wide: fix typo
Yu Watanabe [Wed, 18 Oct 2023 03:40:25 +0000 (12:40 +0900)] 
tree-wide: fix typo

7 months agonetwork: include SSID in ipv6 stable prefix address generation
Ronan Pigott [Sat, 14 Oct 2023 03:22:49 +0000 (20:22 -0700)] 
network: include SSID in ipv6 stable prefix address generation

The SSID fills the role of the optional Network_ID input parameter
suggested by RFC7217. Including the SSID allows networkd to generate a
different pseudorandom address for different wireless networks, which
should help to obscure the host's identity when roaming between multiple
networks.

7 months agorepart: avoid use of uninitialized TPM2B_PUBLIC data
Daniel P. Berrangé [Tue, 17 Oct 2023 15:45:52 +0000 (16:45 +0100)] 
repart: avoid use of uninitialized TPM2B_PUBLIC data

The 'TPM2B public' struct is only initialized if the public key
is non-NULL, however, it is unconditionally passed to
tpm2_calculate_sealing_policy, resulting in use of uninitialized
data. If the uninitialized data is lucky enough to be all zeroes,
this results eventually results in an error message from
tpm2_calculate_name about an unsupported nameAlg field value.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoMerge pull request #29441 from evelikov/no-input-delay
Luca Boccassi [Tue, 17 Oct 2023 22:45:44 +0000 (23:45 +0100)] 
Merge pull request #29441 from evelikov/no-input-delay

sd-boot: add "menu-disabled" option to "timeout", disabling the 100ms input polling

7 months agocgroup: turn device cgroup controller "rwm" strings into proper flags
Lennart Poettering [Tue, 10 Oct 2023 14:01:16 +0000 (16:01 +0200)] 
cgroup: turn device cgroup controller "rwm" strings into proper flags

We generally prefer dealing with parsed data instead of original
strings, do so for the "rwm" strings too. We have to convert this to
flags for the primary backend implementation (BPF) anyway, hence we
can do this early to have simpler, shorter and more normalized code.

7 months agoMerge pull request #29586 from poettering/read-stripped-line
Luca Boccassi [Tue, 17 Oct 2023 18:54:14 +0000 (19:54 +0100)] 
Merge pull request #29586 from poettering/read-stripped-line

add read_stripped_line() as trivial read_line() + strstrip() combo

7 months agomeson: add build option for install path of main config files
Franck Bui [Mon, 21 Aug 2023 10:37:00 +0000 (12:37 +0200)] 
meson: add build option for install path of main config files

This allows distros to install configuration file templates in /usr/lib/systemd
for example.

Currently we install "empty" config files in /etc/systemd/. They serve two
purposes:

- The file contains commented-out values that show the default settings.
- It is easier to edit the right file if it is already there, the user doesn't
  have to type in the path correctly, and the basic file structure is already in
  place so it's easier to edit.

Things that have happened since this approach was put in place:

- We started supporting drop-ins for config files, and drop-ins are the
  recommended way to create local configuration overrides.
- We have systemd-analyze cat-config which takes care of iterating over
  all possible locations (/etc, /run, /usr, /usr/local) and figuring out
  the right file.
- Because of the first two points, systemd-analyze cat-config is much better,
  because it takes care of finding all the drop-ins and figuring out the
  precedence. Looking at files manually is still possible of course, but not
  very convenient.

The disadvantages of the current approach with "empty" files in /etc:

- We clutter up /etc so it's harder to see what the local configuration actually is.
- If a user edits the file, package updates will not override the file (e.g.
  systemd.rpm uses %config(noreplace). This means that the "documented defaults"
  will become stale over time, if the user ever edits the main config file.

Thus, I think that it's reasonable to:

- Install the main config file to /usr/lib so that it serves as reference for
  syntax and option names and default values and is properly updated on package
  upgrades.
- Recommend to users to always use drop-ins for configuration and
  systemd-analyze cat-config to view the documentation.

This setting makes this change opt-in.

Fixes #18420.

[zjs: add more text to the description]

7 months agoMerge pull request #29242 from fbuihuu/update-main-config-file-headers
Zbigniew Jędrzejewski-Szmek [Tue, 17 Oct 2023 16:56:09 +0000 (18:56 +0200)] 
Merge pull request #29242 from fbuihuu/update-main-config-file-headers

config files: update their header to reflect that they can be install…

7 months agosd-boot: add way to disable the 100ms delay when timeout=0 29441/head
Emil Velikov [Wed, 4 Oct 2023 11:55:52 +0000 (12:55 +0100)] 
sd-boot: add way to disable the 100ms delay when timeout=0

Currently we have a 100ms delay which allows for people to enter/show
the boot menu even when timeout is set to zero.

In a handful of cases, that may not be needed - both in terms of access
policy, as well as latency.

For example: the option to provide the boot menu may be hidden behind an
"expert only" UX in the OS, to avoid end users from accidentally
entering it.

In addition, the current 100ms input polling may cause unexpected
additional delays in the boot. Some example numbers from my SteamDeck:

 - boot counting/rename/flush doubles 300us -> 600us
 - seed/hash setup doubles 900us -> 1800us
 - kernel/image load gets ~40% slower 107ms -> 167ms

It's not entirely clear why the UEFI calls gets slower, nevertheless the
information in itself proves useful.

This commit introduces a new option "menu-disabled", which omits the
100ms delay. The option is documented throughout the manual pages as
well as the Boot Loader Specification.

v2:
 - use STR_IN_SET

v3:
 - drop erroneous whitespace

v4:
 - add a new LoaderFeature bit,
 - don't change ABI keep TIMEOUT_* tokens the same
 - move new token in the 64bit range, update API and storage for it
 - change inc/dec behaviour to TIMEOUT_MIN : TIMEOUT_MENU_FORCE
 - user cannot opt-in from sd-boot itself, add assert_not_reached()

v5:
 - s/Menu disablement control/Menu can be disabled/
 - rewrap comments to 109
 - use SYNTHETIC_ERRNO(EOPNOTSUPP)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 months agobootctl, sd-boot: cross document the menu-hidden/force ABI
Emil Velikov [Thu, 12 Oct 2023 15:24:12 +0000 (16:24 +0100)] 
bootctl, sd-boot: cross document the menu-hidden/force ABI

Document the current state and how we got here.

v2:
 - rewrap command to 109 columns

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 months agodocs/BOOT_LOADER_INTERFACE: mention that menu-* options are strings
Emil Velikov [Wed, 4 Oct 2023 11:55:52 +0000 (12:55 +0100)] 
docs/BOOT_LOADER_INTERFACE: mention that menu-* options are strings

To be on the safe side, explicitly mention that apart from the numerical
entries we can allow string ones.

Implementation-wise, bootctl will use internal numerical values that
match sd-boot's ABI. The latter also accepts the string options.

Going forward we'd like to avoid adding more internal magic and be more
explicit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 months agotest: don't restart journal-upload on an expected fail
Frantisek Sumsal [Tue, 17 Oct 2023 10:49:03 +0000 (12:49 +0200)] 
test: don't restart journal-upload on an expected fail

In c08bec1587 the journal-upload unit gained Restart=on-fail, which goes
against this one particular test that expects the unit to fail, making
the test flaky. Let's disable the automatic restarts just for this test
to make it stable once again.

7 months agotree-wide: port various parsers over to read_stripped_line() 29586/head
Lennart Poettering [Mon, 16 Oct 2023 16:01:00 +0000 (18:01 +0200)] 
tree-wide: port various parsers over to read_stripped_line()

7 months agofileio: add read_stripped_line() as trivial read_line() + strstrip() combo
Lennart Poettering [Mon, 16 Oct 2023 15:55:07 +0000 (17:55 +0200)] 
fileio: add read_stripped_line() as trivial read_line() + strstrip() combo

7 months agodocs/FILE_DESCRIPTOR_STORE: NotifyAccess=cgroup -> all
Mike Yuan [Tue, 17 Oct 2023 10:54:07 +0000 (18:54 +0800)] 
docs/FILE_DESCRIPTOR_STORE: NotifyAccess=cgroup -> all

Fixes #29590

7 months agocore/mount: allow disabling stop propagation from backing device
Mike Yuan [Thu, 12 Oct 2023 10:38:15 +0000 (18:38 +0800)] 
core/mount: allow disabling stop propagation from backing device

With file systems that have volume management functionalities or
volume managers like LVM, it's fine for the backing device of a mount
to disappear after mounted. Currently, we enforce BindsTo= or
StopPropagatedFrom= on the backing device, thus prohibiting such
cases. Instead, let's make this configurable through x-systemd.device-bound.

Closes #16801
Closes #29543

7 months agoMerge pull request #29588 from keszybz/net-naming-scheme-255
Yu Watanabe [Tue, 17 Oct 2023 10:18:29 +0000 (19:18 +0900)] 
Merge pull request #29588 from keszybz/net-naming-scheme-255

Untangle the net-naming-scheme mess with SR-IOV-R "representor" information

7 months agorules: add mtd/by-name symlinks
Matthias Schiffer [Wed, 11 Oct 2023 14:33:25 +0000 (16:33 +0200)] 
rules: add mtd/by-name symlinks

Add persistent symlinks for MTD devices like SPI-NOR flash, based on the
partition names specified on the cmdline, in a Device Tree, or by other
MTD partitioning parser drivers. Using the persistent name can be
preferable to using the numbered /dev/mtdX device, as the latter can
change depending on probe order or when partitioning has changed.

7 months agoMerge pull request #28373 from DaanDeMeyer/udevadm-query
Daan De Meyer [Tue, 17 Oct 2023 08:16:43 +0000 (10:16 +0200)] 
Merge pull request #28373 from DaanDeMeyer/udevadm-query

Add --json and filtering options for --export-db to udevadm info

7 months agomeson: Fix unused format parameter warning
Jan Janssen [Mon, 16 Oct 2023 14:47:41 +0000 (16:47 +0200)] 
meson: Fix unused format parameter warning

7 months agonspawn: check if we can set CoredumpReceive= before doing so
Nick Rosbrook [Mon, 16 Oct 2023 17:13:57 +0000 (13:13 -0400)] 
nspawn: check if we can set CoredumpReceive= before doing so

If systemd-nspawn is newer than the running systemd, we might try to set
CoredumpReceive=yes when systemd doesn't know about it yet. Try and
check if the running systemd is aware of this setting, and if not, don't
try and use it.

Fixes 411d8c72ec
("nspawn: set CoredumpReceive=yes on container's scope when --boot is set").

7 months agotest: make sure that the default naming scheme name maps back to itself 29588/head
Zbigniew Jędrzejewski-Szmek [Mon, 16 Oct 2023 10:53:10 +0000 (12:53 +0200)] 
test: make sure that the default naming scheme name maps back to itself

We were testing the that C constant is defined, but we weren't actually testing
that the string name maps back to itself. This would catch the issue fixed by
the grandparent commit.

The test for the default name is moved to the test file to keep the tests
together. The define is renamed to not have "_TEST" in the name. The issue here
is complicated by the fact that we allow downstreams to inject additional
fields, so we don't know the name of the default scheme if it not set with
-Ddefault-net-naming-scheme=, so _DEFAULT_NET_NAMING_SCHEME[_TEST] is not
defined in all cases, but at least in principle it could be used in other
places. If it exists, it is fully valid.

7 months agoshared/netif-naming-scheme: align tables
Zbigniew Jędrzejewski-Szmek [Mon, 16 Oct 2023 10:35:33 +0000 (12:35 +0200)] 
shared/netif-naming-scheme: align tables

7 months agoNEWS, man: move description of SR-IOV-R net naming to v255
Zbigniew Jędrzejewski-Szmek [Mon, 16 Oct 2023 09:54:21 +0000 (11:54 +0200)] 
NEWS, man: move description of SR-IOV-R net naming to v255

https://github.com/systemd/systemd/pull/29582 adds the "v254" name. This also
changes what the default is and what "latest" refers to. Without the name, the
code could be enabled via runtime configuration. Nevertheless, it could be
enabled at compilation time. In other words:
  meson setup build -Ddefault-net-naming-scheme=v254
would work, but
  net.naming-scheme=v254
would fail.

It is possible that people were using the compile-time override, so I think
we should allow "v254" scheme to stay and clearly document that it wasn't the
default.

Unfortunately, unless people manually introduced the compile-time override, we
were never actually testing the new code too. So all the pull request testing
was not useful.

7 months agonet_id: add missing naming scheme name for v254
Antonio Alvarez Feijoo [Mon, 16 Oct 2023 08:41:51 +0000 (10:41 +0200)] 
net_id: add missing naming scheme name for v254

Follow up to 88d2bda8120dcc375a90e28b64de06b9646ab3b6

8 months agoMerge pull request #29546 from poettering/run-invoc-id
Lennart Poettering [Mon, 16 Oct 2023 17:00:18 +0000 (19:00 +0200)] 
Merge pull request #29546 from poettering/run-invoc-id

run: output invocation ID when starting service and scope units

8 months agoudev: Enable filtering the output of udevadm info --export-db 28373/head
Daan De Meyer [Thu, 12 Oct 2023 09:20:06 +0000 (11:20 +0200)] 
udev: Enable filtering the output of udevadm info --export-db

Let's support the same filtering options that we also support in
udevadm trigger in udevadm info to filter the devices produced by
--export-db.

One difference is that all properties specified by --propery-match=
have to be satisfied in udevadm info unlike udevadm trigger where just
one of them has to be satisfied.

8 months agoMerge pull request #29272 from enr0n/coredump-container
Lennart Poettering [Mon, 16 Oct 2023 14:13:16 +0000 (16:13 +0200)] 
Merge pull request #29272 from enr0n/coredump-container

coredump: support forwarding coredumps to containers

8 months agomount-util: use mount beneath to replace previous namespace mount
Luca Boccassi [Fri, 29 Sep 2023 00:50:15 +0000 (01:50 +0100)] 
mount-util: use mount beneath to replace previous namespace mount

Instead of mounting over, do an atomic swap using mount beneath, if
available. This way assets can be mounted again and again (e.g.:
updates) without leaking mounts.

8 months agoMerge pull request #29548 from poettering/sysext-varlink
Lennart Poettering [Mon, 16 Oct 2023 13:10:24 +0000 (15:10 +0200)] 
Merge pull request #29548 from poettering/sysext-varlink

sysext: add a varlink IPC interface

8 months agoMerge pull request #29562 from poettering/namespace-fuckup-fix
Lennart Poettering [Mon, 16 Oct 2023 13:10:08 +0000 (15:10 +0200)] 
Merge pull request #29562 from poettering/namespace-fuckup-fix

namespace: normalize memory management of mount list

8 months agoupdate TODO 29546/head
Lennart Poettering [Mon, 16 Oct 2023 11:48:40 +0000 (13:48 +0200)] 
update TODO

8 months agorun: pin the unit we invoke continously while we are running
Lennart Poettering [Mon, 16 Oct 2023 09:31:38 +0000 (11:31 +0200)] 
run: pin the unit we invoke continously while we are running

We read properties of the unit, hence it shouldn't be GC'ed as long as
we run. Hence, let's just set AddRef unconditionally for the units we
create.

8 months agorun: output invocation ID when starting service and scope units
Lennart Poettering [Thu, 12 Oct 2023 10:03:03 +0000 (12:03 +0200)] 
run: output invocation ID when starting service and scope units

8 months agonamespace: add // FIXME comments on some suplicate logging 29562/head
Lennart Poettering [Mon, 16 Oct 2023 11:16:55 +0000 (13:16 +0200)] 
namespace: add // FIXME comments on some suplicate logging

@bluca thinks duplicate logging as a feature, hence simply mark these
log messages as // FIXME, but don't bother.

8 months ago namespace: downgrade log messages to LOG_DEBUG
Lennart Poettering [Mon, 16 Oct 2023 11:16:40 +0000 (13:16 +0200)] 
 namespace: downgrade log messages to LOG_DEBUG

almost all code in namespace.c only logs at debug level as it is
"library-like" code. But there are some outliers. Adjust them to match
the rest of the code

(Well, there are some left)

8 months agonamespace: don't retry to a mount if we didn't actually manage to create an inode
Lennart Poettering [Mon, 16 Oct 2023 10:42:06 +0000 (12:42 +0200)] 
namespace: don't retry to a mount if we didn't actually manage to create an inode

8 months agonamespace: downgrade log message of error we ignore to LOG_WARNING
Lennart Poettering [Mon, 16 Oct 2023 10:57:16 +0000 (12:57 +0200)] 
namespace: downgrade log message of error we ignore to LOG_WARNING

frankly, the log message shouldn't be there at all, but the error path
be propagated up, with a recognizable error code. But apparently this is
important to @bluca.

8 months agonamespace: convert ProtectHostname= logic to a static table
Lennart Poettering [Mon, 16 Oct 2023 08:36:17 +0000 (10:36 +0200)] 
namespace: convert ProtectHostname= logic to a static table

Let's simplify things, and make them more alike handling more similar to
the other ProtectXYZ= settings.

8 months agoAdd --json switch to udevadm info
Daan De Meyer [Thu, 12 Oct 2023 09:02:49 +0000 (11:02 +0200)] 
Add --json switch to udevadm info

This allows getting the udevadm info --export-db and query "all" output
as JSON.

8 months agonamespace: normalize memory management of mount list
Lennart Poettering [Fri, 13 Oct 2023 16:58:13 +0000 (18:58 +0200)] 
namespace: normalize memory management of mount list

So far we calculated exactly how many mounts we will generate, which is
a bit fragile, and easy to get wrong.

Let's normalize this, and grow the array of mounts as we need.

Various other modernizations while we are at it, such as FOREACH_ARRAY
usage, or `_cleanup_` usage.

8 months agoupdate TODO 29548/head
Lennart Poettering [Thu, 12 Oct 2023 10:36:11 +0000 (12:36 +0200)] 
update TODO

8 months agosysext: make some calls available via varlink
Lennart Poettering [Mon, 9 Oct 2023 16:57:41 +0000 (18:57 +0200)] 
sysext: make some calls available via varlink