]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agocpio: don't claim we measured anything if we weren't even asked 24460/head
Lennart Poettering [Thu, 25 Aug 2022 16:08:49 +0000 (18:08 +0200)] 
cpio: don't claim we measured anything if we weren't even asked

This is a bugfix.

Follow-up for 599fe002a135570406504998dbb7a42dabc963da

3 years agocpio: split out cpio TPM measurement logic from pack_cpio()
Lennart Poettering [Thu, 25 Aug 2022 14:53:43 +0000 (16:53 +0200)] 
cpio: split out cpio TPM measurement logic from pack_cpio()

No code change, just some refactoring, so that we can reuse the
measurement logic later elsewhere.

3 years agoMerge pull request #24457 from poettering/smbios-condition-fix
Lennart Poettering [Fri, 26 Aug 2022 10:22:29 +0000 (12:22 +0200)] 
Merge pull request #24457 from poettering/smbios-condition-fix

SMBIOS condition fix

3 years agotest: don't accept failure as succes 24457/head
Lennart Poettering [Fri, 26 Aug 2022 08:37:59 +0000 (10:37 +0200)] 
test: don't accept failure as succes

3 years agocondition: check for last not first ')' in firmware test expressions
Lennart Poettering [Fri, 26 Aug 2022 08:36:45 +0000 (10:36 +0200)] 
condition: check for last not first ')' in firmware test expressions

I possess a machine with ')' in its BIOS version string, which will
cause the current parser to mistake it as the closing ')' of the
smbios-fields() expression.

Let's make sure we always fo for the last, not the first ')', hence.

3 years agotest: wait for loop device to be removed
Yu Watanabe [Thu, 25 Aug 2022 21:33:49 +0000 (06:33 +0900)] 
test: wait for loop device to be removed

Follow-up for bca762ce1abafd24016eba7310fdd38c758419f8.

Fixes #24450.

3 years agotest-sd-device: run subsystem filter test several times
Yu Watanabe [Thu, 25 Aug 2022 20:23:55 +0000 (05:23 +0900)] 
test-sd-device: run subsystem filter test several times

The test is quite racy. Let's wait for all queued udev events to be
processed, and run the test several times.

Fixes #24400.

3 years agoresolve: control system hostname synthesis via environment variable
Jacek Migacz [Mon, 22 Aug 2022 16:24:29 +0000 (18:24 +0200)] 
resolve: control system hostname synthesis via environment variable

3 years agosleep: freeze and thaw user.slice to save resource while suspend
Sonali Srivastava [Wed, 17 Aug 2022 07:24:20 +0000 (12:54 +0530)] 
sleep: freeze and thaw user.slice to save resource while suspend

3 years agotree-wide: change --kill-who to --kill-whom
Zbigniew Jędrzejewski-Szmek [Wed, 24 Aug 2022 08:41:30 +0000 (10:41 +0200)] 
tree-wide: change --kill-who to --kill-whom

getopt allows non-ambiguous abbreviations, so backwards-compat is maintained, and
people can use --kill-who (or even shorter abbreviations). English is flexible,
so in common speach people would use both forms, even if "whom" is technically
more correct. The advantage of using the longer form in the code is that we
effectively allow both forms, so we stop punishing people who DTGCT¹, but still
allow people to use the spoken form if they prefer.

1. Do the gramatically correct thing

3 years agoMerge pull request #24454 from bluca/ci
Yu Watanabe [Fri, 26 Aug 2022 02:13:53 +0000 (11:13 +0900)] 
Merge pull request #24454 from bluca/ci

Fix Ubuntu/SUSE mkosi

3 years agomkosi: add back packages removed from OpenSUSE build 24454/head
Luca Boccassi [Thu, 25 Aug 2022 22:59:04 +0000 (23:59 +0100)] 
mkosi: add back packages removed from OpenSUSE build

Some packages were removed from the OpenSUSE build, which broke the
unit tests. Add them back.

Fixes: 37d35150cbb5 ("mkosi: Ensure we build all features/components in mkosi")
3 years agomkosi: disable isc-dhcp-server again
Luca Boccassi [Thu, 25 Aug 2022 22:02:29 +0000 (23:02 +0100)] 
mkosi: disable isc-dhcp-server again

It's still failing in Ubuntu:

● isc-dhcp-server.service  loaded failed failed ISC DHCP IPv4 server
● isc-dhcp-server6.service loaded failed failed ISC DHCP IPv6 server

