1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-05-22 18:50:15 +03:00

58144 Commits

Author SHA1 Message Date
igo95862
efd8e39f4a test-bus-objects: Test GetManagedObjects interfaces are correct
Objects without ObjectManager should not have
`org.freedesktop.DBus.ObjectManager` interface.

Object with ObjectManager should do.

Also added ASSERT_SE_NONNEG and ASSERT_NONNEG macros.

(cherry picked from commit 724e13b346990be85c4bc332c78f29ed7ce83121)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
344efd022a coredump: when parsing json, optionally copy the string first
(cherry picked from commit 87707784c70dc9894ec613df0a6e75e732a362a3)
2022-10-01 19:05:54 +02:00
Christian Hesse
de08edca17 systemctl: color ignored exit status in yellow, not red
If the executable path is prefixed with "-", an exit code of the command
normally considered a failure (i.e. non-zero exit status or abnormal exit
due to signal) is recorded, but has no further effect and is considered
equivalent to success.

Let's honor this with `systemctl status`, and color ignored exit status
in yellow, not red.

(cherry picked from commit e879434df550c6dcfc02f23e613f4dda7f741089)
2022-10-01 19:05:54 +02:00
Lennart Poettering
1531a496e3 manager: make clear internal Dump() logic is debugging only.
(cherry picked from commit acf2de52171106f7084e9410f4cc838b9a4183dd)
2022-10-01 19:05:54 +02:00
Lennart Poettering
c4fd38f7d2 man: document the Dump() calls of the PID 1 D-Bus interface, and what they are
(cherry picked from commit 0df8512124b05ed2d3be1537a4023e89ec33f0f7)
2022-10-01 19:05:54 +02:00
Yu Watanabe
140fee4627 resolve: do not cache mDNS goodbye packet
Fixes #24842.

(cherry picked from commit a78049fc0e6a75446cb782b548ae9db8edf7a107)
2022-10-01 19:05:54 +02:00
Adam Williamson
1a2d93a770 kbd-model-map: correct variants for cz-qwerty to include comma
As explained by @poncovka , the 'xvariant' string should contain
the same number of comma-separated elements as 'xlayout'. When
we have two layouts we need two items in xvariant, in this case
one of them is empty.

See https://github.com/rhinstaller/anaconda/pull/4355#pullrequestreview-1119913870
for @poncovka's full explanation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit 950aeeb8ffc950637fac22cb5a42074f227d57f3)
2022-10-01 19:05:54 +02:00
msizanoen1
9d1ebb2247 resolve: persist DNSOverTLS configuration in state file
Currently, NetworkManager will set DNSOverTLS according to its
`connection.dnsovertls` configuration only once during connection,
instead of every single restart of systemd-resolved, causing resolved to
lose the configuration on restart.

Fix this by persisting DNSOverTLS in the runtime state file, which will
also make it more consistent with other interface-specific settings.

(cherry picked from commit b49e029a9953dd0f327efe9035a7c429c3cfeb92)
2022-10-01 19:05:54 +02:00
Yu Watanabe
3137ac6ef5 udev: support by-path devlink for multipath nvme block devices
If multipath feature is enabled, nvme block devices may belong to the
"nvme-subsystem" subsystem, instead of "nvme" subsystem.
(What a confusing name...)

Then, the syspath is something like the following,
    /sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
Hence, we need to find the 'real parent' device, such as
    /sys/devices/pci0000:00/0000:00:1c.4/0000:3c:00.0/nvme/nvme0

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2031810.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2124964.
Replaces #24748.

(cherry picked from commit 67c3e1f63a5221b47a8fea85ae421671f29f3b7e)
2022-10-01 19:05:54 +02:00
Lennart Poettering
c948091cc5 run: make --working-directory= work for --scope too
This sounds like a more user-friendly alternative to #24780

