]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 months agoMerge pull request #30384 from YHNdnzj/rename-process
Mike Yuan [Sat, 9 Dec 2023 11:04:07 +0000 (19:04 +0800)] 
Merge pull request #30384 from YHNdnzj/rename-process

core/executor: save argv for later use by rename_process()

6 months agoMerge pull request #30362 from mrc0mmand/cat-highlight-directives
Yu Watanabe [Sat, 9 Dec 2023 09:54:46 +0000 (18:54 +0900)] 
Merge pull request #30362 from mrc0mmand/cat-highlight-directives

shared: highlight directives when dumping configs

6 months agoRevert "packit: don't take ownership of /etc/ssh/sshd_config.d/"
Zbigniew Jędrzejewski-Szmek [Fri, 8 Dec 2023 17:40:15 +0000 (18:40 +0100)] 
Revert "packit: don't take ownership of /etc/ssh/sshd_config.d/"

This reverts commit 9f7d1899235a237ba7a6000479cbf3965b224fd9.
systemd.spec was updated in [1], so we don't need this here anymore.

[1] https://src.fedoraproject.org/rpms/systemd/c/245a2587e095a08a61af4e48f7daa57dee3629e6

6 months agocore/executor: save argv for later use by rename_process() 30384/head
Mike Yuan [Fri, 8 Dec 2023 13:14:11 +0000 (21:14 +0800)] 
core/executor: save argv for later use by rename_process()

Partially fixes #30352

6 months agocore/exec-invoke: voidify one rename_process call
Mike Yuan [Fri, 8 Dec 2023 11:46:53 +0000 (19:46 +0800)] 
core/exec-invoke: voidify one rename_process call

6 months agorepart: Don't look for --make-ddi= definitions inside --root=
Daan De Meyer [Thu, 7 Dec 2023 13:26:10 +0000 (14:26 +0100)] 
repart: Don't look for --make-ddi= definitions inside --root=

It doesn't really make sense to go looking for these inside the
given root directory. While we should resolve specifiers and such
based on the given root directory, let's look up the image definitions
on the host system as there's a good chance they're coupled to the
repart version we're using so there's all kinds of chances for problems
if we use the definitions from the image we're building instead of those
from the host.

6 months agocore: create workdir/upperdir when mounting a Type=overlay mount unit
Luca Boccassi [Thu, 7 Dec 2023 23:19:36 +0000 (23:19 +0000)] 
core: create workdir/upperdir when mounting a Type=overlay mount unit

So far we created the target directory, and the source for bind mounts,
but not workdir/upperdir for overlays, so it has to be done separately
and strictly before the unit is started, which is annoying. Check the
options when creating directories, and if upper/work directories are
specified, create them.

6 months agoinstall: don't translate unit instances to paths when reenabling them
Frantisek Sumsal [Wed, 6 Dec 2023 15:24:21 +0000 (16:24 +0100)] 
install: don't translate unit instances to paths when reenabling them

For unit instances install_info_discover() returns path to the template,
which then generates confusing errors when passed to
do_unit_file_enable():

~# build/systemctl --root=/tmp/systemctl-test.N9ysbz reenable templ1@two.service
Unit name: templ1@two.service; p: /etc/systemd/system/templ1@.service
Removed "/tmp/systemctl-test.N9ysbz/etc/systemd/system/services.target.wants/templ1@two.service".
Failed to reenable templ1@.service, destination unit services.target is a non-template unit.

This can also be seen with a different reproducer using getty@.service
and a simple bind mount to / - there's no error this time, but it tries
to create a symlink for the default instance (from DefaultInstance=tty1),
which is also incorrect:

~# SYSTEMD_LOG_LEVEL=debug systemctl --root /mnt/bindroot/ reenable getty@test.service
Symlink /mnt/bindroot/etc/systemd/system/getty.target.wants/getty@tty1.service → /usr/lib/systemd/system/getty@.service already exists

Follow-up to: 29a7c59abbe
Resolves: #24740

6 months agocore: relax dependency on RootImage= storage from Requires= to Wants=
Luca Boccassi [Mon, 27 Nov 2023 23:32:31 +0000 (23:32 +0000)] 
core: relax dependency on RootImage= storage from Requires= to Wants=

If a unit is running in an image and wants to survive a soft-reboot,
then it can't be deactivated by the storage of the image going away.
Relax the dependency to a Wants=. Access to the image is not needed
when the unit is running anyway, so downgrade to Wants=.

6 months agocore: do not make private /dev/ read-only too soon
Luca Boccassi [Thu, 7 Dec 2023 22:19:11 +0000 (22:19 +0000)] 
core: do not make private /dev/ read-only too soon

The read-only bit is flipped after setting up all the mounts, so that
bind mounts can be added. Remove the early config, and add a unit
test.

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

