Commit Graph

5193 Commits

Author SHA1 Message Date
Luca Boccassi
33a2307ac7
Merge pull request #33957 from yuwata/network-generator-vlan
network-generator: fixlets for vlan interfaces
2024-08-14 12:45:25 +02:00
Yu Watanabe
b3b4d626ce network-generator: use extract_first_word()
Now, ip= with trailing colon is refused.
2024-08-14 15:29:45 +09:00
Luca Boccassi
5936b4054a
Merge pull request #33979 from YHNdnzj/edit-util-no-duplicate-strip
edit-util: a few cleanups; support networkctl edit --stdin
2024-08-13 01:48:06 +02:00
Lukas Nykryn
fe5a6c47af systemd-run: add unit and invocation_id JSON output 2024-08-12 20:19:01 +02:00
Mike Yuan
119cba7835
networkctl: support edit --stdin 2024-08-12 16:23:23 +02:00
Luca Boccassi
0dd6fe931d
Merge pull request #33961 from bluca/busctl_exit
busctl: add support for --timeout and --num-matches for monitor verb
2024-08-09 14:48:40 +02:00
Luca Boccassi
702d74b62a busctl: add --num-matches= for monitor verb
Useful in scripts when one wants to wait for a specific
signal before continuing
2024-08-09 12:12:28 +01:00
Nick Rosbrook
82c482d573 core/unit: do not use unit path cache in unit_need_daemon_reload()
When unit_need_daemon_reload() calls unit_find_dropin_paths() to check
for new drop-in configs, the manager's unit path cache is used to limit
which directories are considered. If a new drop-in directory is created,
it may not be in the unit path cache, and hence unit_need_daemon_reload()
may return false, despite a new drop-in being present. However, if a
unit path cache is not given to unit_file_find_dropin_paths() at all,
then it behaves as if the target path was found in the unit path cache.

So, to fix this, adapt unit_find_dropin_paths() to take a boolean
argument indicating whether or not to pass along the unit path cache.
Set this to false in unit_need_daemon_reload().

Fixes #31752
2024-08-09 19:25:42 +09:00
Luca Boccassi
79488ac003 test: note in README how to get full list of Ubuntu CI jobs 2024-08-08 15:13:38 +01:00
Luca Boccassi
989e843e75 busctl: add support for --timeout to monitor verb
Useful in scripts when you want to exit successfully after a certain time
2024-08-08 09:18:41 +01:00
Daan De Meyer
4fde35f27e
Merge pull request #33951 from DaanDeMeyer/nspawn
nspawn: Allow specifying custom init program
2024-08-07 07:32:50 +02:00
Daan De Meyer
ce2291730d nspawn: Allow specifying custom init program
This allows for example forcing to use /sbin/init instead of always
using /usr/lib/systemd/systemd if it exists. Or it allows using a
different path altogether.
2024-08-06 23:00:17 +02:00
Nick Rosbrook
18a8f03e51 sysusers: check if requested group name matches user name in queue
When creating a user, check if the requested group name matches a user
name in the queue. If that matched user name is also going to be a group
name, then use it for the new user too. In other words, allow the
following:

 u foo -
 u bar -:foo

when both foo and bar are new users.

Fixes #33547
2024-08-06 13:02:58 +02:00
Daan De Meyer
92d885d870
Merge pull request #33942 from yuwata/udevadm-info-attribute-walk-json
udevadm-info: support json output for --attribute-walk
2024-08-06 10:23:45 +02:00
Yu Watanabe
5a5a7093b8
Merge pull request #33933 from yuwata/systemctl-bus-transport-and-runtime-scope
systemctl: fix bus transport and runtime scope handling
2024-08-06 09:12:28 +09:00
Yu Watanabe
c243302ee0
Merge pull request #33941 from yuwata/network-dhcp-pd-route-type
network/dhcp-pd: introduce UnassignedSubnetPolicy= to customize type of 'catch-all' route
2024-08-06 09:11:54 +09:00
Yu Watanabe
1056457d11 systemctl: gracefully adjust bus transport and runtime scope when --boot-loader-entry=help
This fixes the following assertion:
===
SYSTEMD_LOG_LEVEL=debug systemctl --user -H foo --boot-loader-entry=help
Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Ignoring.
Failed to connect to bus: Operation not supported
===

Fixes a bug introduced by 97af80c5a7.
Fixes #33661.
Fixes oss-fuzz#70153.
2024-08-06 05:33:25 +09:00
Yu Watanabe
d133508493 test-network: add test case for UnassignedSubnetPolicy= 2024-08-06 05:24:20 +09:00
Yu Watanabe
67ea8a4c0e udevadm-info: support json output for --attribute-walk
Closes #33852.
2024-08-06 05:22:10 +09:00
Arnaud Patard
e7a93e7521 src/pcrlock/pcrlock.c: Handle empty pcrlock.d directories
Running the following commands:

  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock predict --pcr=1+2+3+4+5+16

