1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-06 12:58:22 +03:00

58115 Commits

Author SHA1 Message Date
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
Avram Lubkin
9f2f391153 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 19193b489841a7bcccda7122ac0849cf6efe59fd)
2022-10-01 19:05:53 +02:00
Yu Watanabe
c966377c51 dhcp6: do not append ORO option when no option requested
Fixes #24292.

(cherry picked from commit 4c275f362fa11888682dfbf6ec7c8cfd6127597f)
2022-10-01 19:05:53 +02:00
Yu Watanabe
97474b03e7 dhcp6: gracefully handle NoBinding error
When we receive NoBinding status code, the requesting binding (address or
any other information) does not exist anymore in the server. Hence,
resending the request is meaningless. Let's restart the transaction from
the beginning in that case.

(cherry picked from commit 1929c1fcb2f305206c01a6fc79cd038d6d9615f5)
2022-10-01 19:05:53 +02:00
Yu Watanabe
c67a388aef udev/cdrom_id: check last track info
Fixes off-by-one issue.

Fixes #24306.

(cherry picked from commit 628998ecfa0d39b38874e1aecdb28022f80f3269)
2022-10-01 19:05:53 +02:00
bin456789
52c631b02e firstboot: fix can't overwrite timezone
(cherry picked from commit e56dc320d39ade1795118ebe400308a80511e9c9)
2022-10-01 19:05:53 +02:00
Lennart Poettering
f279a6f4d1 cryptenroll: fix memory leak
(cherry picked from commit 7e196e9aac41da206792d96a16b712dd300b0e82)
2022-10-01 19:05:53 +02:00
Yu Watanabe
66b060225d sd-device-enumerator: drop noisy log messages
These are not for failed tasks, and provide almost no information.

(cherry picked from commit 0186571c9f8ab34f003cf4eadfb70b4d60b52de3)
2022-10-01 19:05:53 +02:00
Yu Watanabe
6e1acfe818 sd-device-monitor: actually refuse to send invalid devices
Fixes an issue introduced by 9e79123884a36ce095b98d1c0fe247dddf02dbec.

(cherry picked from commit 8bb4989906a1659b0f6adfa03dc7585e294a392b)
2022-10-01 19:05:53 +02:00
Yu Watanabe
81339c45e8 sd-device-monitor: fix inversed condition
Fixes an issue introduced by b3d06b9226db96fddb6bb45a4708e2e8d413d91d.

(cherry picked from commit 133d78966fe8b1469e593bd467d9055f7afa5858)
2022-10-01 19:05:53 +02:00
exploide
1760559918 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 e8d0eb3915ac33cc0d3da87a836cee6e61645227)
2022-10-01 19:05:53 +02:00
Yu Watanabe
a3348ba748 oom: drop invalid %m in the log message
Fixes https://github.com/systemd/systemd/issues/23785#issuecomment-1210030100.

(cherry picked from commit b6f6df4cb07ebf736f0f4b60a845049306088797)
2022-10-01 19:05:52 +02:00
Jan Janssen
b3dd66f32b meson: Test correct efi linker for supported args
Fixes: #24241
(cherry picked from commit 6a941db798e3c5d896f6732afb4e6e482d708900)
Closes https://github.com/systemd/systemd-stable/issues/216
2022-10-01 19:05:41 +02:00
Luca BRUNO
f9d936b865 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 5ed47c4d230b9491339c16c6ea4181dfd293bc98)
2022-09-30 17:58:10 +02:00
Luca BRUNO
ec5a46ca34 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 6b6e45eb7386bb4399746b70f6f606caea450fed)
2022-09-30 17:58:05 +02:00
Yu Watanabe
037b1a8acc dhcp: fix potential buffer overflow
Fixes a bug introduced by 324f818781a250b60f2fcfa74ff1c9101d2d1315.

This also renames several macros for DHCP packet size.

(cherry picked from commit 4473cd7f61b9eb0860f2daab81491ad2145d554b)
2022-09-30 17:54:29 +02:00
Yu Watanabe
ed2955f8fe udev-util: assume system is running on AC power when no battery found
Fixes #24214.

(cherry picked from commit 96788d2aa4f4b0b49874b4a240ce47d9e8485d1b)
2022-09-30 17:53:07 +02:00
João Loureiro
37b54927d3 Fix issue with system time set back (#24131)
Fixes #6036

(cherry picked from commit 5ded3917a161d87984d74d70b5eb2a254e54b44e)
2022-09-30 17:46:54 +02:00
undef
4fdca1ab9e 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 7b45d6b6f64e9f5c006bdf31559a77294dbe00ad)
2022-09-30 17:46:35 +02:00
Jonathan Lebon
32f9d70f8b manager: optionally, do a full preset on first boot
A compile time option is added to select behaviour: by default
UNIT_FILE_PRESET_ENABLE_ONLY is still used, but the intent is to change to
UNIT_FILE_PRESET_FULL at some point in the future. Distros that want to
opt-in can use the config option to change the behaviour.

