1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 23:21:22 +03:00
Commit Graph

56979 Commits

Author SHA1 Message Date
Lennart Poettering
f7a7a5e267 bootspec: assess default/selected entries *after* we augmented entry list with entries from loader
Fixes: #22580
2022-03-28 16:01:36 +02:00
Lennart Poettering
92067ab672 bootspec: normalize oom handling in boot_load_efi_entry_pointers()
OOM should usually be fatal, hence make it so here, too.
2022-03-28 16:01:32 +02:00
Lennart Poettering
85e17916d3 bootspec: rename type1 parsers to say "type1" explicitly in the name
This just got too confusing for me. With this change we'll now have
_unified as common suffix for stuff loading unified kernels (i.e. type
1), and _type1 as common suffix for type1 entries.

Just some renaming.
2022-03-28 16:01:28 +02:00
Lennart Poettering
d486a0eaaa bootspec: try harder to suppress duplicate enumerated entries
For testing purposes I run one of my system symlinking /boot/loader/ to
/efi/loader/. This triggers annoying behaviour in boot entry
enumeration: the code ends up iterating through the 'entries' subdir of
both, thinking one was actually in the ESP and the other in XBOOTLDR,
and thus distinct. This would result in duplicate entries.

Let's address that, and filter out duplicates via their inode numbers:
never process the same inode twice. This should protect us from any
confusion effectively, regardless which inodes are symlinked (or even
bind mounted).
2022-03-28 16:01:10 +02:00
Lennart Poettering
85f4ae2f50 bootspec: pass around BootConfig struct instead of entries/n_entries fields only
This simplifies the parameter lists quite a bit, at zero change in
behaviour.
2022-03-28 16:01:06 +02:00
Lennart Poettering
d04f033111 bootspec: don't use conf_files_list() for finding type #1 entries
We can't really use conf_files_list() for finding type #1 entries, since
it is case-sensitive, but type #1 entries are typically placed on VFAT,
i.e. are case-insensitive.

hence, use readdir_all() instead, which is quite similar, but gives us
all files, and allows us to do a case-insensitive check.

While we are at it, use openat() on the open dir to open the file, and
pass that around, to make things a tiny bit more race-free.
2022-03-28 16:01:02 +02:00
Lennart Poettering
0d1506d4a8 bootctl: optionally, output entries in JSON format
Replaces: #18387
Fixes: #18094
2022-03-28 16:00:25 +02:00
наб
53350c7bba Use new default-user-shell option instead of hard-coding bash in nspawn and user-record
Defaults to /bin/bash, no changes in the default configuration

The fallback shell for non-root users is as-specified,
and the interactive shell for nspawn sessions is started as
  exec(default-user-shell, "-" + basename(default-user-shell), ...)
before falling through to bash and sh
2022-03-28 14:24:46 +02:00
Luca Boccassi
505df87ea8 docs: use native type instead of byte stream in COREDUMP_PACKAGE_METADATA
The first three fields of a note are binary, so they are subject to
flipping due to endianess. Instead of a stream of bytes, just use
the native 4-bytes type so that it gets encoded automatically.

Implemented in the tools via: https://github.com/systemd/package-notes/pull/31
2022-03-28 14:19:42 +02:00
Romain Naour
608c3b0293 missing-syscall: define MOVE_MOUNT_T_EMPTY_PATH if missing
MOVE_MOUNT_T_EMPTY_PATH has been added to systemd 250 by [1]
but it's defined in kernel headers since version 5.2.

[1] c7bf079bbc
2022-03-28 16:37:59 +09:00
Luca Boccassi
d13ce742e1
Merge pull request #22834 from yuwata/network-sriov-request-queue
network: sriov: use request queue
2022-03-26 19:12:42 +00:00
Luca Boccassi
6b72105a78 portable: clarify error when detach fails to match to existing unit
Clarify that it's looking at attached units, not at units inside the referenced
image. Also take into account extensions.
2022-03-26 11:20:39 +00:00
Zbigniew Jędrzejewski-Szmek
d6297626dd NEWS: tweaks 2022-03-25 16:32:16 +01:00
Xiaotian Wu
0172289348 basic: update the Arch tuples for LoongArch 2022-03-26 00:29:38 +09:00
Yu Watanabe
dd2396f20d
Merge pull request #22861 from poettering/journald-sigterm
journald: don't let SIGTERM starve indefinitely
2022-03-26 00:27:47 +09:00
Daan De Meyer
e5531be27b
Merge pull request #22857 from poettering/journal-file-flags
journal: add flags param to journal_file_open(), replacing bools
2022-03-25 10:16:12 +01:00
Lennart Poettering
47f04c2a69 journal-file: if we are going down, don't use event loop to schedule post
The event loop is already shutting down, hence no point in using it
anymore, it's not going to run any further iteration.
2022-03-25 10:03:00 +01:00
Lennart Poettering
19252b2548 journald: make sure SIGTERM handling doesn't get starved out
Fixes: #22642
2022-03-25 10:03:00 +01:00
Lennart Poettering
e540c5a621 journal: don't talk about -1 in context of unsigned values 2022-03-25 09:59:09 +01:00
Lennart Poettering
49615dbd81 journal-file: merge compress/seal bool args into a single flags param
Just some modernization/refactoring.