(cherry picked from commit fecc44776638a24099ce7e9ac227bcaa2c34f1e0)
2022-10-01 19:05:54 +02:00
Adam Williamson
7bb204620d kbd-model-map: add a mapping for switched czech qwerty/us
See https://bugzilla.redhat.com/show_bug.cgi?id=2121106 for the
background on this. One of Fedora's QA folks ran an install
and chose two keyboard layouts: Czech (qwerty) and US. Due to
the sad details of how the whole logic flow for trying to decide
what kbd layout best matches a given xkb config works (see
details in the bug comments), we wound up deciding the best-
matching kbd layout for this situation was cz-us-qwertz, which
is a czech/us switched layout, but is qwertz, not qwerty. This
seems like a poor outcome. Adding this line should result in us
picking cz-qwerty in this case. Which may be the 'legacy'
cz-qwerty.map from upstream kbd project (which is switched
cz/us), or may be the auto-converted xkb layout (which obviously
isn't switched). But either way, at least its primary mode is
Czech qwerty, which seems like a *better* choice than a layout
whose primary mode is Czech qwertz.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit 97f99506980d92e858dc4685a2e84d9548d6eca4)
2022-10-01 19:05:54 +02:00
Yu Watanabe
e5157050d1 test: add more test cases for mkdir_p_safe() and mkdir_p_root()
(cherry picked from commit f8d5048dbf633f1bcccedbd337d751b33c5996a2)
2022-10-01 19:05:54 +02:00
Yu Watanabe
b3a9f7b5cb mkdir: chase_symlinks_and_stat() does not return 0
This reverts commits e22916e61d1fdb7b46918b605ebf783d9017f9d8 and
1e146d738232acbe7f72903e9c5e4d1166ea67f5.

(cherry picked from commit f1d93b84bcc7c722a03928587023b144d4cc5e48)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
0bfdc91807 units: make sure that initrd-switch-root.service pulls in .target
Normally we queue initrd-switch-root.target/isolate, which pulls in the
service via Wants= in the .target unit file. But if the service is instead
started directly, there may be nothing pulling in the target. Let's make
sure that the reference exists.

(cherry picked from commit 5b5ec138c65d587ecac1be5790ab9854e49a0446)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
45fb64c54b units: add dependency ordering for emergency.service conflicts
If we want to stop those services which would compete for access to
the console, we need to have an ordering so that they are actually
stopped before the other things starts, not asynchronously.

(cherry picked from commit 3449814b8bda96e0a7d14fe1287f85ba9b269d8e)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
6535813084 units: add ordering dependencies on initrd-switch-root.target
For shutdown, we queue shutdown.target/start, so in every unit which should be
stopped *before* shutdown, we need both Conflicts and an ordering dependency
with shutdown.target (either Before= or After= would work, because stop jobs
are always ordered before start jobs).

For initrd transition, we queue initrd-switch-root.service/isolate. This
automatically creates a /stop job for every running unit without
IgnoreOnIsolate. But no ordering dependency is created, unless the unit has a
(possibly transitive) ordering dependency on initrd-switch-root.service.
Since most units must stop before the transition, we should add the ordering
dependency. It is nicer to use Before=initrd-switch-root.target for this.
initrd-switch-root.target is ordered before initrd-switch-root.service, so
the effect it the same when both are in a transaction.

Fixes #23745.

To also cover the case where somebody is emergency mode in the initrd and
queues initrd-switch-root.service/start (not isolate), also add
Conflicts=initrd-switch-root.target, so various units are stopped properly.
This extends 2525682565b372b9b83c848bfe89c025fed47a1d to cover all the other
services that are touched. It could be consider "operator error", but it's
easy to make and it's nicer if we can make this more foolproof.

(cherry picked from commit 7c0e2b555968d70ac563a37e32a6931ee90961a6)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
09c90224f1 units/systemd-network-generator.service: add forgotten ordering for shutdown
(cherry picked from commit d5fd07cdeef104fdf4e1e1f9e60ff7ccb4669623)
2022-10-01 19:05:54 +02:00
Zbigniew Jędrzejewski-Szmek
1dd723a3b8 units: reorder/split unit dependency blocks
The block is reordered and split to have:
  1. description + documentation
  2. (optionally) conditions
  3. all the dependencies
I think it's easier to read the units this way.
Also, the Conflicts+Before is seperated out to separate lines.
The ordering dependency is "fake", because it could just as well be
After=, we are adding it to force ordering wrt. shutdown.target, and
it plays a different role than the other Before=, which are about a
real ordering on boot.

(cherry picked from commit 9810e419425263bde86787bc21251f1ad3c35628)
2022-10-01 19:05:54 +02:00
Yu Watanabe
054cad0097 man: explicitly document that "reboot -f" is different from "systemctl reboot -f"
Closes #24696.

(cherry picked from commit cb19517490104553907bb0b118cd2005d6e379cc)
2022-10-01 19:05:54 +02:00
Yu Watanabe
c5b0ae86b1 watchdog: use /dev/watchdog0 only if it exists
Fixes #24661.

