Commit Graph

70842 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
ad36bb9fbb tmpfiles: break long log invocations and comments 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
e5876c29ad tmpfiles: inline variable declarations, use FOREACH_ARRAY and RET_GATHER 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
ec3917d282 tmpfiles,sysusers: rework path argument handling
Previously, if given an absolute path, we would open the file, but when given a
relative path, we'd attempt to search the directories. If the user wants to open
a file from the search path, allowing paths is very confusing. E.g. with a path
like 'sysusers/foo.conf', we'd try to open '/etc/sysusers.d/sysusers/foo.conf',
'/run/sysusers.d/sysusers/foo.conf', …, and with '../foo.conf', we'd try to open
'/etc/sysusers.d/../foo.conf', '/run/sysusers.d/../foo.conf', …. This just isn't
useful, and in fact for a scheme like sysusers.d and tmpfiles.d where there we
have a flat directory with config files, only searching for plain names can
result in success. When a user specifies a relative path, it's more likely that
they wanted to open some local file. OTOH, to correctly open a local file, e.g.
one that they're just writing, this interface is also awkward, because something
like '$PWD/file.conf' has to be used to open a file with a relative path.

This patch changes the interface so that any path (i.e. an argument with "/") is
used to open a file directly, and only plain basenames are used for searching.

(Note that tpmfiles and sysusers are somewhat special here: their "config files"
make sense without the other config and users are likely to want to test them
without the other config. I was trying to do just that when writing a spec file
for a package and attempting to convert the existing scripts to sysusers and
tmpfiles. The same logic wouldn't apply for example to units or udev rules,
because they generally can only be interpreted with the whole rest of config
also available.)
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
15d660fb41 sysusers: convert to conf_file_read()
I was annoyed that systemd-sysusers doesn't print any info when it opens a
config file. Its read_config_file() started out the same as the one in tmpfiles,
and then they diverged. The one in tmpfiles has that logging, hence the rework
to use it here too and get better logging. The two programs should provide
similar functionality, so using a common helper will make it easier to extend
them in tandem later.

No functional change apart from the log info.

The userdata argument (Context) is moved to the last position as requested in
the review.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
f6a1346e4e tmpfiles: split out helper to open and read a "config file"
No functional change.

Note that this function will be modified in subsequent commits, and the API
will change.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
376d0495f5 tmpfiles: only populate uid and gid caches once
a3451c2c4c added offline uid/gid support in a way
where the <root>/etc/passwd and <root>/etc/group would be read anew for each
configuration file that was parsed. The result would always be the same, so I
assume that this was an oversight. Let's use a global cache and and read the
file just once.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
5ac41a1672 tmpfiles: adjust vertical whitespace 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
37ee46f7c8 sysusers,tmpfiles: clarify error message for --replace
I was trying to run sysusers --replace, but the input file didn't have the right
suffix, and the message was very confusing. Let's split the message in two to
make it clearer that we care about the extension.
2024-02-09 17:57:41 +01:00
Luca Boccassi
c505275476 Merge pull request #31243 from YHNdnzj/systemctl-disable-now-template
systemctl: support disable/mask --now with unit template
2024-02-09 14:29:50 +00:00
Luca Boccassi
9131b93590 Merge pull request #31224 from mrc0mmand/packit-bpftool-workaround
packit: temporarily build systemd without BPF stuff
2024-02-09 13:48:13 +00:00
Luca Boccassi
6e7134ad95 Merge pull request #31264 from poettering/sysext-help
sysext: tweaks to the systemd-sysext/systemd-confext --help text
2024-02-09 13:46:28 +00:00
Daan De Meyer
317cb6f9b5 Install pacman in Arch Linux image
We install apt and dnf in the other images as well, so lets be
consistent and install pacman in the Arch image as well.
2024-02-09 12:41:54 +00:00
Frantisek Sumsal
e7a52b1b33 test: adjust test-path to fail gracefully with the new pidfd_spawn stuff
Since 2e106312e2 the test unit fails with 'resources' result instead of
'exit-code', which the test didn't account for when running unprivileged.

Before 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
...
line 151: path-exists.path: state = running; result = success (left: 29986250)
line 151: path-exists.service: state = start; result = success
path-exists.service: Main process exited, code=exited, status=219/CGROUP
path-exists.service: Failed with result 'exit-code'.
line 151: path-exists.path: state = running; result = success (left: 29985948)
line 151: path-exists.service: state = failed; result = exit-code
Failed to start service path-exists.service, aborting test: failed/exit-code

After 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
path-exists.service: Failed to spawn executor: No such file or directory
path-exists.service: Failed to spawn 'start' task: No such file or directory
path-exists.service: Failed with result 'resources'.
2024-02-09 12:50:21 +01:00
Frantisek Sumsal
8a0ec8852c packit: temporarily build systemd without BPF stuff
The kernel-tools meta-package was retired in Rawhide, but its
replacement has not landed, yet. Until that happens, let's build without
the bpf-framework stuff.
2024-02-09 12:50:21 +01:00
Daan De Meyer
7bf52f5d1c Add systemd.default_debug_tty=
Let's allow configuring the debug tty independently of enabling/disabling
the debug shell. This allows mkosi to configure the correct tty while
leaving enabling/disabling the debug tty to the user.
2024-02-09 11:47:53 +01:00
Frantisek Sumsal
c078f4af6b semaphore: temporarily pin autopkgtest to v5.32
The latest commit (ATTOW) [0] calls adduser with --logmsglevel, which is
not a valid flag for adduser on Ubuntu Focal/Jammy.

[0] 9c033b3db4
2024-02-09 11:18:25 +01:00
Yu Watanabe
6a32108812 man: add missing "=" after setting name
Follow-up for b93bf1bf9f.
2024-02-09 19:03:56 +09:00
Frantisek Sumsal
8632590278 Merge pull request #31230 from mrc0mmand/test-seccomp
process-util: use only the least significant byte from personality()
2024-02-09 10:39:23 +01:00
Yu Watanabe
15875f524f README: update link to CentOS CI 2024-02-09 18:08:58 +09:00
Yu Watanabe
d2eb27eb7b man: fix typo
Follow-up for 631cf7f004.
2024-02-09 17:49:48 +09:00
Lennart Poettering
00d0f58443 sysext: output an appropriate blurb for the mode we are executed in 2024-02-09 09:41:33 +01:00
Lennart Poettering
82d371eeaf sysext: point to the right man page for the mode we are invoked in 2024-02-09 09:41:26 +01:00
Lennart Poettering
457a74b3d0 sysext: rename "directory_name" field to "full_identifier"
So the field contains simply the full name of the command being invoked,
hence rename the field to match the contents, and to mirror the
"short_identifier" field.

Interestingly, the field is apparently not actually used by anything
though! But we are not going to remove it, since a follow-up commit will
start making use of it.
2024-02-09 09:41:19 +01:00
Lennart Poettering
97b944c23a sysext: fix --help indenting/line breaking
Let's make sure there's an empty line after the explanatory text like we
usually do it, and do not indent the 2nd line more than the 1st
2024-02-09 09:40:45 +01:00
Yu Watanabe
9e95c0e495 Merge pull request #31172 from yuwata/network-bond-port
network: do not bring down bonding port on reconfigure
2024-02-09 17:32:29 +09:00