1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-27 01:57:35 +03:00

69454 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
6bc99ec29b test_ukify: raise timeout
With a sufficiently large initrd, the tests take 25 s on my laptop.
Normally, they'd be quicker, but since we use what we find on the
system, we don't control this. Let's raise the timeout to reduce the
chances of a spurious failure.
2023-12-08 19:17:40 +01:00
Zbigniew Jędrzejewski-Szmek
fd9ccc07a6 test_ukify: formatting 2023-12-08 19:17:40 +01:00
Zbigniew Jędrzejewski-Szmek
ef0a69eb90 test_ukify: explicitly remove big temporary directories
pytest intentionally keeps around a limited number of the previous test
temporary directories [1]. This is generally OK, but in our tests that generate
initrds, we create a few very large files (both the initrd and kernel in a few
copies), which quickly adds up. I had a particularly large initrd (because of
some mkosi-initrd shenanigans), and I unded up with dozens of gigabytes of
temporary files from the tests. Let's just nuke the dirs where we write
kernel data.

[1] https://github.com/pytest-dev/pytest/issues/543
2023-12-08 19:17:40 +01:00
Zbigniew Jędrzejewski-Szmek
6f1df1ff3c test_ukify: use Path-based fixtures
Quoting https://docs.pytest.org/en/stable/how-to/tmp_path.html#the-default-base-temporary-directory:
> The tmpdir and tmpdir_factory fixtures are similar to tmp_path and
> tmp_path_factory, but use/return legacy py.path.local objects rather than
> standard pathlib.Path objects.
>
> These days, it is preferred to use tmp_path and tmp_path_factory.
2023-12-08 19:17:40 +01:00
Frantisek Sumsal
e23fc070e2 test: backup /etc/udev/udev.conf only if it exists
On Fedora systemd recently moved all of its configuration files to
/usr/lib/ [0], so make sure we account for this case as well.

[   42.450325] testsuite-17.sh[800]: + mkdir -p /run/udev/rules.d
[   42.466504] testsuite-17.sh[800]: + cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp
[   42.503348] testsuite-17.sh[802]: cp: cannot stat '/etc/udev/udev.conf': No such file or directory

[0] 29eb35530b
2023-12-08 18:38:41 +01:00
Frantisek Sumsal
ad23ff13de test: reset systemd-udevd.service restart counter
Since we restart systemd-udevd here a couple of times, we might hit the
rate limit in later tests:

[   26.028355] testsuite-17.sh[2074]: + udevadm control -e
[   26.028355] testsuite-17.sh[2074]: + udevadm control -l emerg
[   26.126160] systemd[1]: systemd-udevd.service: Start request repeated too quickly.
[   26.126213] systemd[1]: systemd-udevd.service: Failed with result 'start-limit-hit'.
[   26.140310] systemd[1]: Failed to start systemd-udevd.service.
[   26.140897] systemd[1]: systemd-udevd-control.socket: Failed with result 'service-start-limit-hit'.
[   26.141286] systemd[1]: systemd-udevd-kernel.socket: Failed with result 'service-start-limit-hit'.
[   26.142225] testsuite-17.sh[2074]: + udevadm control -l alert
[   26.149206] udevadm[2088]: Failed to send request to set log level: No such file or directory

Follow-up to: 6ef512c0bb
2023-12-08 18:14:05 +01:00
Mike Yuan
b041175e08
core/executor: save argv for later use by rename_process()
Partially fixes #30352
2023-12-08 21:49:27 +08:00
Mike Yuan
c0e82e3a23
core/exec-invoke: voidify one rename_process call 2023-12-08 19:46:53 +08: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: #24740
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 #30368
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 (#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.
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
Yu Watanabe
470a329d98 test-network: add test for small MTU for vcan
Prompted by https://github.com/systemd/systemd/issues/30140#issuecomment-1837973580.
2023-12-08 10:47:42 +09:00
Yu Watanabe
941f8e1399 network: allow to configure interface MTU for CAN devices
Previously, even if MTUBytes= is specified in matching .network file,
the setting was ignored for CAN devices.
2023-12-08 10:47:42 +09:00
Yu Watanabe
15be804282 network: the maximum MTU size for CAN interface may be changed later
So we should not reduce the requested size to the current maximum
before applying CAN FD mode.
2023-12-08 10:47:42 +09:00
Yu Watanabe
a60cc587d4 network: update MTU after CAN specific configs applied
Changing FD mode may trigger change of MTU and maximum MTU size.
See kernel documents about CAN FD mode:
https://docs.kernel.org/networking/can.html#can-fd-flexible-data-rate-driver-support
2023-12-08 10:47:42 +09:00
Yu Watanabe
a0460dfed6 parse-util: accept arbitrary MTU size when AF_UNSPEC
When [Link] MTU= is specified in a .network file, we have no idea about
that what kind of interface will be configured with the .network file.
The maximum and minimum MTU size depend on the kind of interface.
So, we should not filter MTU eagerly in the parser.

Closes #30140.
2023-12-08 10:47:42 +09:00
Yu Watanabe
f43ce810c4 network: do not try to update IP sysctl settings for CAN devices
CAN devices do not support IP layer.

Most of the functions below are never called for CAN devices, but
link_set_ipv6_mtu() may be called after setting interface MTU, and warn
about the failure.

For safety, let's unconditionally check if the interface is not a CAN
device.
2023-12-08 10:47:42 +09:00
Yu Watanabe
01a88375e3 network: split out common checks
No functional change, just refactoring.
Note, some checks may be redundant, but the cost is not heavy, so let's
explicitly check for safety.
2023-12-08 10:47:42 +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: #13416
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 #30060 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: #30288
2023-12-07 13:31:25 +09:00
Yu Watanabe
65cf964662
Merge pull request #30312 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 #30322 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 #30316 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 #30302 from keszybz/systemd-edit-stdin
systemctl edit --stdin
2023-12-06 22:28:02 +01:00
Zbigniew Jędrzejewski-Szmek
fd72d1e794
Merge pull request #30085 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 #30271 from YHNdnzj/executor-cloexec
fdset,core/executor: ocloexecification ™️
2023-12-06 22:26:40 +01:00
Zbigniew Jędrzejewski-Szmek
bfa95c369a
Merge pull request #29987 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 #29853 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 #30338 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 #4883
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 #30353 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