6 months agorepart: Re-open file descriptor to partition target after mkfs
Daan De Meyer [Tue, 5 Dec 2023 13:56:00 +0000 (14:56 +0100)] 
repart: Re-open file descriptor to partition target after mkfs

The mkfs binary might unlink the path we give it and replace it with
a new file so let's make sure that our fd points to any new file rather
than the old deleted file.

Specifically this fixes erofs partition generation.

6 months agotmpfiles.d/systemd-nologin.conf: use f+ instead of F (deprecated)
Mike Yuan [Thu, 7 Dec 2023 15:14:35 +0000 (23:14 +0800)] 
tmpfiles.d/systemd-nologin.conf: use f+ instead of F (deprecated)

Fixes #30368

6 months agofirstboot: remove /etc/localtime on --reset
Nick Rosbrook [Thu, 7 Dec 2023 21:21:51 +0000 (16:21 -0500)] 
firstboot: remove /etc/localtime on --reset

The --reset option is supposed to remove all files configured by
firstboot, but currently it does not remove /etc/localtime.

6 months agotest: avoid NO_CAST.INTEGER_OVERFLOW in test-oomd-util (#30365)
aslepykh [Fri, 8 Dec 2023 01:54:52 +0000 (04:54 +0300)] 
test: avoid NO_CAST.INTEGER_OVERFLOW in test-oomd-util (#30365)

The  `.mem_total` variable has `uint64_t` type, therefore, when multiplying the number
`20971512` by the number `1024` with the suffix `U`, we will not get the expected result of
`21,474,828,288`, since the number `20971512` without an explicit type indication has
`uint32_t` type.

First, multiplication will occur in accordance with the `uint32_t` type; this operation will
cause a **type overflow**, and only then will this result be assigned to a `uint64_t` type
variable.

It's worth adding the `UL` suffix to the number `20971512` to avoid **overflow**.

Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author A. Slepykh.

6 months agovarious: don't log synthetic EIO for fwrite
Mike Yuan [Thu, 7 Dec 2023 16:49:17 +0000 (00:49 +0800)] 
various: don't log synthetic EIO for fwrite

Follow-up for f9568765d4d3d57de1ec01d85f0a0682920f4d10

6 months agoman: correct the path for location of "machinectl edit" setting file
Shulhan [Thu, 7 Dec 2023 13:58:58 +0000 (20:58 +0700)] 
man: correct the path for location of "machinectl edit" setting file

The correct path where setting file located should be
"under /etc/systemd/nspawn", not "under /etc".

6 months agoanalyze: dump system config files with highlighted sections/directives 30362/head
Frantisek Sumsal [Thu, 7 Dec 2023 13:44:21 +0000 (14:44 +0100)] 
analyze: dump system config files with highlighted sections/directives

6 months agoshared: highlight directives when dumping configs
Frantisek Sumsal [Thu, 7 Dec 2023 09:52:40 +0000 (10:52 +0100)] 
shared: highlight directives when dumping configs

We already highlight sections and "de-highlight" comments, so let's add
the last piece of the puzzle and highlight the configuration directives
to visually distinguish them from the values.

Closes: #13416
6 months agopackit: don't take ownership of /etc/ssh/sshd_config.d/
Frantisek Sumsal [Thu, 7 Dec 2023 08:36:52 +0000 (09:36 +0100)] 
packit: don't take ownership of /etc/ssh/sshd_config.d/

7e3607996a creates a symlink under /etc/ssh/sshd_config.d/ and with
current Rawhide RPM stuff the systemd RPM tries to take ownership of
that directory which conflicts with the openssh-server package. Let's
temporarily tweak the regex in split-files.py until this changes makes
it to Rawhide.

6 months agoMerge pull request #30060 from poettering/analyze-archs
Yu Watanabe [Thu, 7 Dec 2023 06:47:30 +0000 (15:47 +0900)] 
Merge pull request #30060 from poettering/analyze-archs

analyze: add "archs" verb that lists all known architectures

6 months agojournalctl: don't skip over messages not matching the cursor
Frantisek Sumsal [Tue, 5 Dec 2023 16:38:25 +0000 (17:38 +0100)] 
journalctl: don't skip over messages not matching the cursor

When --after-cursor=/--cursor-file= is used together with a journal
filter, we still skipped over the first matching entry even if it wasn't
the entry the cursor points at, thus missing one "valid" entry
completely. Let's fix this by checking if the entry cursor after seeking
matches the user provided cursor, and skip to the next entry only when
the cursors match.

Resolves: #30288

6 months agoMerge pull request #30312 from yuwata/journal-cleanups
Yu Watanabe [Thu, 7 Dec 2023 04:23:06 +0000 (13:23 +0900)] 
Merge pull request #30312 from yuwata/journal-cleanups

journal: several cleanups

6 months agonspawn: Check later whether to keep/drop CAP_NET_BIND_SERVICE
Daan De Meyer [Tue, 5 Dec 2023 09:24:13 +0000 (10:24 +0100)] 
nspawn: Check later whether to keep/drop CAP_NET_BIND_SERVICE

Currently the check doesn't take any settings from nspawn settings
files into account, so let's delay the check until after we've
loaded any settings file.

6 months agogpt-auto-generator: Pass cryptsetup credentials to cryptsetup
Daan De Meyer [Sun, 3 Dec 2023 19:19:08 +0000 (20:19 +0100)] 
gpt-auto-generator: Pass cryptsetup credentials to cryptsetup

cryptsetup reads a bunch of credentials now but we don't pass import
those in any service units yet. Let's pass through all cryptsetup
prefixed credentials to the systemd-cryptsetup@root instance.

6 months agoMerge pull request #30322 from YHNdnzj/hibernate-improvements
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 21:29:43 +0000 (22:29 +0100)] 
Merge pull request #30322 from YHNdnzj/hibernate-improvements

A few improvements for hibernate-util/hibernate-resume

6 months agoMerge pull request #30316 from mrc0mmand/revert-journal-upload-user
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 21:28:34 +0000 (22:28 +0100)] 
Merge pull request #30316 from mrc0mmand/revert-journal-upload-user