Will result in:

...
Floating point exception

Running the following commands:
  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock make-policy --pcr=1+2+3+4+5+16

Will result to this (partial) log:
...
Predicted future PCRs in 133us.
[]
...
Written policy digest 0000000000000000000000000000000000000000000000000000000000000000 to NV index 0x1921da6
...

So, add missing checks to handle gracefully cases where there's no variant
inside the component.

Signed-off-by: Arnaud Patard <arnaud.patard@collabora.com>
2024-08-05 18:32:26 +01:00
Luca Boccassi
1e0ef01439 logind: add PreparingForShutdownWithMetadata property
The PrepareForShutdownWithMetadata signal was added via
e4aab5cf1a but a corresponding property
was not. A property has to be a single type, so the bool needs to be
one of the key/value pairs as 'ba{sv}' is not a valid property.
2024-08-05 19:30:15 +02:00
Daan De Meyer
bec6b53f3c
Merge pull request #33912 from DaanDeMeyer/mkosi
test: Add a way to quickly iterate on an integration test
2024-08-05 16:21:48 +02:00
rajmohan r
1592d2f900 systemd-analyze: Add svg scaling options
+ Scale the x-axis of the resulting plot by a factor (default 1.0)
+ Add activation timestamps to each bar

Signed-off-by: rajmohan r <rajmohan.r@kpit.com>
2024-08-05 15:23:44 +02:00
Daan De Meyer
af153e36ae test: Add a way to quickly iterate on an integration test
Rebuilding the integration test every time is very slow. Let's
introduce a way to iterate on an integration test without rebuilding
the image every time. By making a btrfs snapshot before we run the
integration test, we can then systemctl soft-reboot after running
the test to restore the rootfs to a pristine state before running
the test again.

As /run/nextroot will get nuked on reboot or soft-reboot, we introduce
a tmpfiles snippet to make sure it is recreated every (soft-)reboot
and adapt the existing tests to deal with this new symlink.
2024-08-05 15:13:38 +02:00
Daan De Meyer
dd1c01b20f test: Implement TEST_SHELL for mkosi based test runner
TEST_SHELL can be used to get a shell in the integration test
environment without actually immediately starting the test.
2024-08-05 15:00:24 +02:00
Daan De Meyer
33f400a9e0 test: Rename INTERACTIVE_DEBUG to TEST_SHELL 2024-08-05 15:00:24 +02:00
Mike Yuan
1391f149f0 core/service: actually allow to "hurry up" auto restarts
unit_start() advertises that start requests don't get suppressed,
so that it could be used to manually speed up auto restarts.
However, service_start() so far rejected this, stating that
clients should issue restart request in order to trigger
BindsTo=/OnFailure=.