Just disable them via the kernel command line masking.

3 years agojournal: rename special journal field _SYSTEM_CONTEXT= → _RUNTIME_SCOPE=
Lennart Poettering [Thu, 25 Aug 2022 15:32:28 +0000 (17:32 +0200)] 
journal: rename special journal field _SYSTEM_CONTEXT= → _RUNTIME_SCOPE=

Previously the field "_SYSTEM_CONTEXT" knew he values "initrd" + "main". Let's change
this to "_RUNTIME_SCOPE" and "initrd" + "system".

Why? The sysext logic has a very similar concept of "scopes", declaring
whether a sysext image is intended for the initrd or the main system.
Let's thus use the same naming for both.

sysext's extension-release files hence know SYSEXT_SCOPE=initrd|system,
and the journal messages know _RUNTIME_SCOPE=initrd|system, which makes
this reasonably systematic.

Follow-up for: cae8edd93ca2ef90c41cb9b6322b6908d12947b5

(This is not an API break, since no version with this commit has ever
been released.)

3 years agopid1: extend "ConditionFirmware=" for checking SMBIOS system identification information
Daniel Braunwarth [Sat, 30 Jul 2022 13:20:15 +0000 (15:20 +0200)] 
pid1: extend "ConditionFirmware=" for checking SMBIOS system identification information

3 years agomkosi: Print logs of failing tests
Jan Janssen [Thu, 25 Aug 2022 10:13:35 +0000 (12:13 +0200)] 
mkosi: Print logs of failing tests

3 years agocore/mount: voidify unit_acquire_invocation_id()
Yu Watanabe [Thu, 25 Aug 2022 16:16:00 +0000 (01:16 +0900)] 
core/mount: voidify unit_acquire_invocation_id()

Follow-up for 01400460ae16c6522d11d08dd9a4b0928e7980d9.

Fixes CID#1491960.

3 years agoMerge pull request #24442 from yuwata/udev-retry-event
Frantisek Sumsal [Thu, 25 Aug 2022 19:57:19 +0000 (19:57 +0000)] 
Merge pull request #24442 from yuwata/udev-retry-event

udev: make requeued event actually restarted

3 years agovirt: fix alignment
Yu Watanabe [Thu, 25 Aug 2022 16:12:49 +0000 (01:12 +0900)] 
virt: fix alignment

Follow-up for f5558306746c0791dab666e76d51e7ef1ce38362.

3 years agotest: make TEST-63 more reliable on slower machines
Frantisek Sumsal [Thu, 25 Aug 2022 10:05:53 +0000 (12:05 +0200)] 
test: make TEST-63 more reliable on slower machines

Otherwise we might never hit the trigger limit and wait indefinitely.

Found when trying to run the test on an EC2 xen machine without a nested
virt in CentOS CI (in preparations for some ... unforseseen consequences).

3 years agoudev: drop unnecessary calls of event_queue_start() 24442/head
Yu Watanabe [Thu, 25 Aug 2022 15:34:15 +0000 (00:34 +0900)] 
udev: drop unnecessary calls of event_queue_start()

As the subsequent call of on_post() will call it if necessary.

This also drop unnecessary call of event_source_disable() for killing
idle workers, as the event source is disabled in event_queue_start().

3 years agoudev: certainly restart event for previously locked device
Yu Watanabe [Thu, 25 Aug 2022 15:16:17 +0000 (00:16 +0900)] 
udev: certainly restart event for previously locked device

If udevd receives a uevent for a locked block device, then the event
is requeued. However, the queued event will be processed only when at
least one sd_event_source is processed. Hence, if udevd has no event
under processing, or receives no new uevent, etc., then the requeued
event will be never processed.

Follow-up for 400e3d21f8cae53a8ba9f9567f244fbf6f3e076c.

Fixes #24439.

3 years agomkosi: use the just built systemd-sysusers instead of groupadd
Luca Boccassi [Thu, 25 Aug 2022 11:30:58 +0000 (12:30 +0100)] 
mkosi: use the just built systemd-sysusers instead of groupadd

It disappeared again from SUSE Tumbleweed. Just use sysusers since we
just built it.

3 years agoMerge pull request #24408 from keszybz/execstart-escape
Lennart Poettering [Thu, 25 Aug 2022 09:40:57 +0000 (11:40 +0200)] 
Merge pull request #24408 from keszybz/execstart-escape