Revert "sysusers.d: create the user for systemd-journal-upload.service"

6 months agoMerge pull request #30302 from keszybz/systemd-edit-stdin
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 21:28:02 +0000 (22:28 +0100)] 
Merge pull request #30302 from keszybz/systemd-edit-stdin

systemctl edit --stdin

6 months agoMerge pull request #30085 from YHNdnzj/networkctl-edit-runtime
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 21:27:01 +0000 (22:27 +0100)] 
Merge pull request #30085 from YHNdnzj/networkctl-edit-runtime

networkctl: introduce --runtime for editing network config under /run/

6 months agoMerge pull request #30271 from YHNdnzj/executor-cloexec
Lennart Poettering [Wed, 6 Dec 2023 21:26:40 +0000 (22:26 +0100)] 
Merge pull request #30271 from YHNdnzj/executor-cloexec

fdset,core/executor: ocloexecification ™️

6 months agoMerge pull request #29987 from yuwata/network-bridge-vlan
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 21:25:42 +0000 (22:25 +0100)] 
Merge pull request #29987 from yuwata/network-bridge-vlan

network: remove unnecessary bridge vlan IDs

6 months agoMerge pull request #29853 from YHNdnzj/sleep-automated
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 21:25:13 +0000 (22:25 +0100)] 
Merge pull request #29853 from YHNdnzj/sleep-automated

logind: support Sleep() that automatically choose a sleep operation

6 months agoMerge pull request #30338 from keszybz/fwrite-error-handling
Lennart Poettering [Wed, 6 Dec 2023 21:24:28 +0000 (22:24 +0100)] 
Merge pull request #30338 from keszybz/fwrite-error-handling

Fix fwrite() error handling

6 months agoREADME.md: irc:// URLs are not rendered as links by markdown on Github
Luca Boccassi [Wed, 6 Dec 2023 18:33:03 +0000 (18:33 +0000)] 
README.md: irc:// URLs are not rendered as links by markdown on Github

Use the webchat link and spell out the channel and server instead

6 months agojournal-gatewayd: add since/until parameters for /entries
Samuel BF [Thu, 5 Oct 2023 19:39:45 +0000 (21:39 +0200)] 
journal-gatewayd: add since/until parameters for /entries

Request with Range header like 'entries=<cursor>:' (with a colon at the end,
invalid syntax per the doc), is now rejected with error 400 Bad Request.

fix #4883

6 months agoudev: generate system-unique storage symlinks using device path
Roland Hieber [Mon, 18 Sep 2023 09:52:06 +0000 (11:52 +0200)] 
udev: generate system-unique storage symlinks using device path

When the same disk image is written to multiple storage units, for
example an external SD card and an internal eMMC, the symlinks in
/dev/disk/by-{label,uuid,partlabel,partuuid}/ are no longer unique, and
will point to the device that is probed last.

Adressing partitions via labels and UUIDs is nice to work with, and
depending on the use case, it might also be more robust than using the
symlinks in /dev/disk/by-path/ containing the partition number. Combine
the two approaches to create unique symlinks containing both the device
path as well as the respective UUIDs or labels, and throw in a symlink
using the devpath and the partition number for the sake of completeness.