(The option is just a boolean: it would be possible to make it multi-valued,
and allow full, enable-only, disable-only, none. But so far nobody has asked
for this, and it's better not to complicate things needlessly.)

With the configuration option flipped, instead of only doing enablements,
perform a full preset on first boot. The reason is that although
`/etc/machine-id` might be missing, there may be other files provisioned in
`/etc` (in fact, this use case is mentioned in `log_execution_mode`). Some of
those possible files include enablement symlinks even if presets dictate it
should be disabled.

Such a seemingly contradictory situation occurs in {RHEL,Fedora} CoreOS,
where we ship `/etc` as if `preset-all` were called. However, we want to
allow users to disable default-enabled services via Ignition, which does
this by creating preset dropins before switchroot. (For why we do
`preset-all` at compose time, see:
https://github.com/coreos/fedora-coreos-config/pull/77).

For example, the composed FCOS image has a `enable zincati.service`
preset and an enablement for that in `/etc`, while at boot time when we
switch root, there may be a `disable zincati.service` preset with higher
precedence. In that case, we want systemd to disable the service.

This is essentially a revert of 304b3079a203. It seems like systemd
*used* to do this, but it was changed to try to make the container
workflow a bit faster.

Resolves: https://github.com/coreos/fedora-coreos-tracker/issues/392

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
(cherry picked from commit 93651582aef1ee626dc6f8d032195acd73bc9372)
2022-08-09 13:02:00 +02:00
Yu Watanabe
2a674b4b66 sd-dhcp6-client: fix off-by-one error in parsing dhcp6 options
This fixes error in parsing message when the rapid commit option is
located at the end of the message.

Fixes an issure reported in #24002.

(cherry picked from commit 68870a46b3b5d3d5b51d1c27b4128b8fb5188ecb)
v251.4
2022-08-08 11:10:00 +02:00
Yu Watanabe
35610398d7 sd-dhcp6-client: allow NULL option value when length is zero
(cherry picked from commit d81b5a191e6f06fe51befe7c7fb20cff4ff4f762)
2022-08-08 11:09:43 +02:00
Yu Watanabe
7888aeb959 sd-dhcp6-client: add more debugging logs on parsing message
(cherry picked from commit 50309ff7857b0dfcec07172bdbfd183ca3f4ca88)
2022-08-08 11:09:36 +02:00
Yu Watanabe
f078fe1b99 network: do not set invalid MAC address for non-ethernet interface
(cherry picked from commit 3be64aa462642de9fbe9f95536f8d167c19994bb)
2022-08-08 11:09:29 +02:00
Yu Watanabe
cd0a30861f network: NDisc does not require MAC address
This effectively revert ba4c7184b320bb8698d470530d46a6c94641cc6e.

Fixes #23546.

(cherry picked from commit 56bb67180a18562b04cb66e07f7fa53d6014ecf8)
2022-08-08 11:09:22 +02:00
Yu Watanabe
9951ea07d5 network: dhcp4: disable DHCPv4 client on interfaces with non-supported types
Replaces f42d41cc5f9cd8cac538a1c30fda04d346b5bae2.

(cherry picked from commit 7e2f684e1fa391bd511b52bbbe4a3971cdc5ec33)
2022-08-08 11:09:14 +02:00
Yu Watanabe
b743c775f0 Revert "network: configure DHCP clients after MAC address is assigned"
This reverts commit f42d41cc5f9cd8cac538a1c30fda04d346b5bae2.

DHCPv6 client does not require MAC address.
DHCPv4 client will be handled in a different way in a later commit.

Partially fixes #23546.

(cherry picked from commit 8f4f6307313ccad0b068697bb054a105e5a50e92)
2022-08-08 11:09:08 +02:00
Jan Janssen
b0da0d6102 boot: Build with at least -O1 as workaround
Fixes: #24202
(cherry picked from commit 2fb11652381c199ad19bb469e530543366d99dd4)
2022-08-08 11:06:45 +02:00
Ludwig Nussel
6a9cf204a7 pull: fix PullFlags numbering
(cherry picked from commit 5243331fb8b77812177cf327f7d8c86c2e4ce323)
2022-08-08 11:01:40 +02:00
Luca Boccassi
a27b694453 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 872f9da4d8b67b012f1b1b227416d0c99bcdf43c)
2022-08-08 10:59:36 +02:00