Properly escape ExecStart= commandlines in transient units

3 years agoMerge pull request #24242 from msekletar/terminate-idle-sessions
Lennart Poettering [Thu, 25 Aug 2022 09:39:42 +0000 (11:39 +0200)] 
Merge pull request #24242 from msekletar/terminate-idle-sessions

Add option to stop idle sessions after specified timeout

3 years agoshutdown: Fix last try detection
Jan Janssen [Wed, 24 Aug 2022 05:53:23 +0000 (07:53 +0200)] 
shutdown: Fix last try detection

This was missed in 5125b67742567de79c12e31f434a11d787b4f6b1.

3 years agoMerge pull request #24429 from poettering/selinux-code-improv
Lennart Poettering [Thu, 25 Aug 2022 09:35:14 +0000 (11:35 +0200)] 
Merge pull request #24429 from poettering/selinux-code-improv

minor selinux-util.c modernization

3 years agosystemd-growfs: remove dependency on udev symlinks
Devendra Tewari [Wed, 24 Aug 2022 10:13:04 +0000 (07:13 -0300)] 
systemd-growfs: remove dependency on udev symlinks

systemd-growfs currently requires that udev ran first to work (because
/dev/block/ symlinks must exist) but that is not what happens when
we're not using initrd and systemd is PID1.

3 years agotime-util: fix overflow condition in usec_sub_signed()
Lennart Poettering [Wed, 24 Aug 2022 08:41:23 +0000 (10:41 +0200)] 
time-util: fix overflow condition in usec_sub_signed()

If the delta specified is INT64_MIN, and we negate that we'd end up at
INT64_MAX+1 which is outside of the int64_t type. Hence let's treat this
case specifically to avoid unintended overflows.

3 years agocore: allow disabling system time correction if rtc returns time far in the future
Franck Bui [Tue, 23 Aug 2022 15:07:23 +0000 (17:07 +0200)] 
core: allow disabling system time correction if rtc returns time far in the future

There might be (embedded) systems that get never updated (things like
e.g. entertainment systems of trains, for example) and where the adjustment of
the system clock (introduced by b10abe4bba61aebe4c667c412741193f11886298) would
do the wrong thing even if the difference between the systemd build time and
the rtc is 15 years or more.

This patch allows disabling the adjustment by setting
'clock-valid-range-usec-max' meson option to 0 or to a negative value.

3 years agojournald: use rate-limited logging to log 'Failed to write entry' message
Richard Phibel [Wed, 17 Aug 2022 20:24:52 +0000 (22:24 +0200)] 
journald: use rate-limited logging to log 'Failed to write entry' message

3 years agoMerge pull request #24370 from keszybz/sysusers-equivs
Luca Boccassi [Wed, 24 Aug 2022 20:35:28 +0000 (21:35 +0100)] 
Merge pull request #24370 from keszybz/sysusers-equivs

Use /bin/bash for root shell and suppress some warnings from sysusers

3 years agoselinux-util: add safety size check before doing strdupa() 24429/head
Lennart Poettering [Wed, 24 Aug 2022 14:57:20 +0000 (16:57 +0200)] 
selinux-util: add safety size check before doing strdupa()

3 years agoselinux-util: modernizations
Lennart Poettering [Wed, 24 Aug 2022 14:55:50 +0000 (16:55 +0200)] 
selinux-util: modernizations

Let's no bother with reading return value of libselinux API calls into
r, if the actual error is in errno anyway.

Let's remove one unnecessary strdup()

Let's rename a return parameter ret_xyz

3 years agoMerge pull request #24072 from poettering/remove-cgroupsv1-docs
Lennart Poettering [Wed, 24 Aug 2022 15:00:53 +0000 (17:00 +0200)] 
Merge pull request #24072 from poettering/remove-cgroupsv1-docs

decgroupsv1ification: first steps – remove from docs, and generate warnings

3 years agotests: add test for StopIdleSessionSec= option 24242/head
Michal Sekletar [Mon, 8 Aug 2022 09:39:52 +0000 (11:39 +0200)] 
tests: add test for StopIdleSessionSec= option

3 years agologind: add option to stop idle sessions after specified timeout
Michal Sekletar [Mon, 8 Aug 2022 07:13:50 +0000 (09:13 +0200)] 
logind: add option to stop idle sessions after specified timeout