For an exemplary GPT-partitioned disk at "platform-2198000.mmc" with a
partition containing an ext4 file system, this might create symlinks of
the following form:

  /dev/disk/by-path/platform-2198000.mmc-part/by-partnum/1
  /dev/disk/by-path/platform-2198000.mmc-part/by-partuuid/e5a75233-3b90-4aec-8075-b4dd7132b48d
  /dev/disk/by-path/platform-2198000.mmc-part/by-partlabel/rootfs
  /dev/disk/by-path/platform-2198000.mmc-part/by-uuid/b2c92f24-8215-4680-b931-f423aae5f1c9
  /dev/disk/by-path/platform-2198000.mmc-part/by-label/rootfs

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
6 months agoMerge pull request #30353 from bluca/news
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 21:20:13 +0000 (22:20 +0100)] 
Merge pull request #30353 from bluca/news

Version bumps

6 months agoanalyze: teach "exit-status" verb json output too 30060/head
Lennart Poettering [Mon, 20 Nov 2023 13:52:31 +0000 (14:52 +0100)] 
analyze: teach "exit-status" verb json output too

6 months agoanalyze: teach "capability" verb JSON output too
Lennart Poettering [Mon, 20 Nov 2023 13:50:56 +0000 (14:50 +0100)] 
analyze: teach "capability" verb JSON output too

6 months agoanalyze: add "architectures" verb that lists all known architectures
Lennart Poettering [Thu, 16 Nov 2023 15:08:15 +0000 (16:08 +0100)] 
analyze: add "architectures" verb that lists all known architectures

6 months agosystemctl-whoami: use pidfd to refer to processes
Mike Yuan [Sat, 25 Nov 2023 14:10:16 +0000 (22:10 +0800)] 
systemctl-whoami: use pidfd to refer to processes

While at it, rephrase the output a bit. Before this commit, if
the pid doesn't exist, we output something hard to interpret -
"Failed to get unit for ourselves".

6 months agoMerge pull request #30101 from poettering/underline-rework
Lennart Poettering [Wed, 6 Dec 2023 21:13:12 +0000 (22:13 +0100)] 
Merge pull request #30101 from poettering/underline-rework

systemctl: "list-units" table tweaks

6 months agorecurse-dir: add new readdir_all_at() helper
Lennart Poettering [Wed, 22 Nov 2023 09:55:20 +0000 (10:55 +0100)] 
recurse-dir: add new readdir_all_at() helper

This new helper combines open() with readdir_all() to simplify a few
callers.

6 months agoMerge pull request #30295 from yuwata/hostnamectl-machine-id
Luca Boccassi [Wed, 6 Dec 2023 21:12:36 +0000 (21:12 +0000)] 
Merge pull request #30295 from yuwata/hostnamectl-machine-id

hostnamectl: read machine ID and boot ID through DBus

6 months agoMerge pull request #30183 from poettering/nlcr
Lennart Poettering [Wed, 6 Dec 2023 21:12:17 +0000 (22:12 +0100)] 
Merge pull request #30183 from poettering/nlcr

NL → CRNL conversion fixes when logging at the same time as ptyfwd runs

6 months agoshow-status: suffix output ith CRNL rather than just NL
Lennart Poettering [Fri, 24 Nov 2023 15:41:47 +0000 (16:41 +0100)] 
show-status: suffix output ith CRNL rather than just NL

This is similar to #30183 but focusses on the status output rather than
the log output.

Since the status output always goes to a TTY we don't have to
conditionalize things on isatty().

Fixes: #30184
6 months agouser-util: add new helper fully_set_uid_gid()
Lennart Poettering [Wed, 29 Nov 2023 16:45:06 +0000 (17:45 +0100)] 
user-util: add new helper fully_set_uid_gid()

Usually when we do setresuid() we also do setesgid() and setgroups().
Let's add a common helper that does all three, and use it everywhere.

6 months agomime: register confext/sysext images in shared-mime-info
Lennart Poettering [Mon, 20 Nov 2023 10:51:47 +0000 (11:51 +0100)] 
mime: register confext/sysext images in shared-mime-info

This make them recognized by file managers and stuff. Maybe one day we
should properly register mime types in the "vnd." namespace with IANA,
but I am too lazy to deal with the bureaucracy for that, hence let's
stick with the x. namespace for now.

This defines confext/sysext DDIs as subtype of:

https://www.iana.org/assignments/media-types/application/vnd.efi.img

Which is what everyone appears to use for raw disk images, in particular
if they contain a GPT partition table.

6 months agouserdbctl: enable ssh-authorized-keys logic by default
Lennart Poettering [Thu, 16 Nov 2023 17:47:52 +0000 (18:47 +0100)] 
userdbctl: enable ssh-authorized-keys logic by default

sshd now supports config file drop-ins, hence let's install one to hook
up "userdb ssh-authorized-keys", so that things just work.

We put the drop-in relatively early, so that other drop-ins generally
will override this.

