Commit Graph
79040 Commits
Author SHA1 Message Date
Mike Yuan f3ba767d6c core/job: fix typo 2025-01-24 05:08:12 +09:00
Lennart Poettering 3e7910829e units: modprobe@.service tweaks (#36132) 2025-01-23 18:18:10 +01:00
Yu Watanabe b7622cbab6 sd-device: chase sysattr and refuse to read/write outside of sysfs (#36004) 2025-01-24 01:58:19 +09:00
Yu Watanabe e7fdc7644f udevadm: introduce cat command to show udev rules (#35893)
Closes #35818.
2025-01-24 01:49:42 +09:00
Lennart Poettering 71b6f718e2 units: don't load squasfs/erofs kmods explicitly
File system modules should be something the kernel can autoload
automatically, and according to my testing that works fine, hence let's
drop the explicit deps, in particular as systems usually stick to one fs
for these things, not both.

I inquired bluca about the reason to add it, and didn't remember
anymore, and was fine with me removing this. So let's remove this for
now, should issues arise we can revert this.
2025-01-23 16:29:28 +01:00
Lennart Poettering 6f69568cff units: mountfsd needs to pull DM and loop kmods
mountfsd is supposed to be available during early boot aleady, before
systemd-tmpfiles-setup-dev-early.service completes, hence make sure
loopback devices and DM already work before that.

As suggested by yuwata here:

https://github.com/systemd/systemd/pull/35685#issuecomment-2608157569
2025-01-23 16:29:22 +01:00
Lennart Poettering 9fc2126386 units: add a longer comment to modprobe@.service explaining when to use it 2025-01-23 16:29:20 +01:00
Yu Watanabe 1fe5b06363 sd-device: use device_in_subsystem() at more places 2025-01-23 22:54:11 +09:00
Yu Watanabe 640f8e9c4d sd-device: use specific setters for read entries from uevent file
Previously, if e.g. DRIVER=foo is specified in uevent file, the value is
only saved as property, but was not set to sd_device.driver.
That was inconsistent to the case when a device is created through
netlink uevent.

Let's always set when we get e.g. sd_device.driver when DRIVER=foo
from both uevent file and netlink uevent.
2025-01-23 22:54:11 +09:00
Yu Watanabe 17dc9ec4b6 sd-device: use sd_device_get_sysattr_value() to read uevent file
This also replaces the custom parser with strv_split_newlines_full().
No functional change, just refactoring.
2025-01-23 22:54:11 +09:00
Yu Watanabe 6ebbdcc0dd sd-device: use sd_device_get_sysattr_value() to read special symlinks
Then, cached result may be used. No functional change, just refactoring.
2025-01-23 22:54:11 +09:00
Yu Watanabe 8d89667aba sd-device: chase sysattr and refuse to read/write files outside of sysfs
This makes sd_device_get_sysattr_value()/sd_device_set_sysattr_value()
refuse to read/write files outside of sysfs for safety.

Also this makes
- use chase() to resolve and open the symlink in path to sysfs attribute,
- use delete_trailing_chars(),
- include error code in cache entry, so we can cache more error cases,
- refuse caching value written to uevent file of any devices, i.e.
  sd_device_set_sysattr_value(dev, "../uevent", "add") will also not
  cache the value "add".
2025-01-23 22:54:11 +09:00
Yu Watanabe 06503dd0df fileio: make read_virtual_file_at() accept O_PATH file descriptor
Then, merge read_virtual_file_at() and read_virtual_file_fd(), and make
the latter inline.
2025-01-23 22:54:07 +09:00
Yu Watanabe f3c5c2b001 fileio: make write_string_file_at() accept O_PATH fd and an empty filename
Then, introduce an inline wrapper write_string_file_fd().
2025-01-23 22:53:05 +09:00
Yu Watanabe 9e096259ce fileio: fix verification on failure in write_string_file_full()
Fixes a bug introduced by 0ab5e2a4b4.
2025-01-23 22:24:19 +09:00
Yu Watanabe 7f2175eabb udevadm: introduce cat command
This introduces 'udevadm cat' command, that shows udev rules files or
udev.conf, which may be useful for debugging.

Closes #35818.
2025-01-23 22:23:45 +09:00
Yu Watanabe bbe1ba5e87 bash-completion/udevadm-verify: suggest found udev rules files
This also fixes the issue that no suggestion is provided after a standalone
option is specified.
2025-01-23 22:23:45 +09:00
Yu Watanabe 7cb4508c5a udevadm-verify: chase specified paths
Also, when a filename is specified, also search udev rules file in
udev/rules.d directories.

This also refuses non-existing files, and file neither nor a regular
nor a directory, e.g. /dev/null.
2025-01-23 22:23:45 +09:00
Yu Watanabe 8e0f023548 udev-rules: log the first line number when continued 2025-01-23 22:23:45 +09:00
Yu Watanabe 86a08e70a8 udev: sort builtins
Then, 'udevadm test-builtin --help' lists builtins alphabetically.
2025-01-23 22:23:45 +09:00
Yu Watanabe c3d526d765 shell-completion/udevadm: add net_driver
Follow-up for 2b5b25f123.
2025-01-23 22:23:45 +09:00
Yu Watanabe eb86b4e63b tree-wide: use hash ops with destructor (#36107) 2025-01-23 22:20:42 +09:00
Daan De Meyer 6733b07d43 mkosi: Add back --preserve-env when running integrationt tests
The test wrapper script depends on various github actions environment
variables so let's make sure those are propagated.
2025-01-23 12:18:21 +01:00
Yu Watanabe 38f7edd9d3 hashmap: drop hashmap_free_free() and friends 2025-01-23 18:22:53 +09:00
Yu Watanabe 58f0cd14a0 test: use hash ops with destructor 2025-01-23 18:22:53 +09:00
Yu Watanabe 06835cb397 remount-fs: use hash ops with destructor 2025-01-23 18:22:53 +09:00
Yu Watanabe 60cc858e9d exec-util: use hash ops with destructor 2025-01-23 18:22:52 +09:00
Yu Watanabe 04b7949ecf network: use hash ops with destructor 2025-01-23 18:22:47 +09:00
Yu Watanabe 938a6b49bd sd-journal: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe 2d23cadd19 journal-file: use hash ops with destructor
This also makes JournalFile.chain_cache allocated when necessary.
2025-01-23 18:19:28 +09:00
Yu Watanabe b87501ea3c sd-bus: use hash ops with destructor
This also makes vtable_methods and vtable_properties managed by Set,
as the key and value of each entry are equivalent.
2025-01-23 18:19:28 +09:00
Yu Watanabe 4516022833 delta: use hash ops with destructor
This also makes it use RET_GATHER().
2025-01-23 18:19:28 +09:00
Yu Watanabe c1bfee0bdb bootctl: use hash ops with destructor
This also makes the hashmap allocated when necessary.
2025-01-23 18:19:28 +09:00
Yu Watanabe 852c05c94f catalog: modernize code
- set destructors to catalog_hash_ops,
- acquire OrderedHashmap when necessary,
- gracefully handle NULL catalog directories and output stream,
- rename function output arguments,
- add many many assertions,
- use RET_GATHER().
2025-01-23 18:19:28 +09:00
Yu Watanabe 12006a7233 wait-online: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe a22620e39f udev: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe 57f15d05bf udevadm-monitor: use hash ops with destructor
This also make it use STATIC_DESTRUCTOR_REGISTER() macro, and logs OOM
error.
2025-01-23 18:19:00 +09:00
Yu Watanabe 0284fcc0ab hash-funcs: introduce several basic hash_ops with value destructor 2025-01-23 18:15:42 +09:00
Andrew Sayers e5038e63e9 Clarify that Conflicts= only applies when starting units
The "vice versa" in the old text could be interpreted as either
(wrong) "stopping the former will start the latter", or
(right) "starting the latter will stop the former".

Rephrase to avoid that ambiguity.
2025-01-23 18:14:47 +09:00
Yu Watanabe 90cf374e45 run: add --job-mode= argument (#34708)
systemctl has a --job-mode= argument, and adding the same argument to
systemd-run is useful for starting transient scopes with dependencies.
For example, if a transient scope BindsTo a service that is stopping,
specifying --job-mode=replace will wait for the service to stop before
starting it again, while the default job mode of "fail" will cause the
systemd-run invocation to fail.
2025-01-23 18:11:30 +09:00
Gavin Li 706a953504 run: add --job-mode= argument
systemctl has a --job-mode= argument, and adding the same argument to
systemd-run is useful for starting transient scopes with dependencies.
For example, if a transient scope BindsTo a service that is stopping,
specifying --job-mode=replace will wait for the service to stop before
starting it again, while the default job mode of "fail" will cause the
systemd-run invocation to fail.
2025-01-23 02:08:32 -05:00
Luca Boccassi 62e7b478ad pkg-config: add Requires.private: libcap
The two shared libraries for now link against libcap,
so add it to the Requires.private as it's a dependency

Fixes https://github.com/systemd/systemd/issues/36117
2025-01-23 10:28:47 +09:00
Yu Watanabe b6b8148459 core/device: do not drop backslashes in SYSTEMD_WANTS=/SYSTEMD_USER_WANTS= (#35869)
Let consider the following udev rules:
```
PROGRAM="/usr/bin/systemd-escape foo-bar-baz", ENV{SYSTEMD_WANTS}+="test1@$result.service"
PROGRAM="/usr/bin/systemd-escape aaa-bbb-ccc", ENV{SYSTEMD_WANTS}+="test2@$result.service"
```
Then, a device expectedly gains a property:
```
SYSTEMD_WANTS=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service
```
After the event being processed by udevd, PID1 processes the device, the
property previously was parsed with
`extract_first_word(EXTRACT_UNQUOTE)`, then the device unit gained the
following dependencies:
```
Wants=test1@foox2dbarx2dbaz.service test2@aaax2dbbbx2dccc.service
```
So both `%i` and `%I` for the template services did not match with the
original data, and it was hard to use `systemd-escape` in `PROGRAM=`
udev rule token.

This makes the property parsed with
`extract_first_word(EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE)`, hence the
device unit now gains the following dependencies:
```
Wants=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service
```
and `%I` for the template services match with the original data.

Fixes a bug caused by ceed8f0c8b (v233).

Fixes #16735.
Replaces #16737 and #35768.
2025-01-23 09:04:12 +09:00
Yu Watanabe ef199874ae mkosi: Update to latest (#36114) 2025-01-23 09:00:39 +09:00
Yu Watanabe af9e8ad4e8 pretty-print: fix handling of line continuation in cat_file() (#35886)
Fixes #35878.
2025-01-23 08:59:24 +09:00
Yu Watanabe 14887c14c6 network/ndisc: allow to configure route option preference (#35213)
Continuation of #35212.
Closes #35714.
2025-01-23 08:58:30 +09:00
Mike Yuan 7b940d8de9 core/job: never consider reload jobs redundant
Follow-up for 656bbffc6c

The commit reworked job merging logic so that reload jobs
won't get merged. However, they might get dropped from
transaction due to being deemed redundant, i.e. way before
it even hits job_install(). Let's make sure reload jobs
are always kept during transaction construction stage, too.
2025-01-22 22:51:46 +00:00
Luca Boccassi f6eed063a6 mkosi: switch rootfs to ext4
btrfs is currently broken for nspawn on recent kernels, so switch
to the best filesystem until that is solved
2025-01-22 22:50:52 +00:00
Daan De Meyer 94558e6fc7 mkosi: Update to latest
With the latest mkosi, mkosi takes care of making sure it is
available within mkosi sandbox so we get rid of all the --preserve-env=
options when we invoke mkosi sandbox with sudo as these are not
required anymore. It also doesn't matter anymore if mkosi is installed
in /usr on the host so we get rid of the documentation around that as
well.
2025-01-22 22:25:51 +01:00
Daan De Meyer 007d255d87 mkosi: Run two more mkosi commands with sudo
Running some mkosi commands as root and other not can lead to cache
invalidations with the latest version, so make sure we run everything
as root after we've built the tools tree.
2025-01-22 22:25:51 +01:00