(cherry picked from commit a6b7ebaafa73205f4fc80dd307013fb714ebbd76)
2022-10-01 19:05:54 +02:00
Daniel Braunwarth
ac805eac15 journalctl: respect --quiet flag during file concistency verification
Fixes #24563.

(cherry picked from commit 43deb1a8dce012c67a1285f7ef1bd40d971a4730)
2022-10-01 19:05:54 +02:00
David Edmundson
c1d729795d xdg-autostart-service: expand tilde in Exec lines
In typical desktop file parsing it is expected that "~" expands to a
home directory.

Users may write an autostart file with "Exec=myCoolService
~/.someSpecialConfig" which worked before the systemd migration.

(cherry picked from commit 8c0a6a96fe04f97966b86ec91ee4502f5d4fa8d8)
2022-10-01 19:05:54 +02:00
Yu Watanabe
35c5f5d688 unit: drop ProtectClock=yes from systemd-udevd.service
This partially reverts cabc1c6d7adae658a2966a4b02a6faabb803e92b.

The setting ProtectClock= implies DeviceAllow=, which is not suitable
for udevd. Although we are slowly removing cgropsv1 support, but
DeviceAllow= with cgroupsv1 is necessarily racy, and reloading PID1
during the early boot process may cause issues like #24668.

Let's disable ProtectClock= for udevd. And, if necessary, let's
explicitly drop CAP_SYS_TIME and CAP_WAKE_ALARM (and possibly others)
by using CapabilityBoundingSet= later.

Fixes #24668.

(cherry picked from commit f562abe2963bad241d34e0b308e48cf114672c84)
2022-10-01 19:05:54 +02:00
Sebastian Scheibner
175ba30cf6 busctl: Fix warning about invaild introspection data
The set_put function returns 0 if the element is already in the set and
not EEXIST, like e.g. hashmap does.

(cherry picked from commit bdff06de069fc83f18a126bf6b899ae2341572c3)
2022-10-01 19:05:54 +02:00
Yu Watanabe
6c7b91372d udev/rules,hwdb: filter out mostly meaningless default strings
The filter is generated based on the following results:
---
git clone git@github.com:linuxhw/DMI.git
cd DMI
git grep -h -A2 '^System Information$' | grep 'Manufacturer' | sort | uniq -c | sort -nr | less
git grep -h -A2 '^System Information$' | grep 'Product Name' | sort | uniq -c | sort -nr | less
---

Closes #24446.

(cherry picked from commit 0cf2dcf15402c60498165dbd3f14536766c05051)
2022-10-01 19:05:54 +02:00
Lennart Poettering
8b89e677e9 units: prolong the stop timeout for homed
Let's give IO/resizing/… more time then usual.

Fixes: #22901
(cherry picked from commit d3d2dd5e4f07c5d513c06df69f2c214681ddcd2a)
2022-10-01 19:05:54 +02:00
Lennart Poettering
202a79e7c5 homed: don't wait indefinitely for workers on exit
Let's put some time-limit on it.

Fixes: #22901
(cherry picked from commit f8f621821a30b5b7e6c69dfb770e1c4cbc3db715)
2022-10-01 19:05:54 +02:00
Jade Bilkey
44660d2e12 man: fix static bridge example
A NetDev is needed to create the bridge in order to match the example's description "This creates a bridge..."

(cherry picked from commit bc33789a06e5a727fa4662b0dfcbe02ef7e46687)
2022-10-01 19:05:54 +02:00
Lennart Poettering
e0dde8a14f log: don't attempt to duplicate closed fd
if the console fd is not open we shouldn#t try to move it out of the 0…2
range.

Fixes: #24535
Alternative-for: #24537
(cherry picked from commit f1ee066840eea748ad4074ac2bc859bb897953b9)
2022-10-01 19:05:54 +02:00
Daniel Braunwarth
254b77e73c condition: fix device-tree firmware path
The path /sys/firmware/device-tree doesn't exist. This should be either
/proc/device-tree or /sys/firmware/devicetree.

The first path is only a link. So lets use the second path.

See https://github.com/torvalds/linux/blob/v4.14/drivers/of/base.c#L218.