No change in behaviour, just let's do how we do things these days: use
flags param instead of list of bools.
2022-03-25 09:59:09 +01:00
Lennart Poettering
6fb57abcfa
Merge pull request #22717 from yuwata/udev-lock-block-device-by-main-process
udev: do not skip events when device is already locked
2022-03-25 09:43:12 +01:00
Lennart Poettering
a35420d85d journal-remote: constify a few parameters 2022-03-25 09:21:38 +01:00
Lennart Poettering
88a19c7e04
Merge pull request #22859 from poettering/hardware-rename
machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=
2022-03-25 09:12:14 +01:00
Benjamin Berg
c2b42ec413 xdg-autostart-service: Fix binary escaping and simplify code a bit
Instead of escaping each component separately, we can instead use
quote_command_line. Doing so simplifies the code and fixes an issue
where spaces inside the executable name were not escaped.

Co-Authored-By: David Edmundson <kde@davidedmundson.co.uk>
2022-03-25 14:50:41 +09:00
Yu Watanabe
8603a229e9 efi-loader: drop harmful assertion
This fixes a bug introduced by 7be4b23649.

The function `efi_loader_get_device_part_uuid()` handles NULL
gracefully, and it is called with NULL in gpt-auto-generator.

Fixes #22862.
2022-03-25 14:29:44 +09:00
Frantisek Sumsal
41d1aaea64 test: use flock when calling mkfs.btrfs
As stated in https://github.com/systemd/systemd/issues/21819#issuecomment-1064377645
`mkfs.btrfs` doesn't hold the lock for the whole duration of
`mkfs.btrfs`, thus causing unexpected races & test fails. Let's
wrap the `mkfs.btrfs` calls in an flock wrapper to mitigate this.

Hopefully fixes: #21819
2022-03-25 10:28:07 +09:00
Frantisek Sumsal
ed1cbdc347 Revert "test: temporary workaround for #21819"
This reverts commit 95e35511bb.
2022-03-25 10:28:07 +09:00
Yu Watanabe
82a5de9fd2 udev: assume block device is not locked when a new event is queued
Then, hopefully, previously requeued events are processed earlier.
2022-03-25 10:28:07 +09:00
Yu Watanabe
7b7959fba5 udev: split worker_lock_block_device() into two
This also makes return value initialized when these function return 0 to
follow our coding style.

Just a preparation for later commits.
2022-03-25 10:28:07 +09:00
Yu Watanabe
5d354e525a udev: requeue event when the corresponding block device is locked by another process
Previously, if a block device is locked by another process, then the
corresponding worker skip to process the corresponding event, and does
not broadcast the uevent to libudev listners. This causes several issues:

- During a period of a device being locked by a process, if a user trigger
  an event with `udevadm trigger --settle`, then it never returned.

- When there is a delay between close and unlock in a process, then the
  synthesized events triggered by inotify may not be processed. This can
  happens easily by wrapping mkfs with flock. This causes severe issues
  e.g. new devlinks are not created, or old devlinks are not removed.

This commit makes events are requeued with a tiny delay when the corresponding
block devices are locked by other processes. With this way, the triggered
uevent may be delayed but is always processed by udevd. Hence, the above
issues can be solved. Also, it is not necessary to watch a block device
unconditionally when it is already locked. Hence, the logic is dropped.
2022-03-25 10:28:03 +09:00
Yu Watanabe
0c3d8182c9 udev: store action in struct Event 2022-03-25 10:25:27 +09:00
Yu Watanabe
c17ab900cb udev: introduce device_broadcast() helper function 2022-03-25 10:25:26 +09:00
Yu Watanabe
c9473aaa5b udev: drop unnecessary clone of received sd-device object
As the sd-device object received through sd-device-monitor is sealed,
so the corresponding udev database or uevent file will not be read.
2022-03-25 10:25:26 +09:00
Yu Watanabe
00adc340bb inotify-util: declare iterator in FOREACH_INOTIFY_EVENT()
This also makes the macro check if the event is actually in the buffer,
and if it is not, then log about that and finish the loop.
2022-03-24 23:12:34 +00:00
Luca Boccassi
f72f802118 update NEWS
Fix typo and list all user session settings that now are documented
to work
2022-03-24 22:46:14 +00:00
Lennart Poettering
60a777b575 update NEWS 2022-03-24 22:41:39 +01:00
Lennart Poettering
38639aa28f hostnamed: properly reset hw model/vendor props before re-reading them
Follow-up for 4fc7e4f374
2022-03-24 21:29:13 +01:00
Lennart Poettering
0924ea2b26 machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=
Let's be more precise here. Otherwise people might think this describes
the software system or so. We already expose this via hostnamed as
HardwareVendor/HardwareModel hence use the exact same wording.