Ideally sshd would support such drop-ins in /usr/ rather than /etc/, but
let's take what we can get. It's not that sshd's upstream was
particularly open to weird ideas from Linux people.

6 months agopid1: add ProtectSystem= as system-wide configuration, and default it to true in...
Lennart Poettering [Wed, 29 Nov 2023 17:52:28 +0000 (18:52 +0100)] 
pid1: add ProtectSystem= as system-wide configuration, and default it to true in the initrd

This adds a new ProtectSystem= setting that mirrors the option of the
same of services, but in a more restrictive way. If enabled will remount
/usr/ to read-only, very early at boot. Takes a special value "auto"
(which is the default) which is equivalent to true in the initrd, and
false otherwise.

Unlike the per-service option we don't support full/strict modes, but
the door is open to eventually support that too if it makes sense. It's
not entirely trivial though as we have very little mounted this early,
and hence the mechanism might not apply 1:1. Hence in this PR is a
conservative first step.

My primary goal with this is to lock down initrds a bit, since they
conceptually are mostly immutable, but they are unpacked into a mutable
tmpfs. let's tighten the screws a bit on that, and at least make /usr/
immutable.

This is particularly nice on USIs (i.e. Unified System Images, that pack
a whole OS into a UKI without transitioning out of it), such as
diskomator.

6 months agoRELEASE: mark a few items for the final step 30353/head
Luca Boccassi [Wed, 6 Dec 2023 21:07:42 +0000 (21:07 +0000)] 
RELEASE: mark a few items for the final step

Doesn't make much sense to push RCs to the stable repository, just
do that in the final tag push

6 months agoMerge pull request #30241 from poettering/journalctl-short-file-switch
Daan De Meyer [Wed, 6 Dec 2023 21:07:41 +0000 (22:07 +0100)] 
Merge pull request #30241 from poettering/journalctl-short-file-switch

journalctl: add short option "-i" for "--file="

6 months agoNEWS: open for v256
Luca Boccassi [Wed, 6 Dec 2023 21:07:16 +0000 (21:07 +0000)] 
NEWS: open for v256

6 months agocoredump: keep core files for two weeks
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2023 14:56:54 +0000 (15:56 +0100)] 
coredump: keep core files for two weeks

We have two mechanisms that remove old coredumps: systemd-coredump has
parameters based on disk use / remaining disk free, and systemd-tmpfiles does
cleanup based on time. The first mechanism should prevent us from using too much
disk space in case something is crashing continuously or there are very large
core files.

The limit of 3 days makes it likely that the core file will be gone by the time
the admin looks at the issue. E.g. if something crashes on Friday, the coredump
would likely be gone before people are back on Monday to look at it.

6 months agocore: add specifier expansion to AllowedCPUs= and friends
Alan Liang [Sun, 3 Dec 2023 05:49:06 +0000 (13:49 +0800)] 
core: add specifier expansion to AllowedCPUs= and friends

6 months agonetwork/networkd-address: don't set up firewall rules here
Topi Miettinen [Mon, 4 Dec 2023 19:49:12 +0000 (21:49 +0200)] 
network/networkd-address: don't set up firewall rules here

Don't set up firewall rules when we're just initializing the firewall context
for NFT sets.

Fixes: #30257
6 months agoshared/killall: correctly warn about rootfs daemon's root
Mike Yuan [Sat, 2 Dec 2023 07:23:51 +0000 (15:23 +0800)] 
shared/killall: correctly warn about rootfs daemon's root

Follow-up for 9e615117dab5ede72eec22bf6369e0138f9dace5

We'll typically send signals to all remaining processes in the following
cases:

1. pid1 (in initrd) when transitioning from initrd to sysroot: SIGTERM
2. pid1 (in sysroot) before transitioning back to initrd (exitrd): SIGTERM + SIGKILL
3. systemd-shutdown (in exitrd): SIGTERM + SIGKILL

'warn_rootfs' is set to true only when we're not in initrd and we're
sending SIGKILL, which means the second case. So, we want to emit the
warning when the root of the storage daemon IS the same as that of pid1,
rather than the other way around.

The condition is spuriously reversed in the offending commit.

6 months agologinctl: show a nicer error message when no session/seat is available
Frantisek Sumsal [Wed, 6 Dec 2023 10:03:06 +0000 (11:03 +0100)] 
loginctl: show a nicer error message when no session/seat is available

When calling loginctl {seat,session}-status without arguments, show a nicer
error message in case there's no suitable session/seat attached to the calling
tty.

Before:
~# loginctl seat-status
Could not get properties: Unknown object '/org/freedesktop/login1/seat/auto'.
~# systemd-run -q -t loginctl seat-status
Could not get properties: Unknown object '/org/freedesktop/login1/seat/auto'.
~# systemd-run -q -t loginctl session-status
Could not get properties: Unknown object '/org/freedesktop/login1/session/auto'.

