Commit graph

59364 commits

Author SHA1 Message Date
Lennart Poettering 771fe73c75
Merge pull request #24072 from poettering/remove-cgroupsv1-docs
decgroupsv1ification: first steps – remove from docs, and generate warnings
2022-08-24 17:00:53 +02:00
Lennart Poettering 98f3e84342
Merge pull request #24420 from keszybz/mouse-power
Rework on_ac_power()
2022-08-24 10:16:14 +02:00
Lennart Poettering e820ca0193
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
2022-08-24 09:35:59 +02:00
Zhaofeng Li f555830674 virt: Support detection of Apple Virtualization.framework guests 2022-08-24 09:34:54 +02:00
David Jaša ce0a056abc 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.
2022-08-24 12:08:17 +09:00
Luca Boccassi c8bc7519c8 service: set TRIGGER_UNIT= and TRIGGER_TIMER_REALTIME_USEC/MONOTONIC_USEC on activation by timer unit
Same as path unit, best effort.
2022-08-23 21:19:54 +01:00
Luca Boccassi 4c42032854 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.
2022-08-23 20:38:08 +01:00
Luca Boccassi 48b92b37ac 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.
2022-08-23 20:38:08 +01:00
Luca Boccassi f52faaf923 glob: add glob_first(), returns first match
Note that which match is returned depends on the system and is
not guaranteed to be stable
2022-08-23 20:04:41 +01:00
Luca Boccassi d4f38ff036 test-63: convert to full shell script and generalize
Will add more path unit tests later
2022-08-23 20:04:41 +01:00
Sonali Srivastava 1afe3d712e sleep: support acpi_btp and suspend system if enabled, skipping custom timer 2022-08-23 19:36:51 +01:00
Daan De Meyer cae8edd93c 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.
2022-08-23 19:35:04 +01:00
Luca Boccassi 5e98346220
Merge pull request #24254 from medhefgo/mold
ci: Add mold to build tests
2022-08-23 19:33:47 +01:00
Luca Boccassi 4a515c5bd6
Merge pull request #24396 from poettering/no-more-dirname
stop using dirname()/dirname_malloc()
2022-08-23 19:32:52 +01:00
Lennart Poettering 3a21f51c58 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.
2022-08-23 19:31:58 +01:00
Frantisek Sumsal bca762ce1a 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
2022-08-23 17:38:43 +00:00
Zbigniew Jędrzejewski-Szmek 3c69e94a5c 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.
2022-08-23 17:04:31 +02:00
Zbigniew Jędrzejewski-Szmek 4a52514b37 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.
2022-08-23 17:04:31 +02:00
Zbigniew Jędrzejewski-Szmek 48a511cf92 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.
2022-08-23 17:04:31 +02:00
Zbigniew Jędrzejewski-Szmek 406fbeca32 shared/udev-util: say "ignoring device", not "ignoring"
The short form sounds like we're ignoring the error.
2022-08-23 16:55:30 +02:00
Daan De Meyer 37d35150cb 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.
2022-08-23 15:19:26 +02:00
Lennart Poettering 180efdb768 update TODO 2022-08-23 15:10:15 +02:00
Lennart Poettering 0b1c6448be lgtm: dirname() is now icky 2022-08-23 15:10:15 +02:00
Lennart Poettering 15e2182fb3 mkdir: don't allow us to get confused by symlinks in mkdir_p_root()'s chowning logic 2022-08-23 15:10:15 +02:00
Lennart Poettering c06103be64 bless-boot: remove a bunch of 'else' 2022-08-23 15:10:15 +02:00
Lennart Poettering e109541fe6 docs: suggests people use path_extract_filename() + path_extract_directory() 2022-08-23 15:10:15 +02:00
Lennart Poettering e08c10a424 path-util: drop the now unused dirname_malloc() 2022-08-23 15:10:15 +02:00
Lennart Poettering 45519d13a4 tree-wide: port things dirname_malloc() → path_extract_directory() 2022-08-23 15:10:15 +02:00
Luca Boccassi 0f74ca8668
Merge pull request #24412 from keszybz/man-similarly
man: grammar cleanups
2022-08-23 13:17:13 +01:00
Luca Boccassi 712e0b4792
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
2022-08-23 12:46:39 +01:00
Zbigniew Jędrzejewski-Szmek 6163dac48f 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.
2022-08-23 12:32:17 +02:00
Frantisek Sumsal 3398a73254 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)
```
2022-08-23 11:26:35 +01:00
Zbigniew Jędrzejewski-Szmek 15102ced42 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.
2022-08-23 12:14:58 +02:00
Zbigniew Jędrzejewski-Szmek 00616643de
Merge pull request #24352 from DaanDeMeyer/mkosi-opensuse
mkosi: Update to latest commit
2022-08-23 11:05:02 +02:00
eggfly 6b5e82408d fix typos 2022-08-23 10:53:47 +02:00
Jan Janssen 4fb6506deb 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.
2022-08-23 10:26:02 +02:00
Jan Janssen ed862b95b2 ci: Add mold to build tests 2022-08-23 10:25:30 +02:00
Zbigniew Jędrzejewski-Szmek af9d5d507a pid1: shorten advice message 2022-08-23 09:31:12 +02:00
Lennart Poettering c1e701e2f1 pid1: generate warnings if old obsolete cgroupsv1 settings are used 2022-08-23 09:31:10 +02:00
Zbigniew Jędrzejewski-Szmek 7a9e0bd031 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.
2022-08-23 09:24:44 +02:00
Lennart Poettering 6d48c7cf73 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.
2022-08-23 09:24:44 +02:00
jiangchuangang 9ed999cb5d fix typo 2022-08-23 09:23:49 +02:00
Goffredo Baroncelli 046f101bf6 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>
2022-08-23 07:22:46 +02:00
Lennart Poettering 81a7eac1f7 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.
2022-08-22 19:25:00 +01:00
Lennart Poettering 127b72da2b 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
2022-08-22 19:17:18 +01:00
Lennart Poettering 8e7e4a730b 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.
2022-08-22 19:15:29 +01:00
Lennart Poettering 8ef6106de4
Merge pull request #24392 from poettering/chase-symlinks-more-stuff
some tweaks to chase_symlinks() and port some code from prefix_roota() over
2022-08-22 18:41:14 +02:00
Yu Watanabe 760971125d test: make TEST-58-REPART support nspawn 2022-08-22 17:00:38 +02:00
Yu Watanabe 2b21522e82 test: merge test-repart.sh and TEST-58-REPART 2022-08-22 17:00:38 +02:00
Yu Watanabe 5996f11679 test: modernize TEST-58-REPART 2022-08-22 17:00:38 +02:00