1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00
Commit Graph

56911 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
ecd6c000d3 man: clarify the descriptions of aliases and linked unit files
This just describes the rules that are implemented by the manager, and this
pull request does not change any of them.
2022-03-29 16:17:56 +02:00
Zbigniew Jędrzejewski-Szmek
367c47c886 tests: add helper for creating tempfiles with content
I put it in tests because I think we're most likely to use it in tests.
If necessary, it can be moved somewhere else later.
2022-03-29 16:17:56 +02:00
Zbigniew Jędrzejewski-Szmek
50c5f5a3d9 test: add test for systemctl link & enable
This test has overlap with test-install-root, but it tests things at a
different level, so I think it's useful to add. It immediately shows various
bugs which will be fixed in later patches.
2022-03-29 16:17:56 +02:00
Zbigniew Jędrzejewski-Szmek
e75a26d045 shared/install: add a bit more quoting
When we are printing a valid unit name, quoting isn't necessary, because
unit names cannot contain whitespace or other confusing characters. In particular
if the unit name is prefixed by " unit " or something else that clearly
identifies the string as a unit name, quoting would just add unnecessary
noise. But when we're printing paths or invalid names, it's better to add
quotes for clarity.
2022-03-29 16:17:56 +02:00
Zbigniew Jędrzejewski-Szmek
047d37dc3d shared/install: reuse the standard symlink verification subroutine
We save a few lines, but the important thing is that we don't have two
different implementations with slightly different rules used for enablement
and loading. Fixes #22000.

Tested with:
- the report in #22000, it now says:
$ SYSTEMD_LOG_LEVEL=debug systemctl --root=/ enable test.service
Suspicious symlink /etc/systemd/system/test.service→/etc/systemd/system/myown.d/test.service, treating as alias.
unit_file_resolve_symlink: self-alias: /etc/systemd/system/test.service → test.service, ignoring.
running_in_chroot(): Permission denied
Suspicious symlink /etc/systemd/system/test.service→/etc/systemd/system/myown.d/test.service, treating as alias.
unit_file_resolve_symlink: self-alias: /etc/systemd/system/test.service → test.service, ignoring.
Failed to enable unit, refusing to operate on linked unit file test.service

- a symlink to /dev/null:
...
unit_file_resolve_symlink: linked unit file: /etc/systemd/system/test3.service → /dev/null
Failed to enable unit, unit /etc/systemd/system/test3.service is masked.

- the same from the host:
...
unit_file_resolve_symlink: linked unit file: /var/lib/machines/rawhide/etc/systemd/system/test3.service → /var/lib/machines/rawhide/dev/null
Failed to enable unit, unit /var/lib/machines/rawhide/etc/systemd/system/test3.service is masked.

- through the manager:
$ sudo systemctl enable test.service
Failed to enable unit: Refusing to operate on alias name or linked unit file: test.service
$ sudo systemctl enable test3.service
Failed to enable unit: Unit file /etc/systemd/system/test3.service is masked.

As seen in the first example, the warning is repeated. This is because we call
the lookup logic twice: first for sysv-compat, and then again for real. I think
that since this is only for broken setups, and when sysv-compat is enabled, and
in an infrequent manual operation, at debug level, this is OK.
2022-03-29 16:16:02 +02:00
Zbigniew Jędrzejewski-Szmek
48542eac39 basic/stat-util: add null_or_empty_path_with_root() 2022-03-29 15:07:05 +02:00
Zbigniew Jędrzejewski-Szmek
9825181143 basic/unit-file: split out the subroutine for symlink verification
The old logs used __func__, but this doesn't make sense now, because the
low-level function will be used in other places. So those are adjusted to be
more generic.
2022-03-29 14:19:28 +02:00
Heiko Becker
43a5fd98a5 meson: Detect python instead of hard-coding python3
It allows to specify the desired python executable (and version) via
meson's native file if there are multiple versions available.
2022-03-23 22:15:23 +09:00
Frantisek Sumsal
4da5e99a8f Revert "lgtm: disable cpp/missing-return"
This reverts commit 6f4bffb586.