After:
~# build/loginctl seat-status
Failed to get path for seat 'auto': Session '1' has no seat.
~# systemd-run -q -t build/loginctl seat-status
Failed to get path for seat 'auto': Caller does not belong to any known session and doesn't own any suitable session.
~# systemd-run -q -t build/loginctl session-status
Failed to get path for session 'auto': Caller does not belong to any known session and doesn't own any suitable session.

Resolves: #25199

6 months agoMerge pull request #30340 from yuwata/repart-error-handling-ftruncate
Daan De Meyer [Wed, 6 Dec 2023 21:02:01 +0000 (22:02 +0100)] 
Merge pull request #30340 from yuwata/repart-error-handling-ftruncate

repart: fix coding style of error handling

6 months agoMerge pull request #30343 from keszybz/ukify-genkey
Daan De Meyer [Wed, 6 Dec 2023 21:01:41 +0000 (22:01 +0100)] 
Merge pull request #30343 from keszybz/ukify-genkey

Raise error if 'ukify genkey' is called with no output arguments

6 months agoMerge pull request #30332 from bluca/softreboot_pivot_in_place
Luca Boccassi [Wed, 6 Dec 2023 21:01:13 +0000 (21:01 +0000)] 
Merge pull request #30332 from bluca/softreboot_pivot_in_place

switch-root: also check that mount IDs are the same, not just inodes

6 months agoMerge pull request #30214 from bluca/wants_mounts_for
Luca Boccassi [Wed, 6 Dec 2023 21:00:37 +0000 (21:00 +0000)] 
Merge pull request #30214 from bluca/wants_mounts_for

Add WantsMountsFor= and use it in the cryptsetup generator

6 months agoNEWS: finalize for v255 v255
Luca Boccassi [Wed, 6 Dec 2023 20:32:40 +0000 (20:32 +0000)] 
NEWS: finalize for v255

6 months agoMerge pull request #30334 from DaanDeMeyer/repart-fixes
Luca Boccassi [Wed, 6 Dec 2023 20:29:04 +0000 (20:29 +0000)] 
Merge pull request #30334 from DaanDeMeyer/repart-fixes

repart: Add Minimize=best to --make-ddi= partition definitions

6 months agoREADME: mention Matrix channel
Lennart Poettering [Wed, 6 Dec 2023 18:20:35 +0000 (19:20 +0100)] 
README: mention Matrix channel

6 months agoMerge pull request #30341 from bluca/news
Luca Boccassi [Wed, 6 Dec 2023 16:57:29 +0000 (16:57 +0000)] 
Merge pull request #30341 from bluca/news

Update hwdb and NEWS

6 months agohostname: expose machine ID and boot ID through DBus 30295/head
Yu Watanabe [Sat, 2 Dec 2023 10:26:29 +0000 (19:26 +0900)] 
hostname: expose machine ID and boot ID through DBus

Fixes #30293.

6 months agohostnamectl: do not show local machine ID and boot ID when requested to show informat...
Yu Watanabe [Sat, 2 Dec 2023 10:14:35 +0000 (19:14 +0900)] 
hostnamectl: do not show local machine ID and boot ID when requested to show information about remote host

Prompted by #30293.

6 months agotest: Add test case for --make-ddi=sysext 30334/head
Daan De Meyer [Wed, 6 Dec 2023 11:18:32 +0000 (12:18 +0100)] 
test: Add test case for --make-ddi=sysext

Also make sure that the sysext is big enough to not fit in the
minimum partition size so we know Minimize= is being used.

6 months agorepart: Add Minimize=best to --make-ddi= partition definitions
Daan De Meyer [Tue, 5 Dec 2023 13:56:15 +0000 (14:56 +0100)] 
repart: Add Minimize=best to --make-ddi= partition definitions

Otherwise, repart won't calculate the minimal size of the partition
automatically and things will fail once the partitions exceed the
minimal partition size (10M).

6 months agoukify: raise error if genkey is called with no output arguments 30343/head
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 10:41:56 +0000 (11:41 +0100)] 
ukify: raise error if genkey is called with no output arguments

The idea is that genkey is called with either
--secureboot-private-key= + --secureboot-certificate=, and then it
writes those, or with --pcr-private-key + optionally --pcr-public-key
and then it writes those, or both. But when called with no arguments
whatsover, it did nothing.

There is no implicit value for any of those parameters as input (unlike in
mkosi), so we also don't want to have implicit values when used as output.
But we shouldn't return success if no work was done, this is quite confusing.

6 months agoukify: remove stray line
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 10:31:16 +0000 (11:31 +0100)] 
ukify: remove stray line

As requested in review.