That seems to be a red herring though, because for a long time
the service states between auto-restarts were buggy (#27594).
With the introduction of RestartMode=direct, the behavior
is sane again and customizable, hence I see no reason to refuse
this anymore. Whether those deps are triggered solely depends
on RestartMode= now.

Plus, filter out some intermediate states that should never
be seen in service_start().

Fixes #33890
2024-08-03 13:03:28 +02:00
Yu Watanabe
74d1ee0373 core: refuse credentials with invalid names matching with glob
Even if the glob pattern is valid, the pattern may match credentials
with invalid names. So, we need to check the names of the found
credentials.

Follow-up for 947c4d3952.
2024-08-03 14:25:35 +09:00
Yu Watanabe
b376dbc83d test: a credential can be imported multiple times with different names
This is supported since 831f208783.
Let's explicitly test the functionality.
2024-08-03 14:23:17 +09:00
Yu Watanabe
40dd2a1c24 core: make ImportCredentialEx= DBus property support without renaming
Note that the conf parser for ImportCredential= checks in the same way.

Follow-up for 831f208783.
2024-08-03 14:20:07 +09:00
jauge-technica
82f2a2f032
Added support for L2 BridgeMDB entries (#32894)
* Added support for L2 BridgeMDB entries
2024-08-02 16:31:20 +01:00
Frantisek Sumsal
4d1fbe53c1 test: don't use /skipped for subtests
Since, at least the old framework, checks for the presence of the file
at the end and marks the whole test as skipped if it exists.

Resolves: systemd/systemd-centos-ci#728
2024-08-02 16:44:25 +02:00
Yu Watanabe
76459af531
Merge pull request #33876 from dbnicholson/firstboot-root-creds-only
firstboot: fix root params with creds and prompting disabled
2024-08-02 11:37:05 +09:00
Frantisek Sumsal
ce2344bbee test: attempt to install sshd-session from multiple places
On Fedora the sshd-session binary is under /usr/libexec/openssh/ so
cover this path as well in the old framework.

Follow-up for aaa7b36bd1.
2024-08-01 15:02:34 +02:00
Yu Watanabe
b1b30d0226 test: add test for journalctl --list-invocations and --invocation= 2024-08-01 07:31:44 +09:00
Daan De Meyer
e54a8e0fc3
Merge pull request #33873 from DaanDeMeyer/rename-creds
core: Add support for renaming credentials with ImportCredential=
2024-07-31 17:35:58 +02:00
Michal Sekletar
941a12dcba socket: fix socket activation of stopped services with pinned FD store 2024-07-31 16:29:07 +02:00
Daan De Meyer
831f208783 core: Add support for renaming credentials with ImportCredential=
This allows for "per-instance" credentials for units. The use case
is best explained with an example. Currently all our getty units
have the following stanzas in their unit file:

"""
ImportCredential=agetty.*
ImportCredential=login.*
"""

This means that setting agetty.autologin=root as a system credential
will make every instance of our all our getty units autologin as the
root user. This prevents us from doing autologin on /dev/hvc0 while
still requiring manual login on all other ttys.

To solve the issue, we introduce support for renaming credentials with
ImportCredential=. This will allow us to add the following to e.g.
serial-getty@.service:

"""
ImportCredential=tty.serial.%I.agetty.*:agetty.
ImportCredential=tty.serial.%I.login.*:login.
"""

which for serial-getty@hvc0.service will make the service manager read
all credentials of the form "tty.serial.hvc0.agetty.xxx" and pass them
to the service in the form "agetty.xxx" (same goes for login). We can
apply the same to each of the getty units to allow setting agetty and
login credentials for individual ttys instead of globally.
2024-07-31 15:52:27 +02:00
Daan De Meyer
3de13e6148 exec-credential: Skip duplicate credentials in load_credential_glob()
We document that when multiple credentials of the same name are found,
we use the first one found so let's actually implement that behavior.
2024-07-31 15:23:45 +02:00
Dan Nicholson
35bc4c3424 firstboot: fix root params with creds and prompting disabled
Remove an early return that prevents --prompt-root-password or
--prompt-root-shell and systemd.firstboot=off using credentials. In that case,
arg_prompt_root_password and arg_prompt_root_shell will be false, but the
prompt helpers still need to be called to read the credentials. Furthermore, if
only the root shell has been set, don't overwrite the root password.
2024-07-31 04:02:43 -06:00
Dan Nicholson
2319154a6b firstboot: handle missing root password entries
If /etc/passwd and/or /etc/shadow exist but don't have an existing root entry,
one needs to be added. Previously this only worked if the files didn't exist.
2024-07-31 04:02:39 -06:00
Dan Nicholson
5088de9daa firstboot: create locked and empty root passwords consistently
Although locked and empty passwords in /etc/passwd are treated the same, in all
other cases the entry is configured to read the password from /etc/shadow.
2024-07-31 00:40:56 -06:00
Dan Nicholson
38688bbc8f test: extend firstboot testing
Several features were not being tested or weren't being evaluated thoroughly.
2024-07-31 00:40:56 -06:00
Yu Watanabe
f320c0777a test-network: add test case for preferred source with peer
For issue #31950.
2024-07-31 05:36:14 +09:00
Daan De Meyer
7fe0ea2ead
Merge pull request #33857 from DaanDeMeyer/mkosi
Two small improvements
2024-07-29 15:40:48 +02:00
Daan De Meyer
578ee05155 test: Don't mount build sources into image when running non-interactively 2024-07-29 13:40:42 +02:00
Luca Boccassi
85c7a9a2f5
Merge pull request #27855 from Werkov/test-delegate-useraddfixup
Delegate/cgroup test refactor
2024-07-26 14:01:38 +01:00
Luca Boccassi
281b0bfbed
Merge pull request #33842 from DaanDeMeyer/test
Two fixes
2024-07-26 10:04:20 +01:00
Michal Koutný
3e6e3e6d40 test: Fail cgroup delegation test when user cannot be created
It means: a) user cannot be created, something's wrong in the
test environment -> fail the test; b) user already exists, we shall not
continue and delete (foreign) user.
2024-07-26 10:44:10 +02:00
Daan De Meyer
ae07feb401 resize-fs: Put minimal ext4 size in the same ballpark as the other filesystems
TEST-46-HOMED fails on ext4 because the filesystem is deemed to small
for activation by cryptsetup. Let's bump the minimal filesystem size for
ext4 a bit to be in the same ballpark as ext4 and btrfs to avoid weird
errors due to impossibly small filesystems.

Also use U64_MB while we're touching this.
2024-07-26 08:27:24 +02:00