Thanks to Jan Pazdziora <jpazdziora@redhat.com> for providing a patch
which implemeted a PoC of this feature.

3 years agoMerge pull request #24420 from keszybz/mouse-power
Lennart Poettering [Wed, 24 Aug 2022 08:16:14 +0000 (10:16 +0200)] 
Merge pull request #24420 from keszybz/mouse-power

Rework on_ac_power()

3 years agobasic/user-util: rename output param to ret, shorten code 24370/head
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2022 15:03:36 +0000 (17:03 +0200)] 
basic/user-util: rename output param to ret, shorten code

3 years agobasic/user-util: avoid filesystem access check
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2022 14:45:08 +0000 (16:45 +0200)] 
basic/user-util: avoid filesystem access check

The check of u==UID_NOBODY is just a register comparison, but
synthesize_nobody() requires a system call, so let's invert the order in the
condition. Since most calls into this module are not for nobody, we should
save one syscall in the common case.

3 years agosysusers: report the original error when writing fails
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2022 16:04:47 +0000 (18:04 +0200)] 
sysusers: report the original error when writing fails

We have fairly nice error messages for specific operations, but only at debug
level. Instead, we'd print a fairly useless generic message:

Before:
Failed to write files: Invalid argument

After:
Failed to add existing group "users" to temporary group file: Invalid argument

Fixes #10241.

3 years agovarious: try to use DEFAULT_USER_SHELL for root too
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2022 14:43:45 +0000 (16:43 +0200)] 
various: try to use DEFAULT_USER_SHELL for root too

/bin/sh as a shell is punishing. There is no good reason to make
the occasional root login unpleasant.

Since /bin/sh is usually /bin/bash in compat mode, i.e. if one is
available, the other will be too, /bin/bash is almost as good as a default.
But to avoid a regression in the situation where /bin/bash (or
DEFAULT_USER_SHELL) is not installed, we check with access() and fall back
to /bin/sh. This should make this change in behaviour less risky.

(FWIW, e.g. Fedora/RHEL use /bin/bash as default for root.)

This is a follow-up of sorts for 53350c7bbade8c5f357aa3d1029ef9b2208ea675,
which added the default-user-shell option, but most likely with the idea
of using /bin/bash less ;)

Fixes #24369.

3 years agosysusers: do not warn about values that equivalent
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2022 13:38:56 +0000 (15:38 +0200)] 
sysusers: do not warn about values that equivalent

We'd warn that "-" and "/sbin/nologin" are different, even even though
"/sbin/nologin" is the default we'd use. So let's stop warning in all cases
where the config would lead to the same file, also under different paths,
or when both shells are nologin shells.

The general idea is to avoid warnings when sysusers config is moved between
packages (and not exactly the same), or when it is generated from some template
and the details change in an unimportant way.

We try to chase symlinks. This means that on unmerged-usr systems we'll find
that e.g. /usr/bin/bash and /bin/bash are equivalent if the basic fs structure
is already in place (bash doesn't actually have to be installed, enough that
the /bin symlink exists). I think this is a good result: after all, /bin/bash
and /usr/bin/bash *may* be different things on an unmerged-usr system.

Fixes #24215.

3 years agocore: escape ExecStart command-line received over d-bus 24408/head
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 05:34:49 +0000 (07:34 +0200)] 
core: escape ExecStart command-line received over d-bus

When some transient unit setting is received over D-Bus, we write it it to a
transient unit file. We escape backslashes and specifiers. For most settings
this is enough, because most settings only do parsing and interpolation of
specifiers. When systemd-run is called (or something equivalent that gives us a
command strv), we write ExecStart=, but when reading it, we not only do parsing
and interpolation of specifiers, but also split on semicolons and do variable
substitution. This results in an ugly situation where the commandline is
interpolated twice, once on the caller side, and once in the manager.

I think we need to treat this as a bug: current behaviour seems to be an
accident of implementation and hard to explain in a reasonable way. If we
*were* doing specifier expansion, then it'd be somewhat reasonable so say that
"the commandline is handled the same as ExecStart=". But since we explicitly
prevent specifier expansion, we best we could say is "the commandline has some
subset of features of ExecStart=". I think this is not useful, and unexpected
by users. Since most people use use a shell to call systemd-run, one level of
variable expansion is already done on the caller side, and having to take into
account another level of expansion (with slightly different rules), creates a
big mental overhead when the commandline needs to include a dollar character or
such. Not doing any expansion is much cleaner and easier to explain or use.
Thus I think it's better to change behaviour here, even though in principle
some people could be relying on current behaviour. I think it's more likely
that nobody noticed, because people generally don't use systemd-run for
complicated commandlines.

