1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-11 20:58:27 +03:00

69238 Commits

Author SHA1 Message Date
Yu Watanabe
2b2f192a0e
Merge pull request from mrc0mmand/cat-highlight-directives
shared: highlight directives when dumping configs
2023-12-09 18:54:46 +09:00
Zbigniew Jędrzejewski-Szmek
ba056e146a 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] 245a2587e0
2023-12-08 19:12:19 +00:00
Daan De Meyer
4ae703b2b5 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.
2023-12-08 09:33:24 +01:00
Luca Boccassi
6c75eff6af 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.
2023-12-08 11:22:14 +09:00
Frantisek Sumsal
fe6e0cfa19 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: 
2023-12-08 11:20:12 +09:00
Luca Boccassi
ebc7510380 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=.
2023-12-08 11:16:31 +09:00
Luca Boccassi
ae7482b994 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
2023-12-08 11:09:14 +09:00
Daan De Meyer
0122c7d060 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.
2023-12-08 10:59:36 +09:00
Mike Yuan
3b25958e64 tmpfiles.d/systemd-nologin.conf: use f+ instead of F (deprecated)
Fixes 
2023-12-08 10:58:05 +09:00
Nick Rosbrook
cd3207491d 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.
2023-12-08 10:57:23 +09:00
aslepykh
a6f1551fe7
test: avoid NO_CAST.INTEGER_OVERFLOW in test-oomd-util ()
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.
2023-12-08 10:54:52 +09:00
Mike Yuan
513412a69c various: don't log synthetic EIO for fwrite
Follow-up for f9568765d4d3d57de1ec01d85f0a0682920f4d10
2023-12-08 10:49:08 +09:00
Shulhan
59b13e07f2 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".
2023-12-07 14:51:05 +00:00
Frantisek Sumsal
f57d06c308 analyze: dump system config files with highlighted sections/directives 2023-12-07 15:35:54 +01:00
Frantisek Sumsal
22b0b7bfbf 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: 
2023-12-07 15:35:54 +01:00
Frantisek Sumsal
9f7d189923 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.
2023-12-07 10:30:44 +00:00
Yu Watanabe
786a337817
Merge pull request from poettering/analyze-archs
analyze: add "archs" verb that lists all known architectures
2023-12-07 15:47:30 +09:00
Frantisek Sumsal
4207a5577a 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: 
2023-12-07 13:31:25 +09:00
Yu Watanabe
65cf964662
Merge pull request from yuwata/journal-cleanups
journal: several cleanups
2023-12-07 13:23:06 +09:00
Daan De Meyer
dd78141c53 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.
2023-12-06 23:07:26 +00:00
Daan De Meyer
b952663cd1 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.
2023-12-06 23:37:32 +01:00
Zbigniew Jędrzejewski-Szmek
d50bf46f19
Merge pull request from YHNdnzj/hibernate-improvements
A few improvements for hibernate-util/hibernate-resume
2023-12-06 22:29:43 +01:00
Zbigniew Jędrzejewski-Szmek
0d08149801
Merge pull request from mrc0mmand/revert-journal-upload-user
Revert "sysusers.d: create the user for systemd-journal-upload.service"
2023-12-06 22:28:34 +01:00
Zbigniew Jędrzejewski-Szmek
34f4fcb59f
Merge pull request from keszybz/systemd-edit-stdin
systemctl edit --stdin
2023-12-06 22:28:02 +01:00
Zbigniew Jędrzejewski-Szmek
fd72d1e794
Merge pull request from YHNdnzj/networkctl-edit-runtime
networkctl: introduce --runtime for editing network config under /run/
2023-12-06 22:27:01 +01:00
Lennart Poettering
4482ea0c24
Merge pull request from YHNdnzj/executor-cloexec
fdset,core/executor: ocloexecification ™️
2023-12-06 22:26:40 +01:00
Zbigniew Jędrzejewski-Szmek
bfa95c369a
Merge pull request from yuwata/network-bridge-vlan
network: remove unnecessary bridge vlan IDs
2023-12-06 22:25:42 +01:00
Zbigniew Jędrzejewski-Szmek
d1f9a39ef4
Merge pull request from YHNdnzj/sleep-automated
logind: support Sleep() that automatically choose a sleep operation
2023-12-06 22:25:13 +01:00
Lennart Poettering
4cb8f4abd4
Merge pull request from keszybz/fwrite-error-handling
Fix fwrite() error handling
2023-12-06 22:24:28 +01:00
Luca Boccassi
012789399e 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
2023-12-06 22:23:16 +01:00
Samuel BF
435c372ce5 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 
2023-12-06 22:22:27 +01:00
Roland Hieber
3af66c089b 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>
2023-12-06 22:22:08 +01:00
Zbigniew Jędrzejewski-Szmek
27e6681f08
Merge pull request from bluca/news
Version bumps
2023-12-06 22:20:13 +01:00
Lennart Poettering
bf4ffc43c5 analyze: teach "exit-status" verb json output too 2023-12-06 22:18:14 +01:00
Lennart Poettering
81373a0e28 analyze: teach "capability" verb JSON output too 2023-12-06 22:18:14 +01:00
Lennart Poettering
fb8cc599ed analyze: add "architectures" verb that lists all known architectures 2023-12-06 22:18:14 +01:00
Mike Yuan
fb45185d98 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".
2023-12-06 21:15:38 +00:00
Lennart Poettering
cbc51d0cf4
Merge pull request from poettering/underline-rework
systemctl: "list-units" table tweaks
2023-12-06 22:13:12 +01:00
Lennart Poettering
4d56442755 recurse-dir: add new readdir_all_at() helper
This new helper combines open() with readdir_all() to simplify a few
callers.
2023-12-06 22:12:48 +01:00
Luca Boccassi
f08d1fea30
Merge pull request from yuwata/hostnamectl-machine-id
hostnamectl: read machine ID and boot ID through DBus
2023-12-06 21:12:36 +00:00
Lennart Poettering
dc7a49ed25
Merge pull request from poettering/nlcr
NL → CRNL conversion fixes when logging at the same time as ptyfwd runs
2023-12-06 22:12:17 +01:00
Lennart Poettering
936fcc4668 show-status: suffix output ith CRNL rather than just NL
This is similar to  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: 
2023-12-06 22:11:54 +01:00
Lennart Poettering
6498a0c2cc 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.
2023-12-06 22:11:38 +01:00
Lennart Poettering
eb981a5b9b 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.
2023-12-06 22:11:21 +01:00
Lennart Poettering
7e3607996a 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.
2023-12-06 22:11:04 +01:00
Lennart Poettering
ffc1ec73b3 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.
2023-12-06 22:10:20 +01:00
Luca Boccassi
0065f4b142 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
2023-12-06 21:07:42 +00:00
Daan De Meyer
8e3dc737b2
Merge pull request from poettering/journalctl-short-file-switch
journalctl: add short option "-i" for "--file="
2023-12-06 22:07:41 +01:00
Luca Boccassi
880eaa3a62 NEWS: open for v256 2023-12-06 21:07:16 +00:00
Zbigniew Jędrzejewski-Szmek
f8d67130b8 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.
2023-12-06 22:05:20 +01:00