6 months agoukify: add test for --secureboot-certificate-validity=
Zbigniew Jędrzejewski-Szmek [Wed, 6 Dec 2023 10:29:54 +0000 (11:29 +0100)] 
ukify: add test for --secureboot-certificate-validity=

Follow-up for bf35f9c83541785726dce41e54496a07f4841621.

6 months agohwdb: update 30341/head
Luca Boccassi [Wed, 6 Dec 2023 10:06:50 +0000 (10:06 +0000)] 
hwdb: update

ninja -C build update-hwdb

6 months agoNEWS: note that newly introduced tools are experimental
Luca Boccassi [Wed, 6 Dec 2023 10:00:25 +0000 (10:00 +0000)] 
NEWS: note that newly introduced tools are experimental

So that we can change interfaces for at least one release if needed

6 months agoNEWS: update contributors list
Luca Boccassi [Wed, 6 Dec 2023 09:57:38 +0000 (09:57 +0000)] 
NEWS: update contributors list

6 months agoukify: fix handling of --secureboot-certificate-validity= (#30315)
Roland Singer [Wed, 6 Dec 2023 09:49:47 +0000 (10:49 +0100)] 
ukify: fix handling of  --secureboot-certificate-validity= (#30315)

Before:
$ python src/ukify/ukify.py genkey --secureboot-private-key=sb2.key --secureboot-certificate=sb2.cert --secureboot-certificate-validity=111
Traceback (most recent call last):
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 1660, in <module>
    main()
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 1652, in main
    generate_keys(opts)
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 943, in generate_keys
    key_pem, cert_pem = generate_key_cert_pair(
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zbyszek/src/systemd-work/src/ukify/ukify.py", line 891, in generate_key_cert_pair
    now + ONE_DAY * valid_days
          ~~~~~~~~^~~~~~~~~~~~
TypeError: can't multiply sequence by non-int of type 'datetime.timedelta'

Now:
$ python src/ukify/ukify.py genkey --secureboot-private-key=sb2.key --secureboot-certificate=sb2.cert --secureboot-certificate-validity=111
Writing SecureBoot private key to sb2.key
Writing SecureBoot certificate to sb2.cert

The new code is also clearer.

6 months agorepart: use correct errno
Mike Yuan [Tue, 5 Dec 2023 13:53:51 +0000 (21:53 +0800)] 
repart: use correct errno

6 months agorepart: fix coding style of error handling 30340/head
Yu Watanabe [Wed, 6 Dec 2023 02:34:11 +0000 (11:34 +0900)] 
repart: fix coding style of error handling

Follow-up for c4a87b76c3e5f74f62d4431b85e7c5f71add3916.

6 months agojournal: use sd_event_now() 30312/head
Yu Watanabe [Tue, 5 Dec 2023 05:23:48 +0000 (14:23 +0900)] 
journal: use sd_event_now()

6 months agojournal: use usec_add() and usec_sub_unsigned()
Yu Watanabe [Mon, 4 Dec 2023 07:19:47 +0000 (16:19 +0900)] 
journal: use usec_add() and usec_sub_unsigned()

6 months agojournal: add short comment for boolean arguments
Yu Watanabe [Mon, 4 Dec 2023 07:12:45 +0000 (16:12 +0900)] 
journal: add short comment for boolean arguments

6 months agojournal: split out server_new() from server_init()
Yu Watanabe [Mon, 4 Dec 2023 07:06:20 +0000 (16:06 +0900)] 
journal: split out server_new() from server_init()

Then, use DEFINE_MAIN_FUNCTION() macro in journald.
No functional change, just refactoring to follow our usual coding style.

6 months agotest: load the io controller before checking if io.latency exists
Frantisek Sumsal [Tue, 5 Dec 2023 11:22:20 +0000 (12:22 +0100)] 
test: load the io controller before checking if io.latency exists

Otherwise the following test gets always skipped.

6 months agorepart: Fix sysext definitions for --make-ddi=
Daan De Meyer [Tue, 5 Dec 2023 10:21:15 +0000 (11:21 +0100)] 
repart: Fix sysext definitions for --make-ddi=

CopyFiles= does not support multiple directories separated by
whitespace. Instead the setting has to be specified multiple times.

6 months agoselinux: downgrade log about state to trace
Luca Boccassi [Tue, 5 Dec 2023 11:53:31 +0000 (11:53 +0000)] 
selinux: downgrade log about state to trace

It is printed on every invocation of sd-executor, which is noisy and not useful

Follow-up for: bb5232b6a3b8a

6 months agosd-journal/catalog: modernize write_catalog() 30338/head
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2023 18:17:20 +0000 (19:17 +0100)] 
sd-journal/catalog: modernize write_catalog()

6 months agonetworkd: unvoidify fwrite()
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2023 18:03:26 +0000 (19:03 +0100)] 
networkd: unvoidify fwrite()

Those were the only two places we did that, so for consistency it's better
to drop it.

6 months agovariuos: fwrite() does not set errno
Zbigniew Jędrzejewski-Szmek [Tue, 5 Dec 2023 18:02:14 +0000 (19:02 +0100)] 
variuos: fwrite() does not set errno

The man page doesn't even mention errno. It just says that ferror() should
be used to check for errors. Those writes are unlikely to fail, but if they
do, errno might even be 0. Also, we have fflush_and_check() which does
additional paranoia around errno, because we apparently do not trust that
errno will always be set correctly.

6 months agoTEST-26: add test for systemctl edit --stdin 30302/head
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2023 16:15:13 +0000 (17:15 +0100)] 
TEST-26: add test for systemctl edit --stdin