Thus this commit adds an additional mode of escaping that prevents variable
explansion and other elements of ExecStart= syntax. I looked over all the
places where unit_escape_setting() is called, and I think that only two need to
be changed to use the new flag.

Fixes #23631.

3 years agoman/run: we accept relative paths for run
Zbigniew Jędrzejewski-Szmek [Mon, 22 Aug 2022 11:37:13 +0000 (13:37 +0200)] 
man/run: we accept relative paths for run

I think this is a left-over from before we changed ExecStart= to allow
non-absolute paths, *and* changed systemd-run itself to resolve paths too.

3 years agoMerge pull request #24071 from bluca/path_trigger_report
Lennart Poettering [Wed, 24 Aug 2022 07:35:59 +0000 (09:35 +0200)] 
Merge pull request #24071 from bluca/path_trigger_report

path/timer units: export env vars and D-Bus properties with reason that triggered the job

3 years agovirt: Support detection of Apple Virtualization.framework guests
Zhaofeng Li [Mon, 22 Aug 2022 16:35:21 +0000 (10:35 -0600)] 
virt: Support detection of Apple Virtualization.framework guests

3 years agocheck-os-release.py compatible with Python < 3.8
David Jaša [Tue, 23 Aug 2022 21:58:09 +0000 (23:58 +0200)] 
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.

3 years agoservice: set TRIGGER_UNIT= and TRIGGER_TIMER_REALTIME_USEC/MONOTONIC_USEC on activati... 24071/head
Luca Boccassi [Tue, 2 Aug 2022 19:15:12 +0000 (20:15 +0100)] 
service: set TRIGGER_UNIT= and TRIGGER_TIMER_REALTIME_USEC/MONOTONIC_USEC on activation by timer unit

Same as path unit, best effort.

3 years agoservice: set TRIGGER_UNIT= and TRIGGER_PATH= on activation by path unit
Luca Boccassi [Tue, 2 Aug 2022 19:07:35 +0000 (20:07 +0100)] 
service: set TRIGGER_UNIT= and TRIGGER_PATH= on activation by path unit

When a service is triggered by a path unit, pass the
path unit name and the path that triggered it via env vars
to the spawned processes.
Note that this is best-effort, as there might be many triggers
at the same time, but we only get woken up by one.

3 years agocore: add basic infrastructure to record unit activation information
Luca Boccassi [Tue, 2 Aug 2022 18:49:20 +0000 (19:49 +0100)] 
core: add basic infrastructure to record unit activation information

Not wired in by any unit type yet, just the basic to allocate,
ref, deref and plug in to other unit types.
Includes recording the trigger unit name and passing it to the
triggered unit as TRIGGER_UNIT= env var.

3 years agoglob: add glob_first(), returns first match
Luca Boccassi [Wed, 3 Aug 2022 13:20:41 +0000 (14:20 +0100)] 
glob: add glob_first(), returns first match

Note that which match is returned depends on the system and is
not guaranteed to be stable

3 years agotest-63: convert to full shell script and generalize
Luca Boccassi [Wed, 3 Aug 2022 15:50:39 +0000 (16:50 +0100)] 
test-63: convert to full shell script and generalize

Will add more path unit tests later

3 years agosleep: support acpi_btp and suspend system if enabled, skipping custom timer
Sonali Srivastava [Sat, 23 Jul 2022 12:00:42 +0000 (17:30 +0530)] 
sleep: support acpi_btp and suspend system if enabled, skipping custom timer

3 years agojournal: Add new _INITRD field
Daan De Meyer [Tue, 17 May 2022 12:57:54 +0000 (14:57 +0200)] 
journal: Add new _INITRD field

The _INITRD field is a boolean field (0 or 1) that specifies whether
a message was processed by systemd-journald in the initrd or not.

3 years agoMerge pull request #24254 from medhefgo/mold
Luca Boccassi [Tue, 23 Aug 2022 18:33:47 +0000 (19:33 +0100)] 
Merge pull request #24254 from medhefgo/mold

ci: Add mold to build tests

