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

55919 Commits

Author SHA1 Message Date
Adam Williamson
40766f6a48 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)
(cherry picked from commit 7bb204620d)
2022-11-04 13:02:21 +01:00
Yu Watanabe
0ae11d2942 test: add more test cases for mkdir_p_safe() and mkdir_p_root()
(cherry picked from commit f8d5048dbf)
(cherry picked from commit e5157050d1)
2022-11-04 13:02:21 +01:00
Yu Watanabe
259a84d5c2 mkdir: chase_symlinks_and_stat() does not return 0
This reverts commits e22916e61d and
1e146d7382.

(cherry picked from commit f1d93b84bc)
(cherry picked from commit b3a9f7b5cb)
2022-11-04 13:02:21 +01:00
Daniel Braunwarth
bb2d46fc68 journalctl: respect --quiet flag during file concistency verification
Fixes #24563.

(cherry picked from commit 43deb1a8dc)
(cherry picked from commit ac805eac15)
2022-11-04 13:02:21 +01:00
Sebastian Scheibner
6fd508a3ae 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)
(cherry picked from commit 175ba30cf6)
2022-11-04 13:02:21 +01:00
Lennart Poettering
7831972971 units: prolong the stop timeout for homed
Let's give IO/resizing/… more time then usual.

Fixes: #22901
(cherry picked from commit d3d2dd5e4f)
(cherry picked from commit 8b89e677e9)
2022-11-04 13:02:21 +01:00
Lennart Poettering
7c2a025984 homed: don't wait indefinitely for workers on exit
Let's put some time-limit on it.

Fixes: #22901
(cherry picked from commit f8f621821a)
(cherry picked from commit 202a79e7c5)
2022-11-04 13:02:21 +01:00
Jade Bilkey
559e851a95 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)
(cherry picked from commit 44660d2e12)
2022-11-04 13:02:21 +01:00
Lennart Poettering
40cedddab7 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)
(cherry picked from commit e0dde8a14f)
2022-11-04 13:02:21 +01:00
Daniel Braunwarth
ba29bb342d 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)
(cherry picked from commit 254b77e73c)
2022-11-04 13:02:21 +01:00
Yu Watanabe
e22632a9da udev-util: minor cleanups for on_ac_power()
Follow-ups for #24420.

(cherry picked from commit 8676bdb708)
(cherry picked from commit 96da39ddb1)
2022-11-04 13:02:21 +01:00
Yu Watanabe
deb03fe7e5 shell-completion: drop unused $mode
Fixes #24473.

(cherry picked from commit c4c9714464)
(cherry picked from commit 49f9fa87b2)
2022-11-04 13:02:21 +01:00
Zbigniew Jędrzejewski-Szmek
1f5ccc9931 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)
(cherry picked from commit b00cb050c8)
2022-11-04 13:02:21 +01:00
Zbigniew Jędrzejewski-Szmek
9e62e7facb 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)
(cherry picked from commit 9886011356)
2022-11-04 13:02:21 +01:00
Zbigniew Jędrzejewski-Szmek
3ce09d9127 shared/udev-util: say "ignoring device", not "ignoring"
The short form sounds like we're ignoring the error.

(cherry picked from commit 406fbeca32)
(cherry picked from commit 6d4c138534)
2022-11-04 13:02:20 +01:00
Zhaofeng Li
86e121dd7b virt: Support detection of Apple Virtualization.framework guests
(cherry picked from commit f555830674)
(cherry picked from commit cd2fad2300)
2022-11-04 13:02:20 +01:00
Yu Watanabe
85ec3345fc virt: align tables
(cherry picked from commit 5c86cec1f3)
(cherry picked from commit 6e47e75c86)
2022-11-04 13:02:20 +01:00
David Jaša
7cb0c3bc99 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)
(cherry picked from commit 951e99231e)
2022-11-04 13:02:20 +01:00
Yu Watanabe
d59171e362 core/mount: adjust deserialized state based on /proc/self/mountinfo
Fixes #23796.
Replaces #23803 and #23851.

