]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 months agoman/kernel-command-line: be clear that resumeflags= is about timeout opts only 32043/head
Mike Yuan [Tue, 2 Apr 2024 21:38:51 +0000 (05:38 +0800)] 
man/kernel-command-line: be clear that resumeflags= is about timeout opts only

2 months agounits: introduce systemd-hibernate-clear.service that clears
Mike Yuan [Sun, 31 Mar 2024 12:52:39 +0000 (20:52 +0800)] 
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

2 months agohibernate-resume: introduce --clear for clearing hibernate storage var
Mike Yuan [Sun, 31 Mar 2024 12:30:50 +0000 (20:30 +0800)] 
hibernate-resume: introduce --clear for clearing hibernate storage var

2 months agohibernate-resume: add options handling
Mike Yuan [Sun, 31 Mar 2024 11:47:34 +0000 (19:47 +0800)] 
hibernate-resume: add options handling

2 months agohibernate-resume-config: expose get_efi_hibernate_location
Mike Yuan [Wed, 3 Apr 2024 01:42:59 +0000 (09:42 +0800)] 
hibernate-resume-config: expose get_efi_hibernate_location

2 months agohibernate-resume: EINVAL -> ENOTBLK where appropriate
Mike Yuan [Tue, 2 Apr 2024 16:51:37 +0000 (00:51 +0800)] 
hibernate-resume: EINVAL -> ENOTBLK where appropriate

2 months agohibernate-util: make clear_efi_hibernate_location_and_warn return 1 if
Mike Yuan [Sun, 31 Mar 2024 12:17:14 +0000 (20:17 +0800)] 
hibernate-util: make clear_efi_hibernate_location_and_warn return 1 if
actually cleared the variable

2 months agoMerge pull request #32057 from yuwata/man-example
Luca Boccassi [Wed, 3 Apr 2024 12:30:43 +0000 (13:30 +0100)] 
Merge pull request #32057 from yuwata/man-example

man: add simple build test for example code

2 months ago99-systemd.rules: rework SYSTEMD_READY logic for device mapper
Martin Wilck [Wed, 6 Mar 2024 10:39:00 +0000 (11:39 +0100)] 
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>
2 months agoman/meson: add simple build test for example code 32057/head
Yu Watanabe [Tue, 2 Apr 2024 18:42:55 +0000 (03:42 +0900)] 
man/meson: add simple build test for example code

2 months agosd-bus-vtable: add dummy macro to support compile without GNU extension
Yu Watanabe [Wed, 3 Apr 2024 02:52:23 +0000 (11:52 +0900)] 
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.

2 months agoman/examples: fix sd- header path
Yu Watanabe [Tue, 2 Apr 2024 19:22:36 +0000 (04:22 +0900)] 
man/examples: fix sd- header path

2 months agoman/examples: use strerror() instead of %m
Yu Watanabe [Tue, 2 Apr 2024 18:40:05 +0000 (03:40 +0900)] 
man/examples: use strerror() instead of %m

2 months agoman/example: fix build failure of hwdb-usb-device.c
Yu Watanabe [Tue, 2 Apr 2024 17:21:19 +0000 (02:21 +0900)] 
man/example: fix build failure of hwdb-usb-device.c

STRLEN() and xsprintf() is our internal macros.

2 months agoMerge pull request #32060 from YHNdnzj/timespec-minor-cleanup
Yu Watanabe [Wed, 3 Apr 2024 04:48:56 +0000 (13:48 +0900)] 
Merge pull request #32060 from YHNdnzj/timespec-minor-cleanup

Minor cleanup for timespec/efivars

2 months agoefivars: minor modernization for efi_set_variable 32060/head
Mike Yuan [Sun, 31 Mar 2024 12:14:16 +0000 (20:14 +0800)] 
efivars: minor modernization for efi_set_variable

2 months agosignal-util: make struct timespec const
Mike Yuan [Tue, 2 Apr 2024 16:49:38 +0000 (00:49 +0800)] 
signal-util: make struct timespec const

2 months agotime-util: drop unneeded 'struct'
Mike Yuan [Tue, 2 Apr 2024 16:40:38 +0000 (00:40 +0800)] 
time-util: drop unneeded 'struct'