(cherry picked from commit 1037178acfd093fb10d8f5e74f3072f78afdf7e8)
2022-10-01 19:05:54 +02:00
Yu Watanabe
96da39ddb1 udev-util: minor cleanups for on_ac_power()
Follow-ups for #24420.

(cherry picked from commit 8676bdb70842ebb8d55fcc50774ba69f8a14b51a)
2022-10-01 19:05:54 +02:00
Uriel Corfa
3345520512 docs: fix incorrect env var name for credentials directory
CREDENTIAL_PATH appears nowhere in the systemd source code.
$CREDENTIALS_DIRECTORY is what is used instead.

(cherry picked from commit c0a18932dc487e863c9141f8b6a6a829f2f391c7)
2022-10-01 19:05:53 +02:00
Yu Watanabe
49f9fa87b2 shell-completion: drop unused $mode
Fixes #24473.

(cherry picked from commit c4c9714464a0e8138f247405c3a52bab00f60781)
2022-10-01 19:05:53 +02:00
Nick Rosbrook
1e29d934de oomd: fix off-by-one when dumping kill candidates
When we kill a cgroup that is towards the end of the sorted candidate
list (i.e. when we have to resort to killing a candidate with
ManagedOOMPreference=avoid), this cgroup is not logged in the candidate
list. This is due to an off-by-one error when assigning dump_until.

(cherry picked from commit b814de305445f59baa289ab926cbe6ca05ac26a4)
2022-10-01 19:05:53 +02:00
Zbigniew Jędrzejewski-Szmek
b00cb050c8 on-ac-power: ignore devices with scope==Device
My mouse is reported as:

P: /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4:1.2/0003:046D:C52B.001E/0003:046D:4051.001F/power_supply/hidpp_battery_4
M: hidpp_battery_4
R: 4
U: power_supply
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4:1.2/0003:046D:C52B.001E/0003:046D:4051.001F/power_supply/hidpp_battery_4
E: SUBSYSTEM=power_supply
E: POWER_SUPPLY_NAME=hidpp_battery_4
E: POWER_SUPPLY_TYPE=Battery
E: POWER_SUPPLY_ONLINE=1
E: POWER_SUPPLY_STATUS=Discharging
E: POWER_SUPPLY_SCOPE=Device
E: POWER_SUPPLY_MODEL_NAME=Wireless Mouse M510
E: POWER_SUPPLY_MANUFACTURER=Logitech
E: POWER_SUPPLY_SERIAL_NUMBER=4051-bc-cd-d2-5b
E: POWER_SUPPLY_CAPACITY_LEVEL=Normal

See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=25a0bc2dfc2ea732f40af2dae52426ead66ae76e
Effectively, "System" and "Unkown" are passed through, "Device" is rejected.

(cherry picked from commit 3c69e94a5ce8076fa1240028f24d9b4ba1b67408)
2022-10-01 19:05:53 +02:00
Zbigniew Jędrzejewski-Szmek
9886011356 on-ac-power: rework logic
History of the function:
96788d2aa4f4b0b49874b4a240ce47d9e8485d1b assume system is running on AC power when no battery found
795e86b4f1e8a1fd440f8c817621779c6aedbdb5 ignore USB-C ports in power source mode when detecting system is running on AC power
c19a51bec40ae5e5073464e72411e7920d05d683 invert ac_power() source type check
6d89003462484c8656b698e07b9cf0a337e3818e assume ac when /sys/class/power_supply is missing
240dbaa44f8e5ad51775c776fc3ce9cd2f19f037 add ConditionACPower=

Interestingly, the return condition 'on_ac_power == found_online || !found_offline'
was there from the very beginning, and even Yu's latest change doesn't change this,
but only extends it to 'on_ac_power == found_online || !found_offline || !found_battery'.
This means that any system with no AC power supply will be unconditionally classified
as on_ac_power.

Let's change the logic: if we have an online AC supply, answer is "yes". If no
supplies, but we have a battery, answer is "no". Otherwise, assume "yes", based
on the assumption that presense of a battery would at least be always reported,
even if an AC power supply might not be.

Fixes #24407. It also shouldn't impact previous fixes: assume ac when
/sys/class/power_supply is missing, ignore USB-C ports in power source mode,
assume system is running on AC power when no battery found.