(cherry picked from commit 01400460ae)
(cherry picked from commit d572a74163)
2022-11-04 13:02:20 +01:00
Goffredo Baroncelli
eb53ee4a2f 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)
(cherry picked from commit 2e372afc35)
2022-11-04 13:02:20 +01:00
Yu Watanabe
5fe4b668cd 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)
(cherry picked from commit 8ad143e684)
2022-11-04 13:02:20 +01:00
Antonio Alvarez Feijoo
683980d551 bash-completion: add systemd-sysext support
(cherry picked from commit aa2118cb0b)
(cherry picked from commit cf67d5ed1b)
2022-11-04 13:02:20 +01:00
Antonio Alvarez Feijoo
bff3edb1ca sysext: add missing COMMAND to the help output and man synopsis
(cherry picked from commit 782e41ab88)
(cherry picked from commit ada437cfb1)
2022-11-04 13:02:20 +01:00
Zbigniew Jędrzejewski-Szmek
503ebc858f 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)
(cherry picked from commit 4ffde70981)
2022-11-04 13:02:20 +01:00
Luca Boccassi
ef7b17be53 bash-completion: autocomplete cgroup names in systemd-cgtop
(cherry picked from commit 0a152619ac)
(cherry picked from commit 5219a99ccb)
2022-11-04 13:02:20 +01:00
Avram Lubkin
7ca021b87e sysusers: add fsync for passwd (#24324)
https://github.com/systemd/systemd/pull/6636 added `fsync()` when
temporary shadow, group, and gshadow files are created, but it was
not added for passwd. As far as I can tell, this seems to have been
an oversight. I'm seeing real world issues where a blank /etc/passwd
file is being created if a machine loses power early in the boot process.

(cherry picked from commit 19193b4898)
(cherry picked from commit 9f2f391153)
2022-11-04 13:02:20 +01:00
Yu Watanabe
c3fcff5291 udev/cdrom_id: check last track info
Fixes off-by-one issue.

Fixes #24306.

(cherry picked from commit 628998ecfa)
(cherry picked from commit c67a388aef)
2022-11-04 13:02:20 +01:00
bin456789
da1589db45 firstboot: fix can't overwrite timezone
(cherry picked from commit e56dc320d3)
(cherry picked from commit 52c631b02e)
2022-11-04 13:02:20 +01:00
Lennart Poettering
462b20cbd6 cryptenroll: fix memory leak
(cherry picked from commit 7e196e9aac)
(cherry picked from commit f279a6f4d1)
2022-11-04 13:02:20 +01:00
Yu Watanabe
b48a17f13f sd-device-monitor: actually refuse to send invalid devices
Fixes an issue introduced by 9e79123884.

(cherry picked from commit 8bb4989906)
(cherry picked from commit 6e1acfe818)
2022-11-04 13:02:20 +01:00
Yu Watanabe
02a5c22ec1 sd-device-monitor: fix inversed condition
Fixes an issue introduced by b3d06b9226.

(cherry picked from commit 133d78966f)
(cherry picked from commit 81339c45e8)
2022-11-04 13:02:20 +01:00
exploide
45e46fb4b2 resolvctl: only remove protocol after last dot when mangling ifname for resolvconf
ifname_resolvconf_mangle is supposed to remove protocol suffixes like .dhcp
from interface names. But this removed also valid parts of the ifname like
VLAN IDs, e.g. enp2s0u4.72.dhcp -> enp2s0u4 instead of enp2s0u4.72

After this change, everything behind the last dot is removed instead of the first.

(cherry picked from commit e8d0eb3915)
(cherry picked from commit 1760559918)
2022-11-04 13:02:20 +01:00
Yu Watanabe
2aeff0f39a oom: drop invalid %m in the log message
Fixes https://github.com/systemd/systemd/issues/23785#issuecomment-1210030100.

(cherry picked from commit b6f6df4cb0)
(cherry picked from commit a3348ba748)
2022-11-04 13:02:20 +01:00
Jan Janssen
658013a7f7 meson: Test correct efi linker for supported args
Fixes: #24241
(cherry picked from commit 6a941db798)
Closes https://github.com/systemd/systemd-stable/issues/216
(cherry picked from commit b3dd66f32b)
2022-11-04 13:02:20 +01:00
Luca BRUNO
3733943f5a sysusers: properly process user entries with an explicit GID
This tweaks user creation logic to properly take into consideration
an explicitly requested GID.
It fixes a bug where the creation flow would mistakenly fall back
to use the username instead, resulting in wrong lookups in case of
users and groups using the same name.

(cherry picked from commit 5ed47c4d23)
(cherry picked from commit f9d936b865)
2022-11-04 13:02:20 +01:00
Luca BRUNO
6ab318435e sysusers: only check whether the requested GID is available
This relaxes the availability check when creating a group, if an
explicit GID has been requested.
It avoids mixing up users and groups entries with valid and unique
UIDs/GIDs, but each having the same ID number.

(cherry picked from commit 6b6e45eb73)
(cherry picked from commit ec5a46ca34)
2022-11-04 13:02:20 +01:00
Yu Watanabe
887837a5a9 dhcp: fix potential buffer overflow
Fixes a bug introduced by 324f818781.

This also renames several macros for DHCP packet size.

(cherry picked from commit 4473cd7f61)
(cherry picked from commit 037b1a8acc)
2022-11-04 13:02:20 +01:00
Yu Watanabe
647c44c21a udev-util: assume system is running on AC power when no battery found
Fixes #24214.

(cherry picked from commit 96788d2aa4)
(cherry picked from commit ed2955f8fe)
2022-11-04 13:02:20 +01:00
undef
d1166a9060 shared/generator: Ensure growfs unit runs after repart
When deploying an image using systemd-repart and systemd-growfs one
should have the image expanded entirely and ready to use after the first
boot. This ensures that growfs does not occur before repart, thus
requiring a second boot.

(cherry picked from commit 7b45d6b6f6)
(cherry picked from commit 4fdca1ab9e)
2022-11-04 13:02:20 +01:00
Yu Watanabe
89a5b7752f network: dhcp4: disable DHCPv4 client on interfaces with non-supported types
Replaces f42d41cc5f.

(cherry picked from commit 7e2f684e1f)
(cherry picked from commit 9951ea07d5)
2022-11-04 13:02:20 +01:00
Jan Janssen
b9216947a3 boot: Build with at least -O1 as workaround
Fixes: #24202
(cherry picked from commit 2fb1165238)
(cherry picked from commit b0da0d6102)
2022-11-04 13:02:20 +01:00
Ludwig Nussel
8625211cc8 pull: fix PullFlags numbering
(cherry picked from commit 5243331fb8)
(cherry picked from commit 6a9cf204a7)
2022-11-04 13:02:20 +01:00
Luca Boccassi
c454d5fafb integritysetup: do not use crypt_init_data_device after crypt_init
crypt_init_data_device() replaces the crypt_device struct with a
new allocation, losing the old one, which we get from crypt_init().
Use crypt_set_data_device() instead.

Enhance the test to cover this option too.

(cherry picked from commit 872f9da4d8)
(cherry picked from commit a27b694453)
2022-11-04 13:02:20 +01:00
Daan De Meyer
215b6ce2d6 man: Clarify that tools should prefer mount units over editing fstab
(cherry picked from commit 29e804dffd)
(cherry picked from commit 3814bd0e71)
2022-11-04 13:02:20 +01:00
Lennart Poettering
3367e1bf48 man: fix docbook
(cherry picked from commit 1374f5a03a)
(cherry picked from commit 6b58b06c7d)
2022-11-04 13:02:20 +01:00
James Hilliard
4fa81b6a2d bpf: fix is_allow_list section
The llvm bpf compiler appears to place const volatile variables in
a non-standard section which creates an incompatibility with the gcc
bpf compiler.

To fix this force GCC to also use the rodata section.

Note this does emit an assembler warning:
Generating src/core/bpf/restrict_ifaces/restrict-ifaces.bpf.unstripped.o with a custom command
/tmp/ccM2b7jP.s: Assembler messages:
/tmp/ccM2b7jP.s:87: Warning: setting incorrect section attributes for .rodata

See:
https://github.com/llvm/llvm-project/issues/56468

Fixes:
../src/core/restrict-ifaces.c:45:14: error: ‘struct
restrict_ifaces_bpf’ has no member named ‘rodata’; did you mean
‘data’?
   45 |         obj->rodata->is_allow_list = is_allow_list;
      |              ^~~~~~
      |              data

(cherry picked from commit e8b1e9cf10)
(cherry picked from commit cdd3f180b0)
2022-11-04 13:02:20 +01:00
Loïc Collignon
12b041584a Fix 24172: __STDC_VERSION__ may be defined in C++
According to the C++ ISO standard, a conformant compiler is allowed to
define this macro to any value for any reason as it is implementation
defined: https://timsong-cpp.github.io/cppwp/cpp.predefined#2.3

This mean that it cannot be assumed that it is not defined in a C++.
Change the condition to reflect that.

(cherry picked from commit 00852912ed)
(cherry picked from commit 45faf77d4d)
2022-11-04 13:02:20 +01:00
Lennart Poettering
618b8d5a6d systemctl: clarify that "status" is about the most recent invocation of a service
And point people to "journalctl --unit=" for information of prior runs.

Inspired by: #24159

(cherry picked from commit 157cb4337b)
(cherry picked from commit 0cfe2d7e88)
2022-11-04 13:02:20 +01:00
Lennart Poettering
8e6ba03724 repart: when keeping ref to backing inode/devnode, use fd_reopen() rathern than F_DUPFD
Via the "backing_fd" variable we intend to pin the backing inode through
our entire code. So far we typically created the fd via F_DUPFD_CLOEXEC,
and thus any BSD lock taken one the original fd is shared with our
backing_fd reference. And if the origina fd is closed but our backing_fd
is not, we'll keep the BSD lock open, even if we then reopen the block
device through the backing_fd. If hit, this results in a deadlock.

Let's fix that by creating the backing_fd via fd_reopen(), so that the
locks are no longer shared, and if the original fd is closed all BSD
locks on it that are in effect are auto-released.

(Note the deadlock is only triggered if multiple operations on the same
backing inode are executed, i.e. factory reset, resize and applying of
partitions.)

Replaces: #24181
(cherry picked from commit 38f81e9374)
(cherry picked from commit d3e84e4703)
2022-11-04 13:02:20 +01:00
Jacek Migacz
a2fc30409d resolved: fix single-label resolution over DNS
Fixes: #23494 (when ResolveUnicastSingleLabel=yes)
(cherry picked from commit ff0a5070d4)
(cherry picked from commit 7384d152c8)
2022-11-04 13:02:20 +01:00