3 years agoMerge pull request #24396 from poettering/no-more-dirname
Luca Boccassi [Tue, 23 Aug 2022 18:32:52 +0000 (19:32 +0100)] 
Merge pull request #24396 from poettering/no-more-dirname

stop using dirname()/dirname_malloc()

3 years agomeasure: fix minor memory leak
Lennart Poettering [Tue, 23 Aug 2022 08:09:21 +0000 (10:09 +0200)] 
measure: fix minor memory leak

When using --current switch, copy in current hash, don't just reassign
buffers forgetting about the old.

While we are at it, allocate the local copy buffer later, in
measure_pcr() as we won#t need it in the --current case.

3 years agotest: wait for the lodev to get properly initialized
Frantisek Sumsal [Tue, 23 Aug 2022 12:44:01 +0000 (14:44 +0200)] 
test: wait for the lodev to get properly initialized

Otherwise we might start writing to one of its partition before the
respective node is created under /dev, resulting in... interesting
stuff.

Resolves: #24390

3 years agoon-ac-power: ignore devices with scope==Device 24420/head
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 14:48:26 +0000 (16:48 +0200)] 
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.

3 years agoon-ac-power: rework logic
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 14:30:05 +0000 (16:30 +0200)] 
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.

3 years agosd-device: add helper to read a unsigned int attribute
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 14:24:02 +0000 (16:24 +0200)] 
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.

3 years agoshared/udev-util: say "ignoring device", not "ignoring"
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 12:18:41 +0000 (14:18 +0200)] 
shared/udev-util: say "ignoring device", not "ignoring"

The short form sounds like we're ignoring the error.

3 years agomkosi: Ensure we build all features/components in mkosi
Daan De Meyer [Mon, 22 Aug 2022 11:21:07 +0000 (13:21 +0200)] 
mkosi: Ensure we build all features/components in mkosi

Explicitly enable all features/components in the mkosi build to
ensure they all get built and we get an error if they can't be built.

We also rework the packages sections of all mkosi configs to reduce
duplication and cover all the dependencies necessary to build/use all
systemd features.

Note that for the final image, since systemd is installed by default
in base images, we rely on that to install the base library dependencies
and we only list extra optional dependencies and tools that aren't already
installed by default into the base image.

We also drop the centos stream 8 mkosi build as dependencies on that
distro are too out-of-date to be able to build all systemd features.
Since centos stream 9 has been out for a while, let's focus on that
and leave it to downstream to keep systemd building on centos stream 8.

Finally, there's a few additions to the mkosi scripts to make sure
services don't start by default on boot.

3 years agoupdate TODO 24396/head
Lennart Poettering [Mon, 22 Aug 2022 11:35:48 +0000 (13:35 +0200)] 
update TODO

3 years agolgtm: dirname() is now icky
Lennart Poettering [Mon, 22 Aug 2022 12:58:13 +0000 (14:58 +0200)] 
lgtm: dirname() is now icky

3 years agomkdir: don't allow us to get confused by symlinks in mkdir_p_root()'s chowning logic
Lennart Poettering [Mon, 22 Aug 2022 12:49:17 +0000 (14:49 +0200)] 
mkdir: don't allow us to get confused by symlinks in mkdir_p_root()'s chowning logic

3 years agobless-boot: remove a bunch of 'else'
Lennart Poettering [Mon, 22 Aug 2022 11:37:15 +0000 (13:37 +0200)] 
bless-boot: remove a bunch of 'else'

3 years agodocs: suggests people use path_extract_filename() + path_extract_directory()
Lennart Poettering [Mon, 22 Aug 2022 11:36:30 +0000 (13:36 +0200)] 
docs: suggests people use path_extract_filename() + path_extract_directory()

3 years agopath-util: drop the now unused dirname_malloc()
Lennart Poettering [Mon, 22 Aug 2022 10:39:46 +0000 (12:39 +0200)] 
path-util: drop the now unused dirname_malloc()

3 years agotree-wide: port things dirname_malloc() → path_extract_directory()
Lennart Poettering [Mon, 22 Aug 2022 10:34:34 +0000 (12:34 +0200)] 
tree-wide: port things dirname_malloc() → path_extract_directory()

3 years agoMerge pull request #24412 from keszybz/man-similarly
Luca Boccassi [Tue, 23 Aug 2022 12:17:13 +0000 (13:17 +0100)] 
Merge pull request #24412 from keszybz/man-similarly

