1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-14 05:57:40 +03:00

66171 Commits

Author SHA1 Message Date
Yu Watanabe
bd96111d5f fd-util: make path_is_root_at() not fail even when /proc is mounted
path_get_mnt_id_at() -> fd_fdinfo_mnt_id() may return -EOPNOTSUPP when
/proc is mounted, and -ENOSYS otherwise, when an old kernel is used.
2023-07-22 02:20:27 +09:00
Yu Watanabe
7487115766 mountpoint-util: statx() may return EINVAL if the kernel does not support the syscall
When statx() is called with AT_STATX_DONT_SYNC, glibc's fallback code
returns EINVAL. See statx_generic() in glibc.
2023-07-22 02:20:22 +09:00
Yu Watanabe
d35ff4b60e stat-util: fix error handling of statx()
When newer glibc is used, but kernel does not support statx(), then
glibc try to fallback with fstatat(). That's quite similar to our
implementation, but the supported flags are different, and if
unsupported flags are specified, it returns EINVAL.

Let's handle the case more gracefully.
2023-07-22 02:14:54 +09:00
Zbigniew Jędrzejewski-Szmek
671903b315
Merge pull request #28436 from rpigott/zsh-fixups
zsh systemctl completion fixups
2023-07-21 19:13:53 +02:00
Luca Boccassi
b80fc61e89 core: add IgnoreOnSoftReboot= unit option
As it says on the tin, configures the unit to survive a soft reboot.
Currently all the following options have to be set by hand:

Conflicts=reboot.target kexec.target poweroff.target halt.target
Before=reboot.target kexec.target poweroff.target halt.target
After=sysinit.target basic.target
DefaultDependencies=no
IgnoreOnIsolate=yes

This is not very user friendly. If new default dependencies are added,
or new shutdown/reboot types, they also have to be added manually.

The new option is much simpler, easy to find, and does the right thing
by default.
2023-07-21 18:05:41 +02:00
Zbigniew Jędrzejewski-Szmek
03d298e1e5
Merge pull request #28460 from bluca/scope_run_env
run: disable --expand-environment by default for --scope
2023-07-21 15:41:56 +02:00
Daan De Meyer
776be5964d mkfs-util: Escape spaces with slashes in protofile format 2023-07-21 15:35:50 +02:00
Yu Watanabe
dc8b82a5b4 test-ukify: use systemd-measure and bootctl in build directory
And skip tests if systemd-measure is not found.
Then, we can safely run test_ukify.py directly.
2023-07-21 15:32:02 +02:00
Daan De Meyer
ce8b4261eb xfs: Bump minimal size to 300M
From the xfsprogs source code:

* We don't support filesystems smaller than 300MB anymore.  Tiny
* filesystems have never been XFS' design target.  This limit has been
* carefully calculated to prevent formatting with a log smaller than
* the "realistic" size.
*
* If the realistic log size is 64MB, there are four AGs, and the log
* AG should be at least 1/8 free after formatting, this gives us:
*
* 64MB * (8 / 7) * 4 = 293MB

So let's accommodate and bump the minimal XFS filesystem size to 300M.
2023-07-21 14:22:53 +02:00
Topi Miettinen
d0b2839ddc homework-luks: fix typos 2023-07-21 21:11:04 +09:00
Yu Watanabe
df1dccd255 udev: decrease devlink priority for iso disks
Previously, if the priority is same, devlinks are always replaced by
newer events. The commit 331aa7aa15ee5dd12b369b276f575d521435eb52 changes
that to keep the existing devlink. That should not change any behavior
when the devices that request the same symlink do not have any
dependency, e.g. when /dev/sda1 and /dev/adb1 request the same
/dev/disk/by-label symlink, as there are no guarantee that which device
is processed first.

However, when devices has dependency, e.g. /dev/sda and /dev/sda1
request the same /dev/disk/by-label symlink, previously the symlink
always pointed to the partition, as the partition is always processed
later. But, 331aa7aa15ee5dd12b369b276f575d521435eb52 makes the symlink
point to the whole disk.

The change by 331aa7aa15ee5dd12b369b276f575d521435eb52 is crucial to
improve performance of devlink handling, especially when a system has
large number of disks with same label or so. Hence, cannot and should
not be reverted.

So, let's workaround the case, as such situation should happen only when
the disk is a hybrind ISO image, I guess.