(cherry picked from commit 4a52514b371bf8013e89c421dfc2405a443feef8)
2022-10-01 19:05:53 +02:00
Zbigniew Jędrzejewski-Szmek
1fc74d251e sd-device: add helper to read a unsigned int attribute
There are dozens of places where this could be used, but I don't
want to do the conversion now because it's quite a bit of work.
I think we could export this function later on, because reading
numerical attributes is so common. But for now, I'm just adding the
helper to use it one place.

(cherry picked from commit 48a511cf92cbf202e9ef6064a9b5ebd1f497e1a8)
2022-10-01 19:05:53 +02:00
Zbigniew Jędrzejewski-Szmek
6d4c138534 shared/udev-util: say "ignoring device", not "ignoring"
The short form sounds like we're ignoring the error.

(cherry picked from commit 406fbeca32d9abacdcc28b0cc00d2beefcc4feb2)
2022-10-01 19:05:53 +02:00
Zhaofeng Li
cd2fad2300 virt: Support detection of Apple Virtualization.framework guests
(cherry picked from commit f5558306746c0791dab666e76d51e7ef1ce38362)
2022-10-01 19:05:53 +02:00
Yu Watanabe
6e47e75c86 virt: align tables
(cherry picked from commit 5c86cec1f3466b2f4ed169fd3f32e944a0bca06e)
2022-10-01 19:05:53 +02:00
David Jaša
951e99231e check-os-release.py compatible with Python < 3.8
The ":=" operator was only added in Python 3.8 so splitting the line with it into two makes check-os-release.py actually fulfill its claim of working with any python version.

(cherry picked from commit ce0a056abc41168e1b45537505ca9f65bf6f5c30)
2022-10-01 19:05:53 +02:00
Yu Watanabe
d572a74163 core/mount: adjust deserialized state based on /proc/self/mountinfo
Fixes #23796.
Replaces #23803 and #23851.

(cherry picked from commit 01400460ae16c6522d11d08dd9a4b0928e7980d9)
2022-10-01 19:05:53 +02:00
Goffredo Baroncelli
2e372afc35 Allow uneven length BootXXXX variables
The BootXXXX variables may have an uneven length. Don't return error
in this case.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
(cherry picked from commit 046f101bf6ecbe2c18fd969760256ada3e6230f0)
2022-10-01 19:05:53 +02:00
Yu Watanabe
8ad143e684 gpt: fix native uuids for s390x
__s390__ is defined for both s390 and s390x. Hence, we need to define
the native uuids for s390x at first.

(cherry picked from commit 4565246911adbdd1b20d8944c0754772788a768c)
2022-10-01 19:05:53 +02:00
Yu Watanabe
2bb9a0a29b udev: fix inversed inequality for timeout of retrying event
Follow-up for 5d354e525a56955ae7f68062e283dda85ab07794.

(cherry picked from commit 400e3d21f8cae53a8ba9f9567f244fbf6f3e076c)
2022-10-01 19:05:53 +02:00
Antonio Alvarez Feijoo
cf67d5ed1b bash-completion: add systemd-sysext support
(cherry picked from commit aa2118cb0b5478c6b8a30f8c55507ee5d5854943)
2022-10-01 19:05:53 +02:00
Antonio Alvarez Feijoo
ada437cfb1 sysext: add missing COMMAND to the help output and man synopsis
(cherry picked from commit 782e41ab8891673575ec03366d17d5e5c1da7b0d)
2022-10-01 19:05:53 +02:00
Yu Watanabe
58bc1e8e04 hostname: make chassis type actually obtained from ACPI when nothing from DMI
Fixes a bug introduced by 8c8b1800e90d4307397300ef32b0f6d95efad057.

Fixes #24384.

(cherry picked from commit 471fdebfdea843648acb5abeacf5ae559c3ad77a)
2022-10-01 19:05:53 +02:00
Zbigniew Jędrzejewski-Szmek
4ffde70981 booctl: do not say uuids differ if one of the uuids is unset
We allow ESP autodetection to fail, e.g. if it is not mounted, but then we'd
say that the detected one is different than the one reported by the bootloader,
which is rather confusing.

While at it, if we actually detect a mismatch, print the two uuids.

(cherry picked from commit 22e54dd6de4d0be41ab70e0a94d7bd273e47c60a)
2022-10-01 19:05:53 +02:00
Luca Boccassi
5219a99ccb bash-completion: autocomplete cgroup names in systemd-cgtop
(cherry picked from commit 0a152619aca5b6c16d022cc3e6ab2fc3786d0284)
2022-10-01 19:05:53 +02:00