Should be, hopefully, fixed by https://github.com/github/codeql/issues/8409.
2022-03-23 22:11:24 +09:00
Lennart Poettering
13a5ffa477 doc: two markdown markup fixes 2022-03-23 13:47:15 +01:00
Lennart Poettering
3f4ead8d5f doc: add a bunch of missing <br> 2022-03-23 13:44:25 +01:00
Yu Watanabe
904447ce5a
Merge pull request #22835 from keszybz/foreach_string-inline-iterator
Inline the iterator declaration in FOREACH_STRING
2022-03-23 21:43:02 +09:00
Zbigniew Jędrzejewski-Szmek
5c09daf8ff
Merge pull request #22836 from poettering/more-build-image-docs
docs: more tweaks for the image building docs
2022-03-23 12:42:47 +01:00
Lennart Poettering
f1a147f2be update TODO 2022-03-23 12:29:20 +01:00
Lennart Poettering
3976da0265 docs: extend BUILDING_IMAGES with a section about IMAGE_ID=/IMAGE_VERSION=
Also, beef up links everywhere.
2022-03-23 12:25:01 +01:00
Lennart Poettering
8f39ecf6aa docs: link up new image building docs a bit 2022-03-23 12:25:01 +01:00
Lennart Poettering
a43d2229bb docs: make man page links in markdown Links section use teletype font, as we usually do 2022-03-23 12:25:01 +01:00
Zbigniew Jędrzejewski-Szmek
b9fbff7403 systemctl: use the right name in error message 2022-03-23 11:50:18 +01:00
Zbigniew Jędrzejewski-Szmek
5980d46304 strv: declare iterator of FOREACH_STRING() in the loop
Same idea as 03677889f0.

No functional change intended. The type of the iterator is generally changed to
be 'const char*' instead of 'char*'. Despite the type commonly used, modifying
the string was not allowed.

I adjusted the naming of some short variables for clarity and reduced the scope
of some variable declarations in code that was being touched anyway.
2022-03-23 11:50:18 +01:00
Lennart Poettering
24f0c62df5
Merge pull request #22791 from keszybz/bootctl-invert-order
Invert order of entries w/o sort-key in sd-boot menu
2022-03-23 11:39:31 +01:00
Lennart Poettering
5b39139582
Merge pull request #22629 from nishalkulkarni/oomd_service_result
core/oomd: Use oom-kill ServiceResult for oomd
2022-03-23 10:11:45 +01:00
Yu Watanabe
7a692931ab sysupdate: fix error handling 2022-03-23 16:52:55 +09:00
Yu Watanabe
60f53dd5cc NEWS: fix typo 2022-03-23 12:22:53 +09:00
Yu Watanabe
ff8619791a boot: fix typo 2022-03-23 12:21:54 +09:00
Lennart Poettering
4d5dacbef3 fs-util: make sure openat_report_new() initializes return param also on shortcut
Our coding style dictates that return parameters should be initialized
always on success, hence do so here also in the shortcut codepath.

Issue discovered by @fbuihuu:

ca8503f168 (r831911069)
2022-03-23 11:38:08 +09:00
Lennart Poettering
b312236919 fs-util: fix typos in comments 2022-03-23 11:38:08 +09:00
Zbigniew Jędrzejewski-Szmek
77d45f1f83 meson: replace sh+find with an internal glob in the python helper
As suggested in https://github.com/systemd/systemd/pull/22810#discussion_r831708052

This makes the whole thing simpler. A glob is passed to helper which then resolves
it on its own. This way it's trivial to call the helper with a different
set of files for testing.
2022-03-23 11:37:35 +09:00
Yu Watanabe
14acae357b
Merge pull request #22825 from keszybz/assorted-cleanups
Assorted cleanups
2022-03-23 11:34:46 +09:00
Luca Boccassi
a8c122c4cb NEWS: adjust MONITOR_ env vars paragraph
This actually never shipped in a release, so it's not a backward-incompatible
change. Move it down and reword it.
2022-03-22 23:03:23 +00:00
Zbigniew Jędrzejewski-Szmek
00b29ca143 NEWS: initial writeup for v251 2022-03-22 21:21:01 +01:00
Luca Boccassi
961758c750
Merge pull request #22821 from poettering/udev-tweaklets
Udev tweaklets
2022-03-22 20:17:38 +00:00
Lennart Poettering
6538c0efca docs: add some docs about building OS images
It's not trivial to know what to reset how. Let's document this a bit.
2022-03-22 18:10:39 +01:00
Zbigniew Jędrzejewski-Szmek
5cad4c70e3 homework: s/EWOULDBLOCK/EAGAIN/
C.f. 012d7b4217, ff55c3c732,
ca2031fcc8.
2022-03-22 14:07:53 +01:00
Zbigniew Jędrzejewski-Szmek
16568fd336 errno-to-awk: simplify expression
No functional change.
2022-03-22 14:07:53 +01:00
Zbigniew Jędrzejewski-Szmek
dba8ef106e sd-bus: use _cleanup_ in one more place 2022-03-22 14:07:53 +01:00
Zbigniew Jędrzejewski-Szmek
3b9d38f5c8 tools/dbus_exporter: deblackify and shorten code a bit
When we do mkdir, we should just use 0o777 and let the umask take care of the
rest. Specifying an explicit mode is inappropriate. And when touching the code,
let's replace black madness with normal python style.
2022-03-22 14:07:53 +01:00
Zbigniew Jędrzejewski-Szmek
94f7ee9770 man: clarify that options set the message fields and are not derived from them 2022-03-22 14:07:53 +01:00
Zbigniew Jędrzejewski-Szmek
93efd9cadb
Merge pull request #22778 from poettering/kernel-install-layout-rework
kernel-install/bootctl: layout fixes
2022-03-22 13:57:28 +01:00
Nishal Kulkarni
2e3591a4fd man: Mention systemd-oomd now follows OOMPolicy 2022-03-22 18:04:52 +05:30
Nishal Kulkarni
c0ebfef358 test/oomd: Add test for new oomd_ooms xattr
Check if `user.oomd_ooms` xattr is being set as part of `oomd_cgroup_kill()`
this xattr tracks OOM kills that were initiated by systemd-oomd.
2022-03-22 18:04:35 +05:30
Nishal Kulkarni
38c41427c7 core/oomd: Use oom-kill ServiceResult for oomd
To notify user of kill events from systemd-oomd we now use
`SERVICE_FAILURE_OOM_KILL` as the failure result.