Fixes #28468.
2023-07-21 11:42:34 +01:00
Yu Watanabe
dc3b5e0432 tree-wide: fix typo found by Fossies Codespell report 2023-07-21 19:12:08 +09:00
Michael A Cassaniti
66a8c74c35 repart: Set sector size of loopback devices
When an explicit sector size is set by the user it is also necessary to set the
sector size of any loopback devices. If the sector size is not set for loopback
devices then it can cause file system creation to fail or run into odd issues.
2023-07-21 11:04:39 +01:00
Yu Watanabe
01b030c201 udev: downgrade log level when running without cgroup
The cgroup path is optional, hence it is not necessary to warn the
failure loudly.

Follow-up for f8371dbd56d27621932ecbe3f5c1246e925fd53a.

Closes #28469.
2023-07-21 12:38:33 +09:00
Yu Watanabe
c0d998248e tree-wide: drop references to /dev/loop/by-ref
Follow-up for #28476.
2023-07-21 10:24:20 +09:00
Yu Watanabe
d168daa5c2
Merge pull request #28476 from bluca/revert_loop_links
Revert "udev: add /dev/loop/ symlinks"
2023-07-21 10:21:06 +09:00
Luca Boccassi
9915cc6086 Revert "udev: add /dev/loop/ symlinks"
Turns out this causes a regression and breaks losetup. It will need to
be reworked in conjunction with util-linux changes.

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

This reverts commit 5ac52d1f7b7cd11cad8b5c2e9812d7ee7560a517.
2023-07-20 22:28:23 +01:00
Luca Boccassi
5022fab15f Revert "test: test new systemd-dissect --attach/--detach/--loop-ref= and /dev/loop/* symlinks"
This reverts commit f5e46b9e09d4ff3f1e6ee6e3a90adc704780a661.
2023-07-20 22:26:40 +01:00
Luca Boccassi
d05553797e NEWS: note that sd-run --expand-environment will change 2023-07-20 17:41:38 +01:00
Luca Boccassi
8167c56bfa run: disable --expand-environment by default for --scope
The intention was to have this option enabled by default everywhere,
but unfortunately at least one case was found where it breaks
compatibility of a program using systemd-run --scopes and expecting
variables not to be expanded:

https://sources.debian.org/src/pbuilder/0.231/pbuilder-checkparams/#L400

Example run:

systemd-run --quiet --scope --description=pbuilder_build_xfce4-notes-plugin_1.10.0-1.dsc '--slice=system-pbuilder-build-xfce4\x2dnotes\x2dplugin_1.10.0\x2d1-449932.slice' chroot /var/cache/pbuilder/build/449932 dpkg-query -W '--showformat=${Version}' apt

Restore backward compatibility and make the option disabled by default
when --scope is used, and enabled by default for other types.

In case --expand-environment is not specified and a '$' character is
detected, print a warning to nudge users toward specifying the
parameter as needed. In the future we can then flip the default.