(Note that the relevant props on the dmi device are just VENDOR/MODEL,
but that's OK given that DMI really is about hardware anyway,
unconditionally, hence no chance of confusion there.)

Follow-up for 4fc7e4f374
2022-03-24 21:29:13 +01:00
Frantisek Sumsal
a73c7a87ae
Merge pull request #22855 from keszybz/test-68-reload-reload
TEST-68: replace daemon-reload with separate handler units
2022-03-24 19:52:16 +00:00
Lennart Poettering
3824ce0522
Merge pull request #22840 from poettering/efivars-tweaks
util-lib: efi variable access refactorings
2022-03-24 18:39:46 +01:00
Lennart Poettering
e1f0c1367c NEWS: various tweaks 2022-03-24 17:59:25 +01:00
Yu Watanabe
c02fb80479 udev: try to reload selinux label database less frequently
Previously, `event_run()` was called repeatedly in one `event_queue_start()`
invocation. Hence, the SELinux label database is reloaded many times needlessly.
Other settings, e.g. udev rules or hwdata, are tried to be reloaded in the
beginning of `event_queue_start()`. Let's also do so for the SELinux database.
2022-03-24 16:20:42 +01:00
Yu Watanabe
2d40f02ee4 udev: assume there is no blocker when failed to check event dependencies
Previously, if udevd failed to resolve event dependency, the event is
ignored and libudev listeners did not receive the event. This is
inconsistent with the case when a worker failed to process a event,
in that case, the original uevent sent by the kernel is broadcasted to
listeners.
2022-03-24 16:20:32 +01:00
Yu Watanabe
ef400c3878 udev: only ignore ENOENT or friends which suggest the block device is not exist
The ENOENT, ENXIO, and ENODEV error can happen easily when a block
device appears and soon removed. So, it is reasonable to ignore the
error. But other errors should not occur here, and hence let's handle
them as critical.
2022-03-24 16:20:08 +01:00
Lennart Poettering
3f2ada89f3 errno-util: add ERRNO_IS_DEVICE_ABSENT() macro
Inspired by: https://github.com/systemd/systemd/pull/22717#discussion_r834254495
2022-03-24 16:19:48 +01:00
Yu Watanabe
4029328014 udev: remove /run/udev/queue in on_post()
When the last queued event is processed, information about subsequent
events may be already queued in the netlink socket of sd-device-monitor.
In that case, previously we once removed /run/udev/queue and touch the
file soon later, and `udevadm settle` mistakenly considered all events
are processed.

To mitigate such situation, this makes /run/udev/queue removed in on_post().
2022-03-24 16:19:36 +01:00
Yu Watanabe
9612da361a udev: use sd_event_source_disable_unref()
This should not change any behavior, as the event sources are not
shared. Just for safety.
2022-03-24 16:19:20 +01:00
Yu Watanabe
87afc766d1 udev: update comment and log message 2022-03-24 16:19:05 +01:00
Lennart Poettering
7be4b23649 efi-loader: split efi-api.[ch] from efi-loader.[ch]
Some refactoring: split efi-loader.[ch] in two: isolate the calls that
implement out boot loader interface spec, and those which implement
access to upstream UEFI firmware features.

They are quite different in nature and behaviour, and even semantically
it makes to keep these two separate. At the very least because the
previous name "efi-loader.[ch]" suggests all was about loader-specific
APIs, but much of it is generic uefi stuff...

While we are at it, I renamed a bunch of return parameters to follow our
usual ret_xyz naming. But besides renaming no real code changes.
2022-03-24 15:21:09 +01:00
Lennart Poettering
8fc5c44426 efivars: define efi variable flags less weirdly
The flags are actually 32bit values, but aligned with zeroes befitting a
64bit value. Let's fix that.
2022-03-24 15:21:03 +01:00