man: grammar cleanups

3 years agoMerge pull request #23893 from yuwata/core-mount-re-read-mountinfo
Luca Boccassi [Tue, 23 Aug 2022 11:46:39 +0000 (12:46 +0100)] 
Merge pull request #23893 from yuwata/core-mount-re-read-mountinfo

core/mount: adjust deserialized state based on if the corresponding mountinfo entry exists or not

3 years agoman/crypttab: rework formatting in "key acquisition section" 24412/head
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 10:14:23 +0000 (12:14 +0200)] 
man/crypttab: rework formatting in "key acquisition section"

<example> without <title> was rendered as "Example 1.", which did not
look good. While at it, the text is rewored to be, I hope, a bit easier to
read.

3 years agotest: install /etc/default/knot if available as well
Frantisek Sumsal [Mon, 22 Aug 2022 20:04:51 +0000 (22:04 +0200)] 
test: install /etc/default/knot if available as well

The knot.service on Ubuntu Jammy loads an env file which we didn't
install, causing the service to fail:

```
knot.service: Will spawn child (service_enter_start_pre): /usr/sbin/knotc
knot.service: Failed to load environment files: No such file or directory
knot.service: Failed to run 'start-pre' task: No such file or directory
knot.service: Failed with result 'resources'.
knot.service: Service will not restart (restart setting)
```

3 years agoman: similar → similarly
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 10:12:28 +0000 (12:12 +0200)] 
man: similar → similarly

Something *is* similar
Something *works* similarly
Something does something, similarly to how something else does something

See https://sites.ulethbridge.ca/roussel/2017/11/29/similar-and-similarly-are-they-similar/
for a clear explanation.

3 years agoMerge pull request #24352 from DaanDeMeyer/mkosi-opensuse
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 09:05:02 +0000 (11:05 +0200)] 
Merge pull request #24352 from DaanDeMeyer/mkosi-opensuse

mkosi: Update to latest commit

3 years agocore/load-fragment: move config_parse_sec_fix_0 to src/shared
Michal Sekletar [Tue, 9 Aug 2022 09:41:04 +0000 (11:41 +0200)] 
core/load-fragment: move config_parse_sec_fix_0 to src/shared

3 years agofix typos
eggfly [Tue, 23 Aug 2022 08:09:59 +0000 (16:09 +0800)] 
fix typos

3 years agomeson: Downgrade efi-ld warning 24254/head
Jan Janssen [Wed, 10 Aug 2022 07:47:42 +0000 (09:47 +0200)] 
meson: Downgrade efi-ld warning

The warning isn't that serious and mostly there to inform the user that
lld/mold cannot build efi binaries. It is also better to build test with
fatal meson warnings.

3 years agoci: Add mold to build tests
Jan Janssen [Tue, 9 Aug 2022 08:36:40 +0000 (10:36 +0200)] 
ci: Add mold to build tests

3 years agopid1: shorten advice message 24072/head
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 07:22:24 +0000 (09:22 +0200)] 
pid1: shorten advice message

3 years agopid1: generate warnings if old obsolete cgroupsv1 settings are used
Lennart Poettering [Thu, 21 Jul 2022 09:28:30 +0000 (11:28 +0200)] 
pid1: generate warnings if old obsolete cgroupsv1 settings are used

3 years agoman: add "History" sections for removed settings
Zbigniew Jędrzejewski-Szmek [Tue, 23 Aug 2022 07:11:23 +0000 (09:11 +0200)] 
man: add "History" sections for removed settings

The general idea is that users should be able to figure out if some option
that they see in a config file or on some internet page is something that
systemd knows about. Once users know that, yes, this was an option but has
been deprecated and removed from the documentation, it's much easier for them
to find any docs in old versions if they want to. Or to switch to something
different.

3 years agodocs: remove documentation about cgroupsv1 settings
Lennart Poettering [Thu, 21 Jul 2022 09:19:13 +0000 (11:19 +0200)] 
docs: remove documentation about cgroupsv1 settings

it's legacy. We'll continue to support it in code, but let's simplify
the docs a bit, and not mention this legacy stuff anymore.

3 years agofix typo
jiangchuangang [Tue, 23 Aug 2022 03:22:37 +0000 (11:22 +0800)] 
fix typo

