1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-10 01:17:44 +03:00
Commit Graph

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 724e13b346)
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 87707784c7)
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 e879434df5)
2022-10-01 19:05:54 +02:00
Lennart Poettering
1531a496e3 manager: make clear internal Dump() logic is debugging only.
(cherry picked from commit acf2de5217)
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 0df8512124)
2022-10-01 19:05:54 +02:00
Yu Watanabe
140fee4627 resolve: do not cache mDNS goodbye packet
Fixes #24842.

(cherry picked from commit a78049fc0e)
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 950aeeb8ff)
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 b49e029a99)
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 67c3e1f63a)
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 fecc447766)
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 97f9950698)
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 f8d5048dbf)
2022-10-01 19:05:54 +02:00
Yu Watanabe
b3a9f7b5cb mkdir: chase_symlinks_and_stat() does not return 0
This reverts commits e22916e61d and
1e146d7382.

(cherry picked from commit f1d93b84bc)
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 5b5ec138c6)
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 3449814b8b)
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 2525682565 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 7c0e2b5559)
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 d5fd07cdee)
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 9810e41942)
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 cb19517490)
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 a6b7ebaafa)
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 43deb1a8dc)
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 8c0a6a96fe)
2022-10-01 19:05:54 +02:00
Yu Watanabe
35c5f5d688 unit: drop ProtectClock=yes from systemd-udevd.service
This partially reverts cabc1c6d7a.

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 f562abe296)
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 bdff06de06)
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 0cf2dcf154)
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 d3d2dd5e4f)
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 f8f621821a)
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 bc33789a06)
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 f1ee066840)
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 1037178acf)
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 8676bdb708)
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 c0a18932dc)
2022-10-01 19:05:53 +02:00
Yu Watanabe
49f9fa87b2 shell-completion: drop unused $mode
Fixes #24473.

(cherry picked from commit c4c9714464)
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 b814de3054)
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 3c69e94a5c)
2022-10-01 19:05:53 +02:00
Zbigniew Jędrzejewski-Szmek
9886011356 on-ac-power: rework logic
History of the function:
96788d2aa4 assume system is running on AC power when no battery found
795e86b4f1 ignore USB-C ports in power source mode when detecting system is running on AC power
c19a51bec4 invert ac_power() source type check
6d89003462 assume ac when /sys/class/power_supply is missing
240dbaa44f 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 4a52514b37)
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 48a511cf92)
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 406fbeca32)
2022-10-01 19:05:53 +02:00
Zhaofeng Li
cd2fad2300 virt: Support detection of Apple Virtualization.framework guests
(cherry picked from commit f555830674)
2022-10-01 19:05:53 +02:00
Yu Watanabe
6e47e75c86 virt: align tables
(cherry picked from commit 5c86cec1f3)
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 ce0a056abc)
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 01400460ae)
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 046f101bf6)
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 4565246911)
2022-10-01 19:05:53 +02:00
Yu Watanabe
2bb9a0a29b udev: fix inversed inequality for timeout of retrying event
Follow-up for 5d354e525a.

(cherry picked from commit 400e3d21f8)
2022-10-01 19:05:53 +02:00
Antonio Alvarez Feijoo
cf67d5ed1b bash-completion: add systemd-sysext support
(cherry picked from commit aa2118cb0b)
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 782e41ab88)
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 8c8b1800e9.

Fixes #24384.

(cherry picked from commit 471fdebfde)
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 22e54dd6de)
2022-10-01 19:05:53 +02:00
Luca Boccassi
5219a99ccb bash-completion: autocomplete cgroup names in systemd-cgtop
(cherry picked from commit 0a152619ac)
2022-10-01 19:05:53 +02:00