2 months agogit-contrib: use 'git shortlog' command
Yu Watanabe [Tue, 2 Apr 2024 16:41:07 +0000 (01:41 +0900)] 
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>
2 months agoMerge pull request #32059 from bluca/doc
Yu Watanabe [Wed, 3 Apr 2024 00:15:15 +0000 (09:15 +0900)] 
Merge pull request #32059 from bluca/doc

Docs and TODO fixes

2 months agotest: Always exit with 77 if we skip a test
Daan De Meyer [Tue, 2 Apr 2024 18:37:30 +0000 (20:37 +0200)] 
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.

2 months agodocs: notify example was moved to sd_notify manpage 32059/head
Luca Boccassi [Tue, 2 Apr 2024 21:24:20 +0000 (22:24 +0100)] 
docs: notify example was moved to sd_notify manpage

Reference in the portability doc was forgot

Follow-up for 383917ac67570e2dccd558bcde3910a686b9f077

2 months agoTODO: drop line about bzip2/gzip
Luca Boccassi [Tue, 2 Apr 2024 21:22:29 +0000 (22:22 +0100)] 
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

2 months agoMerge pull request #32055 from mrc0mmand/pre-rc-coccinelle
Luca Boccassi [Tue, 2 Apr 2024 20:58:39 +0000 (21:58 +0100)] 
Merge pull request #32055 from mrc0mmand/pre-rc-coccinelle

Coccinelle-suggested tweaks, pre-rc edition

2 months agoMerge pull request #32052 from mrc0mmand/even-more-test-tweaks
Luca Boccassi [Tue, 2 Apr 2024 20:49:05 +0000 (21:49 +0100)] 
Merge pull request #32052 from mrc0mmand/even-more-test-tweaks

A couple of assorted tweaks

2 months agotest: don't hide exit code of the systemd-run process 32052/head
Frantisek Sumsal [Tue, 2 Apr 2024 16:32:22 +0000 (18:32 +0200)] 
test: don't hide exit code of the systemd-run process

2 months agocore: correctly deserialize credentials with empty payload
Frantisek Sumsal [Tue, 2 Apr 2024 16:31:03 +0000 (18:31 +0200)] 
core: correctly deserialize credentials with empty payload

For example with SetCredential=mycred: the data payload is empty, but it
is still a valid credential.

This reorders the arguments when serializing credentials, so the
possibly empty argument is not at the end of the serialized string. This
way we can still easily use the extract_many_words() machinery, and with
the use of EXTRACT_DONT_COALESCE_SEPARATORS properly deserialize even an
empty credential. This changes LoadCredentials= as well just to keep the
code for (de)serializing both directives in sync.

2 months agotest: check if sd-executor doesn't complain during (de)serializing
Frantisek Sumsal [Thu, 28 Mar 2024 14:20:22 +0000 (15:20 +0100)] 
test: check if sd-executor doesn't complain during (de)serializing

This was usually caught by "accident" by other tests that parse output
of commands executed by sd-executor, so let's have an explicit check for
this.

2 months agotest: bump the container boot timeout when running w/o acceleration
Frantisek Sumsal [Thu, 28 Mar 2024 14:15:06 +0000 (15:15 +0100)] 
test: bump the container boot timeout when running w/o acceleration

With plain QEMU on a saturated AWS region we might just barely miss the
timeout window, causing unexpected test fails:

[  688.681324] systemd-nspawn[1332]: [  OK  ] Finished systemd-user-sessions.service.
[  689.451267] systemd-nspawn[1332]: [  OK  ] Started console-getty.service.
[  689.572874] systemd-nspawn[1332]: [  OK  ] Reached target getty.target.
[  693.634609] testsuite-74.sh[1223]: + at_exit
[  693.634609] testsuite-74.sh[1223]: + rm -fv -- /tmp/test-dump /tmp/test-usr-dump /tmp/make-dump
[  693.838395] testsuite-74.sh[1502]: removed '/tmp/test-dump'
[  693.838395] testsuite-74.sh[1502]: removed '/tmp/test-usr-dump'
[  693.838395] testsuite-74.sh[1502]: removed '/tmp/make-dump'
[  693.951114] testsuite-74.sh[670]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-74.coredump.sh failed'
[  693.951114] testsuite-74.sh[670]: Subtest /usr/lib/systemd/tests/testdata/units/testsuite-74.coredump.sh failed
[  693.951114] testsuite-74.sh[670]: + return 1
[  694.659094] systemd[1]: testsuite-74.service: Main process exited, code=exited, status=1/FAILURE
[  694.719563] systemd[1]: testsuite-74.service: Failed with result 'exit-code'.
[  694.882069] systemd[1]: Failed to start testsuite-74.service.
[  695.574445] systemd[1]: Reached target testsuite.target.
[  696.174844] systemd[1]: Starting end.service...
[  699.509408] systemd-nspawn[1332]:
[  699.509408] systemd-nspawn[1332]: CentOS Stream 9
[  699.509408] systemd-nspawn[1332]: Kernel 5.14.0-432.el9.x86_64 on an x86_64 (pts/0)
[  699.509408] systemd-nspawn[1332]:

Also, move the rest of container the setup for the user xattrs test into
the condition, since doing it without the actual test is pretty
pointless.

2 months agoci: fix commit SHA for stefanbuck/github-issue-parser
Frantisek Sumsal [Tue, 2 Apr 2024 14:18:54 +0000 (16:18 +0200)] 
ci: fix commit SHA for stefanbuck/github-issue-parser

The SHA for this action was updated by Dependabot in #25900 to a commit
which later disappeared from the repo. Since then Dependabot kept
(silently) failing to bump the SHA further:

updater | 2024/03/31 21:22:13 ERROR <job_807574419> Error processing stefanbuck/github-issue-parser (Dependabot::SharedHelpers::HelperSubprocessFailed)
updater | 2024/03/31 21:22:13 ERROR <job_807574419> error: no such commit c1a559d78bfb8dd05216dab9ffd2b91082ff5324

See: https://github.com/systemd/systemd/pull/25900#issuecomment-2028912672

Let's bump the SHA manually to v3.1.0 to get Dependabot back on the track.

Co-authored-by: Evgeny Vereshchagin <evvers@ya.ru>
2 months agoMerge pull request #32030 from bluca/dlopen_document
Luca Boccassi [Tue, 2 Apr 2024 16:18:02 +0000 (17:18 +0100)] 
Merge pull request #32030 from bluca/dlopen_document

man: document that using sd_journal APIs might cause dlopen to happen and add self-contained notify protocol example

2 months agotest: use free() instead of mfree() 32055/head
Frantisek Sumsal [Tue, 2 Apr 2024 16:08:50 +0000 (18:08 +0200)] 
test: use free() instead of mfree()

Since we don't use the returned value anyway.

2 months agosysext: use mfree() in one more place
Frantisek Sumsal [Tue, 2 Apr 2024 16:08:30 +0000 (18:08 +0200)] 
sysext: use mfree() in one more place

2 months agoSimplify a couple of conditions
Frantisek Sumsal [Tue, 2 Apr 2024 16:07:50 +0000 (18:07 +0200)] 
Simplify a couple of conditions

2 months agoUse IN_SET() more
Frantisek Sumsal [Tue, 2 Apr 2024 16:06:24 +0000 (18:06 +0200)] 
Use IN_SET() more

2 months agoMerge pull request #32004 from YHNdnzj/umount-new-cycle
Luca Boccassi [Tue, 2 Apr 2024 14:52:46 +0000 (15:52 +0100)] 
Merge pull request #32004 from YHNdnzj/umount-new-cycle

core/mount: if mount is gone eventually, consider it success

2 months agoman: add self-contained example of notify protocol 32030/head
Luca Boccassi [Sun, 31 Mar 2024 22:18:09 +0000 (23:18 +0100)] 
man: add self-contained example of notify protocol

We are saying in public that the protocl is stable and can be easily
reimplemented, so provide an example doing so in the documentation,
license as MIT-0 so that it can be copied and pasted at will.

2 months agoman: document that using sd_journal APIs might cause dlopen to happen
Luca Boccassi [Sun, 31 Mar 2024 13:22:54 +0000 (14:22 +0100)] 
man: document that using sd_journal APIs might cause dlopen to happen

2 months agoMerge pull request #32042 from YHNdnzj/implicit-mounts-for
Luca Boccassi [Tue, 2 Apr 2024 12:24:56 +0000 (13:24 +0100)] 
Merge pull request #32042 from YHNdnzj/implicit-mounts-for

units: remove one implicit RequiresMountsFor=