3 years agoAllow uneven length BootXXXX variables
Goffredo Baroncelli [Mon, 22 Aug 2022 19:25:45 +0000 (21:25 +0200)] 
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>
3 years agochase-symlinks: refuse more chase_symlink() flags in the open/stat flavours
Lennart Poettering [Mon, 22 Aug 2022 09:33:52 +0000 (11:33 +0200)] 
chase-symlinks: refuse more chase_symlink() flags in the open/stat flavours

These flags make no sense when we try to access the final inode, hence
refuse.

3 years agomeasure: add --current switch for "systemd-measure calculate"
Lennart Poettering [Wed, 17 Aug 2022 16:40:19 +0000 (18:40 +0200)] 
measure: add --current switch for "systemd-measure calculate"

This allows allows shortcutting measurements of the specified files and
use the information from /sys/ instead.

This is not too useful on its own given that "systemd-measure status"
already exists which displays the current, relevant PCR values. The main
difference is how "complete" the information is. "status" will detect if
the measurements make any sense, and show more than PCR 11. "calculate
--current" otoh only reads PCR 11 and uses that, and that's really it.

This is mainly preparation for later work to add PCR signing to the
tool, where usually it makes most sense to sign prepared kernel images,
but for testing it's really useful to shortcut signing to the current
PCR values instead

3 years agotree-wide: use path_join() instead of prefix_roota() in various cases
Lennart Poettering [Mon, 22 Aug 2022 09:38:58 +0000 (11:38 +0200)] 
tree-wide: use path_join() instead of prefix_roota() in various cases

prefix_roota() is something we should stop using. It is bad for three
reasons:

1. As it names suggests it's supposed to be used when working relative
   to some root directory, but given it doesn't follow symlinks (and
   instead just stupidly joins paths) it is not a good choice for that.

2. More often than not it is currently used with inputs under control of
   the user, and that is icky given it typically allocates memory on the
   stack.

3. It's a redundant interface, where chase_symlinks() and path_join()
   already exist as better, safer interfaces.

Hence, let's start moving things from prefix_roota() to path_join() for
the cases where that's appropriate.

3 years agoMerge pull request #24392 from poettering/chase-symlinks-more-stuff
Lennart Poettering [Mon, 22 Aug 2022 16:41:14 +0000 (18:41 +0200)] 
Merge pull request #24392 from poettering/chase-symlinks-more-stuff

some tweaks to chase_symlinks() and port some code from prefix_roota() over

3 years agotest: make TEST-58-REPART support nspawn
Yu Watanabe [Fri, 19 Aug 2022 19:59:03 +0000 (04:59 +0900)] 
test: make TEST-58-REPART support nspawn

3 years agotest: merge test-repart.sh and TEST-58-REPART
Yu Watanabe [Fri, 19 Aug 2022 19:37:00 +0000 (04:37 +0900)] 
test: merge test-repart.sh and TEST-58-REPART

3 years agotest: modernize TEST-58-REPART
Yu Watanabe [Fri, 19 Aug 2022 07:33:09 +0000 (16:33 +0900)] 
test: modernize TEST-58-REPART

3 years agogpt: fix alignment
Yu Watanabe [Sat, 20 Aug 2022 01:56:57 +0000 (10:56 +0900)] 
gpt: fix alignment

3 years agogpt: fix native uuids for s390x
Yu Watanabe [Sat, 20 Aug 2022 01:52:39 +0000 (10:52 +0900)] 
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.

3 years agoudev: fix inversed inequality for timeout of retrying event
Yu Watanabe [Fri, 19 Aug 2022 12:25:03 +0000 (21:25 +0900)] 
udev: fix inversed inequality for timeout of retrying event

Follow-up for 5d354e525a56955ae7f68062e283dda85ab07794.

3 years agorepart: drop doubled space
Yu Watanabe [Fri, 19 Aug 2022 19:40:38 +0000 (04:40 +0900)] 
repart: drop doubled space

3 years agobash-completion: add systemd-sysext support
Antonio Alvarez Feijoo [Mon, 22 Aug 2022 13:05:53 +0000 (15:05 +0200)] 
bash-completion: add systemd-sysext support

3 years agosysext: add missing COMMAND to the help output and man synopsis
Antonio Alvarez Feijoo [Mon, 22 Aug 2022 12:23:57 +0000 (14:23 +0200)] 
sysext: add missing COMMAND to the help output and man synopsis