`unit_check_oomd_kill` now calls `notify_cgroup_oom` to
update the service result to `oom-kill`.

We add a new xattr `user.oomd_ooms` to keep track of the OOM kills
initiated by systemd-oomd, this helps us resolve a race between sending
SIGKILL to processes and checking for OOM kill status from the xattr.

Related to: #20649
2022-03-22 17:57:59 +05:30
Lennart Poettering
63aac21c5e sd-device: use path_compare() rather than strcmp() for sorting paths
When sorting paths it actually matters to use the right comparison
function. Example:

```
a/x
a-b/y
a_/z
```

I think people would probably expect this:

```
a/x
a-b/y
a_a/z
```

but if you use strcmp() instead of path_compare() you'd instead get:

```
a-b/y
a/x
a_a/z
```

That's because `/` is between `-` and `a` in the ascii table. I think
that's quite confusing, and we shouldn#t order that way hence.

As discussed: https://github.com/systemd/systemd/pull/22662#discussion_r831174776
2022-03-22 13:10:41 +01:00
Lennart Poettering
a3f47f48b0 sd-device: fix trivial typo 2022-03-22 13:10:40 +01:00
Lennart Poettering
c0f6a6a542
Merge pull request #22662 from yuwata/udev-trigger-priority
udevadm trigger: add --prioritized-subsystem option
2022-03-22 12:56:32 +01:00
Jason A. Donenfeld
d328346944 random-util: use correct minimum pool size constant
The actual minimum size of the pool across supported kernel versions is
32 bytes. So adjust this minimum.

I've audited every single usage of random_pool_size(), and cannot see
anywhere that this would have any impact at all on anything. We could
actually just not change the constant and everything would be fine, or
we could change it here and that's fine too. From both a functionality
and crypto perspective, it doesn't really seem to make a substantive
difference any which way, so long as the value is ≥32. However, it's
better to be correct and have the function do what it says, so clamp it
to the right minimum.
2022-03-22 08:46:20 +01:00
Zbigniew Jędrzejewski-Szmek
8bab619383
Merge pull request #22813 from poettering/sd-boot-man-fixes
man: some sd-boot doc tweaks
2022-03-22 08:26:57 +01:00
Danilo Krummrich
678f2b1667 udevadm: trigger: implement --initialized-match/nomatch arguments
systemd-udev-trigger.service by default triggeres all devices regardless
of whether they were already recognized by systemd-udevd.

There are machines (especially in embedded environments) where
systemd-udev-trigger.service is configured to run at a later stage of
the boot sequence, which can lead to quite a lot of devices being
triggered although they were already recognized by systemd-udevd.

Re-triggering a lot of devices is a relatively expensive operation and
therefore should be avoided if unnecessary.

Therefore this patch introduces --initialized-nomatch, which filters out
devices that are already present in the udev database. For consistance
reasons --initialized-match is implemented as well, which filters out devices
that are *not* already present in the udev database.

Replaces #19949.
2022-03-22 15:54:10 +09:00
Yu Watanabe
d8b50e5df7 sd-device-enumerator: support to list only initialized or uninitialized devices 2022-03-22 15:27:06 +09:00
Yu Watanabe
2336bde964 unit: make systemd-udev-trigger.service use --prioritized-subsystem
Replaces #19637 and #22643.
2022-03-22 15:27:06 +09:00
Yu Watanabe
1baeee5784 udevadm trigger: introduce --type=all option 2022-03-22 15:27:06 +09:00