2 months agobuild(deps): bump systemd/mkosi
dependabot[bot] [Mon, 1 Apr 2024 09:12:59 +0000 (09:12 +0000)] 
build(deps): bump systemd/mkosi

Bumps [systemd/mkosi](https://github.com/systemd/mkosi) from 31af101620fc2996517d87e86da310f7ba553d58 to 4dfdf98ed2877a1e40f37234e0b8fbba0fec3584.
- [Release notes](https://github.com/systemd/mkosi/releases)
- [Changelog](https://github.com/systemd/mkosi/blob/main/NEWS.md)
- [Commits](https://github.com/systemd/mkosi/compare/31af101620fc2996517d87e86da310f7ba553d58...4dfdf98ed2877a1e40f37234e0b8fbba0fec3584)

---
updated-dependencies:
- dependency-name: systemd/mkosi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agomkosi: Use '-' instead of '.' to separate upstream version and debian revision
Daan De Meyer [Tue, 2 Apr 2024 09:19:22 +0000 (11:19 +0200)] 
mkosi: Use '-' instead of '.' to separate upstream version and debian revision

The debian revision starts after the '-' character, so make sure the
timestamp we append is treated as the revision instead of being a part
of the upstream version.

2 months agobuild(deps): bump pkg/debian from `44fe1d4` to `e780b50`
dependabot[bot] [Mon, 1 Apr 2024 09:33:13 +0000 (09:33 +0000)] 
build(deps): bump pkg/debian from `44fe1d4` to `e780b50`

Bumps pkg/debian from `44fe1d4` to `e780b50`.

---
updated-dependencies:
- dependency-name: pkg/debian
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agocore/mount: if mount is gone eventually, consider it success 32004/head
Mike Yuan [Thu, 28 Mar 2024 16:43:25 +0000 (00:43 +0800)] 
core/mount: if mount is gone eventually, consider it success

Currently, if unmount initiated by us fails, we record
that in result. Later, if we tried again and succeeded,
or someone else successfully unmounted it, the unit
state is still considered failed. Let's be more tolerant
instead, and forget about previous failure.

Alternative to #32002

2 months agocore/mount: if unmount retries exceeded max, record as failure
Mike Yuan [Thu, 28 Mar 2024 16:51:27 +0000 (00:51 +0800)] 
core/mount: if unmount retries exceeded max, record as failure

2 months agoman/tmpfiles.d: drop doubled space
Mike Yuan [Tue, 2 Apr 2024 09:11:47 +0000 (17:11 +0800)] 
man/tmpfiles.d: drop doubled space

2 months agodoc(tmpfiles.d): remove deprecated `F` type
Eisuke Kawashima [Mon, 1 Apr 2024 17:35:04 +0000 (02:35 +0900)] 
doc(tmpfiles.d): remove deprecated `F` type

close #32044

2 months agounits: remove implicit RequiresMountsFor= 32042/head
Mike Yuan [Mon, 1 Apr 2024 11:44:51 +0000 (19:44 +0800)] 
units: remove implicit RequiresMountsFor=

2 months agocore/unit: use FOREACH_ARRAY at one more place
Mike Yuan [Mon, 1 Apr 2024 11:42:02 +0000 (19:42 +0800)] 
core/unit: use FOREACH_ARRAY at one more place

2 months agocore/service: ensure we don't restart on SERVICE_SKIP_CONDITION
Mike Yuan [Sat, 30 Mar 2024 13:16:49 +0000 (21:16 +0800)] 
core/service: ensure we don't restart on SERVICE_SKIP_CONDITION

service_shall_restart() always returns false if result
is SERVICE_SKIP_CONDITION, so drop unreachable code.

2 months agobuild(deps): bump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Mon, 1 Apr 2024 09:12:54 +0000 (09:12 +0000)] 
build(deps): bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/b9df2a9417f69c056e0aeaf870abd9a2065a403e...c15070885a82a2c93db8a765d332c38c50dde8b3)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agosysupdate: print assumed value
Burak Gerz [Fri, 29 Mar 2024 23:41:51 +0000 (00:41 +0100)] 
sysupdate: print assumed value

The MatchPattern= in Target specification is documented as mandatory,
but if not defined sysupdate will assume the same value as definied
in Source specification and continue execution. Print this
assumptions to the user

2 months agoFix assertion in socknameinfo_pretty()
Daan De Meyer [Sun, 31 Mar 2024 16:24:35 +0000 (18:24 +0200)] 
Fix assertion in socknameinfo_pretty()

2 months agomkosi: Update centos to latest
Daan De Meyer [Sun, 31 Mar 2024 20:39:19 +0000 (22:39 +0200)] 
mkosi: Update centos to latest

Due to dependabot and pagure not playing nice with each other, we're
going to have to update this one manually for a while.

See https://github.com/systemd/systemd/issues/31773

2 months agorepart: Add DefaultSubvolume= setting
Daan De Meyer [Fri, 29 Mar 2024 14:56:01 +0000 (15:56 +0100)] 
repart: Add DefaultSubvolume= setting

We already have Subvolumes= to create subvolumes, let's add
DefaultSubvolume= as well to set the default subvolume.

2 months agomanager: Freeze/Thaw: Don't fail units w/o cgroup
Adrian Vovk [Fri, 29 Mar 2024 00:38:09 +0000 (20:38 -0400)] 
manager: Freeze/Thaw: Don't fail units w/o cgroup

Previously, it was impossible to freeze or thaw a slice if it is an
ancestor to a unit that had no running cgroup (i.e. a service with
RemainAfterExit=yes). Instead of failing with EBUSY (which would
confusingly get reported as "Unit has pending job") we just silently
no-op.

I noticed this because we now have user-runtime-dir@.service, which
would make it impossible to freeze/thaw user.slice or user-<UID>.slice

2 months agoMerge pull request #32010 from bluca/reexec_rate_limit
Luca Boccassi [Fri, 29 Mar 2024 17:16:36 +0000 (17:16 +0000)] 
Merge pull request #32010 from bluca/reexec_rate_limit

core: serialize reload rate limit and apply ReloadLimit to reexec too

2 months agomkosi: Switch to linux-virtual on Ubuntu
Daan De Meyer [Fri, 29 Mar 2024 07:28:57 +0000 (08:28 +0100)] 
mkosi: Switch to linux-virtual on Ubuntu

This now finally has support for credentials and erofs so let's switch
to this much smaller kernel package that doesn't pull in linux-firmware.

2 months agoudevadm-test: prettify test results
Yu Watanabe [Fri, 29 Mar 2024 04:03:49 +0000 (13:03 +0900)] 
udevadm-test: prettify test results

2 months agocore: apply ReloadLimit to reexec too 32010/head
Luca Boccassi [Fri, 29 Mar 2024 01:29:07 +0000 (01:29 +0000)] 
core: apply ReloadLimit to reexec too

Same reason as the reload, reexec is disruptive and it requires the
same privileges, so if somebody wants to limit reloads, they'll also
want to limit reexecs, so use the same setting.

2 months agocore: serialize reload rate limit
Luca Boccassi [Fri, 29 Mar 2024 01:15:26 +0000 (01:15 +0000)] 
core: serialize reload rate limit

Otherwise the rate limit is lost on reexec, and the privileges to call it
are the same as reloads

2 months agoMerge pull request #32013 from yuwata/align-table
Daan De Meyer [Fri, 29 Mar 2024 07:30:59 +0000 (08:30 +0100)] 
Merge pull request #32013 from yuwata/align-table

core: align table

2 months agounit-def: append trailing comma for the last entry 32013/head
Yu Watanabe [Fri, 29 Mar 2024 04:53:01 +0000 (13:53 +0900)] 
unit-def: append trailing comma for the last entry

2 months agocore: align table
Yu Watanabe [Fri, 29 Mar 2024 04:51:15 +0000 (13:51 +0900)] 
core: align table

2 months agoMerge pull request #31998 from yuwata/udev-event-mode
Yu Watanabe [Fri, 29 Mar 2024 02:31:58 +0000 (11:31 +0900)] 
Merge pull request #31998 from yuwata/udev-event-mode

udev: make udevadm test and test-builtin not destructive

2 months agoportable: the 'flags' parameter is now used in DetachImageWithExtensions() and Reatta...
Luca Boccassi [Thu, 28 Mar 2024 22:17:26 +0000 (22:17 +0000)] 
portable: the 'flags' parameter is now used in DetachImageWithExtensions() and ReattachImageWithExtensions()

2 months agoudev: make udevadm test and test-builtin not destructive 31998/head
Yu Watanabe [Thu, 28 Mar 2024 07:24:59 +0000 (16:24 +0900)] 
udev: make udevadm test and test-builtin not destructive

Previously, 'udevadm test' performs not only processing udev rules,
but made several destructive change on the system; updating udev
database, device node permission, devlinks, network interface
properties, and so on.

Similary, 'udevadm test-builtin' may perform something destructive,
especially by 'keyboard', 'kmod', and 'net_setup_link' builtins.

Let's make these commands and test executables not change device
configurations.

2 months agoMerge pull request #31986 from YHNdnzj/suspend-mem-mode
Yu Watanabe [Fri, 29 Mar 2024 00:30:54 +0000 (09:30 +0900)] 
Merge pull request #31986 from YHNdnzj/suspend-mem-mode

sleep: add SleepMemMode= setting for configuring /sys/power/mem_sleep

2 months agonetwork: save the real rdnss address
Ronan Pigott [Thu, 28 Mar 2024 00:19:43 +0000 (17:19 -0700)] 
network: save the real rdnss address

... instead of the router that informed us

Fixes: 86a66e9b9504 ("network: also save NTP servers and friends obtained by other protocols")
2 months agotest: make coverage runs happy with capsule@.service
Frantisek Sumsal [Thu, 28 Mar 2024 13:57:26 +0000 (14:57 +0100)] 
test: make coverage runs happy with capsule@.service

capsule@.service uses DynamicUser=yes, so let's use the same tweak we
use for other such units.

2 months agologin: Fix fallback error handling
Daan De Meyer [Thu, 28 Mar 2024 16:05:33 +0000 (17:05 +0100)] 
login: Fix fallback error handling

2 months agotest: disable IPv6AcceptRA= for test network interfaces with static address
Yu Watanabe [Thu, 28 Mar 2024 03:52:01 +0000 (12:52 +0900)] 
test: disable IPv6AcceptRA= for test network interfaces with static address

This hopefully improves test performance.

2 months agoMerge pull request #31994 from yuwata/network-dhcp-server-follow-ups
Luca Boccassi [Thu, 28 Mar 2024 12:35:13 +0000 (12:35 +0000)] 
Merge pull request #31994 from yuwata/network-dhcp-server-follow-ups

network: several fixlets for PersistLeases=

2 months agondisc-option: allow to set valid time of options
Yu Watanabe [Sun, 17 Mar 2024 06:23:38 +0000 (15:23 +0900)] 
ndisc-option: allow to set valid time of options

When an option is delegated from an upstream server, its lifetime
may be limited by a time. Such functionality will be used later by
sd-radv.

This also remove 'offset' argument from the option setter
ndisc_option_set_xyz(), and make it update existing option.
See comments in ndisc_option_add_link_layer_address() for more details.

2 months agojournalctl-filter: use add_match_boot_id() instead of add_match_this_boot()
Yu Watanabe [Fri, 22 Mar 2024 08:46:00 +0000 (17:46 +0900)] 
journalctl-filter: use add_match_boot_id() instead of add_match_this_boot()

The function add_match_this_boot() calls sd_journal_add_conjunction(),
hence, we cannot specify multiple devices in the extra match arguments,
e.g., "journalctl /dev/sda /dev/sdb" shows no entry.

2 months agosleep: add SleepMemMode= setting for configuring /sys/power/mem_sleep 31986/head
Mike Yuan [Wed, 27 Mar 2024 11:45:34 +0000 (19:45 +0800)] 
sleep: add SleepMemMode= setting for configuring /sys/power/mem_sleep

The setting is used when /sys/power/state is set to 'mem'
(common for suspend) or /sys/power/disk is set to 'suspend'
(hybrid-sleep). We default to kernel choice here, i.e.
respect what's set through 'mem_sleep_default=' kernel
cmdline option.

2 months agosleep: make write_mode take a path
Mike Yuan [Wed, 27 Mar 2024 11:45:08 +0000 (19:45 +0800)] 
sleep: make write_mode take a path

Similar to the previous commit, preparation
for adding support for /sys/power/mem_sleep.

2 months agosleep-config: make sleep_mode_supported take a path
Mike Yuan [Tue, 26 Mar 2024 16:24:58 +0000 (00:24 +0800)] 
sleep-config: make sleep_mode_supported take a path

Preparation for later commits.

2 months agostring-util: modernize string_contains_word_strv a bit
Mike Yuan [Tue, 26 Mar 2024 16:15:40 +0000 (00:15 +0800)] 
string-util: modernize string_contains_word_strv a bit

Also correct the comment on flags.

2 months agosleep-config: fix potential memory leak
Mike Yuan [Wed, 27 Mar 2024 13:03:30 +0000 (21:03 +0800)] 
sleep-config: fix potential memory leak

Follow-up for 77bd39385eae7b8e3182e66292b9f94bb54e235d

2 months agoman/systemd-sleep: reorder options
Mike Yuan [Wed, 27 Mar 2024 11:59:51 +0000 (19:59 +0800)] 
man/systemd-sleep: reorder options

2 months agosleep-config: make sleep_operation_is_hibernation uppercase
Mike Yuan [Tue, 26 Mar 2024 16:30:06 +0000 (00:30 +0800)] 
sleep-config: make sleep_operation_is_hibernation uppercase

2 months agoudev-event: split out update_clone()
Yu Watanabe [Thu, 28 Mar 2024 05:49:28 +0000 (14:49 +0900)] 
udev-event: split out update_clone()

No functional change, preparation for later commits.

2 months agohomed: Release(): fix assertion failure
Adrian Vovk [Thu, 21 Mar 2024 23:28:38 +0000 (19:28 -0400)] 
homed: Release(): fix assertion failure

This fixes a race condition crash in homed that would happen in the
following sequence of events:

1. Client 1 takes a ref on the home area
2. Client 1 calls some method via dbus
3. Client 2 calls Release()

In homed, the Release() would check if a ref is still held (in this
case: yes it is) and returns an error. Except that is done through a
code-path that asserts that no operations are ongoing. In this case,
it's valid to have an ongoing operation, and so the assertion fails
causing homed to crash.

2 months agorun: fix generated unit name clash after soft-reboot
Luca Boccassi [Wed, 27 Mar 2024 21:14:15 +0000 (21:14 +0000)] 
run: fix generated unit name clash after soft-reboot

When sd-run connects to D-Bus rather than the private socket, it will
generate the transient unit name using the bus ID assigned by the D-Bus
broker/daemon. The issue is that this ID is only unique per D-Bus run,
if the broker/daemon restarts it starts again from 1, and it's a simple
incremental counter for each client.
So if a transient unit run-u6.service starts and fails, and it is not
collected (default on failure), and the system soft-reboots, any new
transient unit might conflict as the counter will restart:

Failed to start transient service unit: Unit run-u6.service was already loaded or has a fragment file.

Get the soft-reboot counter, and if it's greater than zero, append it
to the autogenerated unit name to avoid clashes.

2 months agoMerge pull request #31989 from mrc0mmand/test-loop-dev-check
Yu Watanabe [Thu, 28 Mar 2024 02:19:32 +0000 (11:19 +0900)] 
Merge pull request #31989 from mrc0mmand/test-loop-dev-check

test: check for /dev/loop-control when checking lodev availability

2 months agoMerge pull request #31963 from yuwata/journalctl-authenticate-cleanups
Yu Watanabe [Thu, 28 Mar 2024 02:19:21 +0000 (11:19 +0900)] 
Merge pull request #31963 from yuwata/journalctl-authenticate-cleanups

journalctl-authenticate: several cleanups

2 months agotest-network: add test cases for PersistLeases=no 31994/head
Yu Watanabe [Thu, 28 Mar 2024 02:07:35 +0000 (11:07 +0900)] 
test-network: add test cases for PersistLeases=no

2 months agonetwork: make [DHCPServer] in networkd.conf work
Yu Watanabe [Thu, 28 Mar 2024 01:39:26 +0000 (10:39 +0900)] 
network: make [DHCPServer] in networkd.conf work

Follow-up for a3ed665a29ea9355c78a2a6b3a032b9504499dd6.

Fixes https://github.com/systemd/systemd/pull/31977#discussion_r1542196572.

2 months agonetwork: fix typo
Yu Watanabe [Thu, 28 Mar 2024 01:37:35 +0000 (10:37 +0900)] 
network: fix typo

Follow-up for a3ed665a29ea9355c78a2a6b3a032b9504499dd6.

2 months agoMerge pull request #31985 from DaanDeMeyer/mkosi
Yu Watanabe [Thu, 28 Mar 2024 01:21:34 +0000 (10:21 +0900)] 
Merge pull request #31985 from DaanDeMeyer/mkosi

mkosi: Copy built packages to output directory

2 months agotimedate: fix typo
Yu Watanabe [Thu, 28 Mar 2024 00:54:48 +0000 (09:54 +0900)] 
timedate: fix typo

Follow-up for 3a51e31be9f626cf772733cb289ed64739fab0e4.

2 months agojournalctl-authenticate: return earlier if we are not on a TTY 31963/head
Yu Watanabe [Tue, 26 Mar 2024 14:42:21 +0000 (23:42 +0900)] 
journalctl-authenticate: return earlier if we are not on a TTY

No functional change, just refactoring.

2 months agojournalctl-authenticate: use open_tmpfile_linkable() and link_tmpfile()
Yu Watanabe [Tue, 26 Mar 2024 14:39:43 +0000 (23:39 +0900)] 
journalctl-authenticate: use open_tmpfile_linkable() and link_tmpfile()

This also
- use path_join(),
- rename variables to more descriptive names.

2 months agojournalctl-authenticate: drop unnecessary safe_close()
Yu Watanabe [Tue, 26 Mar 2024 13:40:43 +0000 (22:40 +0900)] 
journalctl-authenticate: drop unnecessary safe_close()

Follow-up for 7560fffcd2531786b9c1ca657667a43e90331326.

Addresses https://github.com/systemd/systemd/pull/31879#discussion_r1539063239.

2 months agojournalctl-authenticate: use is_dir() and refuse symlink for /var/log/journal
Yu Watanabe [Mon, 25 Mar 2024 13:15:51 +0000 (22:15 +0900)] 
journalctl-authenticate: use is_dir() and refuse symlink for /var/log/journal

I am not sure it is explicitly documented that /var/log/journal should
be a directory, rather than a symlink to a directory, but the current
code of journald seems not to support symlinked directory well. Let's
refuse that at least here and now.

2 months agoanalyze: fix plot with soft-reboot
Luca Boccassi [Wed, 27 Mar 2024 16:35:20 +0000 (16:35 +0000)] 
analyze: fix plot with soft-reboot

Clamp times and start counting from when soft-reboot is started
to avoid creating a huge graph, like it's done for the user
instance.

2 months agotest: cleanup the test script a bit 31989/head
Frantisek Sumsal [Wed, 27 Mar 2024 19:13:24 +0000 (20:13 +0100)] 
test: cleanup the test script a bit

2 months agotest: check for /dev/loop-control when checking lodev availability
Frantisek Sumsal [Wed, 27 Mar 2024 18:35:30 +0000 (19:35 +0100)] 
test: check for /dev/loop-control when checking lodev availability

losetup in util-linux 2.40 started reporting lost loop devices [0] and
it has an unfortunate side-effect where it reports lost devices even in
containers, which then makes the loop device check "falsely" pass [1].

Let's just check for /dev/loop-control explicitly to "work around" this.

[0] https://github.com/util-linux/util-linux/commit/a6ca0456cc6d704a786f6b66d8bb2d89ff18eba7
[1] https://github.com/util-linux/util-linux/issues/2824

2 months agotimedated: Respond on org.freedesktop.timedate1.SetNTP only when really finished
Michal Koutný [Tue, 20 Feb 2024 18:26:16 +0000 (19:26 +0100)] 
timedated: Respond on org.freedesktop.timedate1.SetNTP only when really finished

The method returns prematurely (before jobs it triggers terminate). This
is externally visible because other methods may fail if jobs did not
finish.
Postpone the DBus method response until we collect all signals for
finished jobs.
systemd-timedated keeps track of in-flight DBus requests and answers
them all in unspecified order when jobs finish. The capacity of requests
in systemd-timedated is limited.

Fixes: #17739
2 months agomkosi: Copy built packages to output directory 31985/head
Daan De Meyer [Wed, 27 Mar 2024 13:05:44 +0000 (14:05 +0100)] 
mkosi: Copy built packages to output directory

This allows the built packages to be inspected if needed, or installed
on the host system for anyone who's daring enough to do so.