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

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 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
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 19193b4898)
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 4c275f362f)
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 1929c1fcb2)
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 628998ecfa)
2022-10-01 19:05:53 +02:00
bin456789
52c631b02e firstboot: fix can't overwrite timezone
(cherry picked from commit e56dc320d3)
2022-10-01 19:05:53 +02:00
Lennart Poettering
f279a6f4d1 cryptenroll: fix memory leak
(cherry picked from commit 7e196e9aac)
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 0186571c9f)
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 9e79123884.

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

(cherry picked from commit 133d78966f)
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 e8d0eb3915)
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 b6f6df4cb0)
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 6a941db798)
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 5ed47c4d23)
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 6b6e45eb73)
2022-09-30 17:58:05 +02:00
Yu Watanabe
037b1a8acc 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)
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 96788d2aa4)
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 5ded3917a1)
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 7b45d6b6f6)
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 304b3079a2. 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 93651582ae)
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 68870a46b3)
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 d81b5a191e)
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 50309ff785)
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 3be64aa462)
2022-08-08 11:09:29 +02:00
Yu Watanabe
cd0a30861f network: NDisc does not require MAC address
This effectively revert ba4c7184b3.

Fixes #23546.

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

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

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 8f4f630731)
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 2fb1165238)
2022-08-08 11:06:45 +02:00
Ludwig Nussel
6a9cf204a7 pull: fix PullFlags numbering
(cherry picked from commit 5243331fb8)
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 872f9da4d8)
2022-08-08 10:59:36 +02:00