Follow-up for 2ed7a221fafb25eea937c4e86fb88ee501dba51e
2023-07-20 17:37:27 +01:00
Yu Watanabe
b0efbe9b81 test: use XDG_STATE_HOME for %S and %L
This fixes the test failure when invoked by a user.
===
Running ./systemd-tmpfiles --user on 'f /tmp/test-systemd-tmpfiles.1foag_ur/test-content.n_9r_xhm/arg - - - - %S'
expect: '/home/watanabe/.config'
actual: '/home/watanabe/.local/state'
Traceback (most recent call last):
  File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 233, in <module>
    test_valid_specifiers(user=True)
  File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 135, in test_valid_specifiers
    test_content('f {} - - - - %S',
  File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 88, in test_content
    assert content == expected
           ^^^^^^^^^^^^^^^^^^^
AssertionError
===

This also makes the test uses fallback paths.

Follow-up for b50aadaff22f9b3ad3bbcbfd2edd661456a5b4bf.
2023-07-20 12:54:54 +01:00
Yu Watanabe
4fc925a026 test: fix a syntax error in test-ukify
Follow-up for d7d36252e5fdc345b110f824031e20f41ee75e86.

Fixes #28464.
2023-07-20 09:55:32 +02:00
Ronan Pigott
9ec0808370 zsh: use glob matching for template names
Template names can be learned from the filesystem, so there isn't a need
to parse the output of systemctl list-unit-files in this case. This
should accelerate the completion of some verbs like enable.
2023-07-19 15:07:39 -07:00
Ronan Pigott
ae6fb82cd9 zsh: remove unit property caching
The existing caching policy isn't very sensible for this cache. We could
write a different policy, but I don't think there is much value in
caching these values, as in my experience the command used to generate
them is quick.
2023-07-19 14:27:45 -07:00
Ronan Pigott
110ba0ccf9 zsh: update default caching policy for units
The existing caching policy was completely bogus.

In the first stanza, despite the comment, the pattern given would
consider the cache invalid if it was more than 1 hour old.

The second stanza was also incorrect, since the output of `systemctl
--all` is not unit file paths, but unit names. When they were being
tested against the cachefile mtime, the test would always fail becuase
of the nonexistant file (hopefully).

In fact it's not very useful to test if the unit files have newer mtime
in this case anyway, since we are only caching their names. Also,
`systemctl --all` is an unfortunately slow operation to be used in
testing for the cache validity — we want this operation to at least be
faster than rebuilding the cache.

I've rewritten this stanza with my best guess at its original intent. It
now checks against the mtime of the parent directories in the search
path, which should be updated and cause the cache to rebuild when we
add, remove, or rename any unit files.
2023-07-19 14:27:45 -07:00
Zbigniew Jędrzejewski-Szmek
e51846adc0 man: clarify DNSSEC= again
https://github.com/systemd/systemd/pull/28407#issuecomment-1640900239
2023-07-19 15:13:01 +02:00
Dmitry V. Levin
f0406e118f locale-util: fix _() definition
The previous definition was not quite appropriate for the library code
because it relied on the message domain set by textdomain() invocation
which is not necessarily the same message domain defined in
GETTEXT_PACKAGE macro.

The only code that uses _() so far is located in pam_systemd_home.c.

Fixes: 20f56fddcd5 ("Add gettext support")
2023-07-19 14:02:04 +02:00
Luca Boccassi
7177c9022e
Merge pull request #28445 from bluca/run_host_release
core: copy the host's os-release for /run/host/os-release
2023-07-19 09:34:06 +01:00
Daan De Meyer
95f3bd0b51
Merge pull request #28447 from mrc0mmand/test-network
network: fix fetching link properties
2023-07-19 08:07:31 +02:00
Yu Watanabe
149aedb89b kernel-install: silently ignore unexpected arguments for 'remove' command
The shell script version of kernel-install silently ignored unexpected
arguments, but C version refused that. Unfortunately, Fedora's kernel
script specifies kernel file even for 'remove' command. Let's accept
extra arguments and silently ignore them to keep backward compatibility.

Fixes #28448.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2223794.
2023-07-19 07:24:36 +02:00
Frantisek Sumsal
8bdece7479 network: fix fetching link properties
This fixes regression introduced in 5a0c810462 with which all requests
for link properties ended up with EINVAL as we kept hitting
the signature_is_single() assert in sd_bus_get_property().
2023-07-18 23:08:19 +02:00
Frantisek Sumsal
7e107bc31f test-network: probe a couple of uncovered networkctl codepaths 2023-07-18 21:42:39 +02:00
Frantisek Sumsal
aca99a3a38 test-network: validate JSON where applicable 2023-07-18 21:42:39 +02:00
Daan De Meyer
e30c6e913c repart: Always take --offline into account 2023-07-18 18:26:23 +02:00
Luca Boccassi
25c66abbed NEWS: note that /run/host/os-release is available more broadly 2023-07-18 17:26:02 +01:00
Luca Boccassi
947d836a6e man: explicitly note that units surviving soft-reboot should not pin resources 2023-07-18 17:26:02 +01:00
Luca Boccassi
3f37a82545 core: copy the host's os-release for /run/host/os-release
Currently for portable services we automatically add a bind mount
os-release -> /run/host/os-release. This becomes problematic for the
soft-reboot case, as it's likely that portable services will be configured
to survive it, and thus would forever keep a reference to the old host's
os-release, which would be a problem because it becomes outdated, and also
it stops the old rootfs from being garbage collected.

Create a copy when the manager starts under /run/systemd/propagate instead,
and bind mount that for all services using RootDirectory=/RootImage=, so
that on soft-reboot the content gets updated (without creating a new file,
so the existing bind mounts will see the new content too).

This expands the /run/host/os-release protocol to more services, but I
think that's a nice thing to have too.

Closes https://github.com/systemd/systemd/issues/28023
2023-07-18 17:26:02 +01:00
Zbigniew Jędrzejewski-Szmek
7e90814f0a Deprecate efivar SystemdOptions
As mentioned in the NEWS entry, it seems to see very little use, but adds
complexity in our code. It was added mainly with the goal of making it easier
for people using grub2 to modify their boot configuration, but grub2 is gaining
support for BLS snippets. On the systemd side, we now have credentials. So
let's deprecate this, and if there's no outcry, remove it in a few releases.
2023-07-18 17:30:06 +02:00
Petr Menšík
96d384ca4f Include in manual what DNSSEC=no means in detail
https://www.rfc-editor.org/rfc/rfc4035.html#section-3.2.1 says
security-aware recursive name server MUST set DO bit when sending
requests. systemd-resolved does not do that by design. State it more
clearly in manual page. Unlike other implementations it disables not
only validation as it stated, but complete DNSSEC awareness.

Signed-off-by: Petr Menšík <pemensik@redhat.com>
2023-07-18 17:28:32 +02:00
Joerg Behrmann
c46f5680ca analyze: don't warn about version spec compliant versions
This commits adds version_is_valid_versionspec and uses it in
analyze-compare-version.c.

version_is_valid_versionspec differs from version_is_valid in that it acepts
empty strings and since valid characters in a version spec version are all
ASCII letters and digits as well as "-.~^", but ",_+" allowed by
version_is_valid are not.

Also give a more specific warning message on invalid characters.
2023-07-18 15:57:15 +01:00
Frantisek Sumsal
1dfa58edd3 Revert "packit: temporarily use older Rawhide spec"
This reverts commit f1adb4a2ea2fd1d54ff8cc17a4d10f2b502cfc69.
2023-07-18 15:28:07 +02:00
Yu Watanabe
74c4ad58dd
Merge pull request #28424 from mrc0mmand/networkd-ra-captive-portals
test-network: check for captive portals received via NDISC
2023-07-18 22:02:44 +09:00
Daan De Meyer
106fcf0d06 test-resolved-stream: Use a random port number
Hopefully fixes #28393
2023-07-18 14:48:07 +02:00
Frantisek Sumsal
c1dd58b3b6 test-network: check for captive portals received via NDISC
This requires fairly recent radvd that supports sending RAs with captive
portals [0].

Also, this should hopefully provide coverage for issues like:
  - https://github.com/systemd/systemd/issues/28229
  - https://github.com/systemd/systemd/issues/28231
  - https://github.com/systemd/systemd/issues/28277

[0] https://github.com/radvd-project/radvd/pull/141
2023-07-18 11:38:58 +02:00
Ronan Pigott
8a8caeccb2 zsh: stop forcing unit file cache rebuilds
Rebuilding whenever the cached parameter is not set forces each new
shell to rebuild the cache, which often defeates the purpose of caching
in the first place.
2023-07-17 16:38:25 -07:00
Ronan Pigott
087f777a1c zsh: default to system manager when not specified
This used to work correctly, before the change was reverted in
e09d0d46c297. In fact it is important to specify the manager explicity
in the completion because the argument is reused in the caching
policies. An empty argument here caused the completion to create
separate caches with and without the --system parameter. We can simplify
the given pattern a little here too.
2023-07-17 16:35:29 -07:00
Ronan Pigott
d0fc94a192 zsh: suppress aliases and shell functions when calling systemctl
This prevents any errors in case the user had aliased some arguments
following systemctl.
2023-07-17 16:20:03 -07:00
Ronan Pigott
3b4c6009c0 zsh: typo in systemctl completions 2023-07-17 16:08:58 -07:00
Luca Boccassi
cc037f2b48 test: exit early from TEST-70-TPM2 on ppc64el
There is an underlying issue that appears only on ppc64 and fails 95%
of Ubuntu runs, so exit early until it is solved.

Closes https://github.com/systemd/systemd/issues/27716
2023-07-17 22:47:06 +01:00
Frantisek Sumsal
c4b167f857 ci: drop super-linter's shellcheck
It's been a while since we introduced Differential ShellCheck and it
proved to be quite useful (and in some ways even better than the shellcheck
run by super-linter). So, to have only one linter scream at us for not
knowing how to write bash properly, let's drop the super-linter's one in
favor of Differential ShellCheck.

Follow-up for https://github.com/systemd/systemd/pull/24328#pullrequestreview-1074127504
2023-07-17 20:12:57 +01:00