6 months agosystemctl: add "edit --stdin"
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2023 15:25:15 +0000 (16:25 +0100)] 
systemctl: add "edit --stdin"

This is a fancy wrapper around "cat <<EOF", but:
- the user doesn't need to figure out the file name,
- parent directories are created automatically,
- daemon-reload is implied,
so it's a convenient way to create units or drop-ins.

Closes https://github.com/systemd/systemd/issues/21862.

6 months agoswitch-root: also check that mount IDs are the same, not just inodes 30332/head
Luca Boccassi [Tue, 5 Dec 2023 15:43:12 +0000 (15:43 +0000)] 
switch-root: also check that mount IDs are the same, not just inodes

If /run/nextroot/ has been set up, use it, even if the inodes are
the same. It could be a verity device that is reused, but with
different sub-mounts or other differences. Or the same / tmpfs with
different /usr/ mounts. If it was explicitly set up we should use it.

Use the new helper to check that the mount IDs are also the same,
not just the inodes.

6 months agobasic: add fds_are_same_mount() helper
Luca Boccassi [Tue, 5 Dec 2023 15:32:30 +0000 (15:32 +0000)] 
basic: add fds_are_same_mount() helper

6 months agosystemctl: add message when edit is aborted
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2023 15:41:46 +0000 (16:41 +0100)] 
systemctl: add message when edit is aborted

If the user edits result in an empty file (after stripping), we would silently
not do anything, aborting the edit. This is rather confusing, let's emit a
notice:

  $ build/systemctl --user edit asdf.service --full --stdin </dev/null
  /home/zbyszek/.config/systemd/user/asdf.service: after editing, new contents are empty, not writing file.

(This also works with an editor, instead of --stdin. The message is printed on
the console and is visible after the editor exits.)

While at it, fix the condition to skip writing file after stripping. We had
"old_contents", but we modified that string. In some code flows, we would
compare the stripped old contents (i.e. a string which by defintion doesn't
have a newline at the end) with a string to which we just appended a newline
(i.e. a string which by defintion has a newline at the end).

6 months agoshared/edit-util: split out function to populate temp file
Zbigniew Jędrzejewski-Szmek [Sat, 2 Dec 2023 15:06:56 +0000 (16:06 +0100)] 
shared/edit-util: split out function to populate temp file

In preparation for future changes: I want to add a mode where interactive
editing is not done, and when this preparation is moved to a helper, it's much
easier to skip it.

e->line is initialized to 1 and overwritten even if sync fails. Theoretically
this is against our style, but the alternative is to propagate a temporary
value of line through the layers, which adds a lot of noise. If we fail, this
EditFile object will not be used for anything, to the changed value of .line
has no effect.

6 months agobasic: fix typo
Yu Watanabe [Tue, 5 Dec 2023 14:50:25 +0000 (23:50 +0900)] 
basic: fix typo

6 months agosystemctl: add support for Sleep() logind call 29853/head
Mike Yuan [Fri, 3 Nov 2023 13:25:42 +0000 (21:25 +0800)] 
systemctl: add support for Sleep() logind call

6 months agologind: introduce Sleep() call and action that automatically choose a sleep operation
Mike Yuan [Thu, 2 Nov 2023 17:11:55 +0000 (01:11 +0800)] 
logind: introduce Sleep() call and action that automatically choose a sleep operation

6 months agologind: test: make sure string of HandleAction and SleepOperation match
Mike Yuan [Thu, 2 Nov 2023 17:07:26 +0000 (01:07 +0800)] 
logind: test: make sure string of HandleAction and SleepOperation match

6 months agologind: put more struct members into designated initializer
Mike Yuan [Fri, 3 Nov 2023 18:06:28 +0000 (02:06 +0800)] 
logind: put more struct members into designated initializer

6 months agologind: take HandleAction instead of HandleActionData at several places
Mike Yuan [Thu, 2 Nov 2023 16:19:23 +0000 (00:19 +0800)] 
logind: take HandleAction instead of HandleActionData at several places

Preparation for addition of HANDLE_SLEEP.