Commit graph

65138 commits

Author SHA1 Message Date
Asier Sarasua Garmendia 6fce42e15d po: Translated using Weblate (Basque)
Currently translated at 16.5% (32 of 193 strings)

po: Added translation using Weblate (Basque)

Co-authored-by: Asier Sarasua Garmendia <asier.sarasua@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/eu/
Translation: systemd/main
2023-06-03 17:48:02 +02:00
Lennart Poettering 798e811733 umount: /usr/ should never be unmounted regardless of HAVE_SPLIT_USR or not
Whether we put some binaries in /bin or in /usr/bin should not have any
effect on unmounting during shutdown. Even if people split /usr/ off we
should not try to unmount it, no matter what as it is simply where
binaries are placed.
2023-06-03 16:48:00 +01:00
Adrian Vovk 0470f91983 sysupdate.d: Add way to drop binaries into $BOOT
As described in the BLS, we should place binaries into the XBOOTLDR
directory if it is available, otherwise into the ESP. Thus, we might
need to put binaries into /boot or into /efi depending on the existence
of the XBOOTLDR partition.

With this change, we introduce a new PathRelativeTo= config option that
makes this functionality possible
2023-06-03 09:13:27 +02:00
Luca Boccassi 58a5a2362c
Merge pull request #27904 from DaanDeMeyer/lsm
mkosi: Enable more options
2023-06-02 23:57:21 +01:00
Luca Boccassi e1aacab7d5
Merge pull request #27903 from mrc0mmand/test-followups
test: a couple of systemd-{coredump,pstore,run} followups
2023-06-02 23:56:58 +01:00
Lennart Poettering 4d824ac0d3
Merge pull request #27435 from poettering/renew-reboot
pid1: add a new method of rebooting: userspace only under the name "soft-reboot"
2023-06-02 23:27:45 +02:00
Lennart Poettering 2e04ba9de9
Merge pull request #27896 from poettering/umount-detach-rework
shutdown: refactoring + tone down log message a bit
2023-06-02 21:47:09 +02:00
Lennart Poettering db41880d34
Merge pull request #27902 from poettering/round-up
add ROUND_UP() macro for rounding integer up to next multiple of some value
2023-06-02 21:46:50 +02:00
Lennart Poettering 5596fd8ff7 update TODO 2023-06-02 18:43:11 +02:00
Lennart Poettering 093d545658 test: add integration test for soft reboots incl. fdstore passing 2023-06-02 18:43:11 +02:00
Lennart Poettering 8af66251a1 test: disable SoftReboot() in dfuzzer test for now
As requested:

https://github.com/systemd/systemd/pull/27435#issuecomment-1527810336
2023-06-02 18:43:11 +02:00
Lennart Poettering 4de665812a man: document the soft reboot operation 2023-06-02 18:43:10 +02:00
Lennart Poettering ba1af88c3c fstab-util: consider /run/nextroot/ among extrinsic mounts
This way we'll not add deps for the mount point that unmount it during
shutdown. This is similar as for /run/initramfs/ which we want to
transition into during shutdown.

This way we don't have to add "-o x-initrd.mount" to all bind mounts for
/run/nextroot anymore to make it survive the reboot, it will be implied.
2023-06-02 18:43:10 +02:00
Lennart Poettering d585065624 mount-setup: exclude /run/nextroot/ from relabelling
Just like /run/initramfs/ the data in /run/nextroot/ should be a
self-contained OS tree, and not require labelling, hence don't.
2023-06-02 18:43:10 +02:00
Lennart Poettering f717d7a40a switch-root: automatically make target switch root dir a mount point
Let's make sure implicitly that the target directory is a mount point,
instead of doing so manually beforehand. This allows us to drop this
step from the transition into the /run/initramfs/ dir at shutdown.

During the initrd→host transition the switch root operations so far
where towards pre-existing mount points, but there are cetrainly
usecases where it might make sense to siwtch into arbitrary
subdirectories, too.
2023-06-02 18:43:10 +02:00
Lennart Poettering f9ad896ee2 mount-util: add fd_make_mount_point() helper 2023-06-02 18:43:10 +02:00
Daan De Meyer cc532533b8 mkosi: Enable more options
We build with support for selinux/apparmor where applicable but
disable them at runtime as even in permissive mode they're horribly
broken.
2023-06-02 17:25:23 +02:00
Frantisek Sumsal 50fb26d237 test: probe a couple more paths in systemd-run 2023-06-02 16:59:58 +02:00
Lennart Poettering 1795252caa switch-root: disable sync() again when we switch root during shutdown
Our shutdown binary that takes over as PID 1 when shutting down puts
great efforts into a sync() that comes with a time-out once sync'ing
process stops. If we'd add another dumb sync() here, we kinda defeat all
it is good for. Hence, let's keep the sync() in for most codepats, but
let's disable it for the final shutdown logic when we transition back
into the exitrd. After all we sync()ed more than enough here, no need to
sync() even more.
2023-06-02 16:49:39 +02:00
Lennart Poettering 2932161bf6 switch-root: introduce SwitchRootFlags flags parameter to switch_root()
Let's replace the current boolean param with a proper flags param. With
a single flag this doesn't appear to make much sense, though it does
already make things more readable I think.

However, once we add a second flag, it starts to make more sense.

Also, while we are at it, condition the "istmp" determinaton with this
flag too, since we only need it when the flag is set.
2023-06-02 16:49:39 +02:00
Lennart Poettering 7c764d4599 switch-root: always use MS_BIND to move api vfs over
We previously would use MS_MOVE to move the old procfs, sysfs, /dev/ and
/run to the new place in some places, and MS_BIND in others.

The logic when to use MS_MOVE and when to use MS_BIND was pretty
arbitrary so far: we'd use MS_MOVE during the initrd → host transition
and MS_BIND when transitioning from host into the exitrd during
shutdown.

Traditionally, using MS_MOVE was preferable, because we didn't bother
with unmounting the old mount hierarchy before the switch root, and thus
using MS_MOVE did some clean-up as side-effect (because the old mounts
went away this way). But since we nowadays properly umount all remaining
mount points (since 268d1244e8) when
transitioning it's pointless.

Let's just use MS_BIND always. Let's tweak it though: let's use
MS_BIND|MS_REC for the kernel API VFS, and MS_BIND without MS_REC for
/run/. The latter reflects the fact that the submounts /run/ has usually
are not so much about just accessing kernel APIs but about auxiliary
user resources. Hence let's only move the main mount over for that.

While we are at it, also set up the base filesystem *before* we move the
mounts from the old to the new root, since the base filesystem setup
logic creates various needed inodes for us, which we really should make
use of instead of creating on our own.
2023-06-02 16:49:39 +02:00
Lennart Poettering 34f21ff610 systemctl: add "systemctl soft-reboot" command 2023-06-02 16:49:38 +02:00
Lennart Poettering 9edf5af57b logind: add support for 'soft-reboot' reboots 2023-06-02 16:49:38 +02:00
Lennart Poettering 13ffc60749 pid1: add "soft-reboot" reboot method
This adds a new mechanism for rebooting, a form of "userspace reboot"
hereby dubbed "soft-reboot". It will stop all services as in a usual
shutdown, possibly transition into a new root fs and then issue a fresh
initial transaction. The kernel is not replaced.

File descriptors can be passed over, thus opening the door for leaving
certain resources around between such reboots.

Usecase: this is an extremely quick way to reset userspace fully when
updating image based systems, without going through a full
hardware/firmware/boot loader/kernel/initrd cycle. It minimizes "grayout time"
for OS updates. (In particular when combined with kernel live patching)
2023-06-02 16:49:38 +02:00
Lennart Poettering 4dcaab9c89 tree-wide: port various pieces of code over to ROUND_UP()
There's probably more than we can convert to this.
2023-06-02 16:43:39 +02:00
Lennart Poettering beda8529b9 test-macro: add ROUND_UP() macro for rounding up to next multiple
In case of overflow will return -1 cast to the first parameter type.
2023-06-02 16:41:36 +02:00
Frantisek Sumsal 878ec7942f coverage: add a wrapper for execvpe()
It's the exactly same stuff as for execveat() - gcov doesn't have a
wrapper for execvpe() so introduce our own.
2023-06-02 16:25:06 +02:00
Daan De Meyer 8f9a307fec
Merge pull request #27849 from DaanDeMeyer/sign-pcr
mkosi: Sign expected PCRs
2023-06-02 16:16:41 +02:00
Lennart Poettering 9dd2da5b72 shutdown: tone down failure messages a bit
If we are not able to detach all MD/DM/loopback devices this is not
necessarily a failure, it's simply because we might be running off them.
Hence let's tone down our language a bit, and just say "Unable to"
rather than "Failed to".
2023-06-02 15:56:06 +02:00
Lennart Poettering 9959797dbf detach-loopback: also don't bother detaching loopback block device /usr/ is running off
While we are at it, let's also clean this up a bit: unlike DM/MD devices
loopback devices are likely partitioned, hence trace the block device
through the partition layer and LUKS.
2023-06-02 15:56:06 +02:00
Lennart Poettering 2067a7ec7f detach-md: similar to the DM case, also don't try to detach MD device backing /usr/ 2023-06-02 15:56:06 +02:00
Lennart Poettering 31d346206c shutdown: don't attempt to detach DM volume backing /usr/
Since we run off /usr/ it makes no sense to attempt to try to detach any
DM device backing it. Hence skip it just like we skip detaching the DM
device backing the root fs.

Addresses: https://github.com/systemd/systemd/issues/27682#issuecomment-1573328188
2023-06-02 15:56:06 +02:00
Lennart Poettering f5fcacdf2c detach-loopback: also decouple from umount.h
Let's introduce LoopbackDevice as replacement for MountPoint, with just
the fields we actually need.
2023-06-02 15:56:06 +02:00
Lennart Poettering 6514a6fd82 detach-md: also decouple structures from umount.h 2023-06-02 15:56:06 +02:00
Lennart Poettering 015937f901 detach-dm: decouple from umount.[ch]
Let's also define our own little structure here with just the fields we
need.
2023-06-02 15:56:06 +02:00
Lennart Poettering a0fb20672d detach-swap: decouple from umount.h
So far detach-swap.[ch] were still using the MountPoint structure to
store swap device info in. Since it was only using a single field of it
sharing the whole structure is kinda pointless. Hence, let's decouple
this and only add the field we really need.
2023-06-02 15:56:06 +02:00
Lennart Poettering 82a1d6d096 umount: split out swap detachment code too 2023-06-02 15:56:06 +02:00
Lennart Poettering 2e2c472b1c umount: split out loopback detach code
Like the similar commits, no actual code changes, just splitting up
large C files.
2023-06-02 15:56:06 +02:00
Lennart Poettering b44411c702 umount: similar as previous commit, split out DM detaching 2023-06-02 15:56:06 +02:00
Lennart Poettering 49427110a0 umount: split out MD detaching code from umount.c
umount.c does so much stuff, and MD detaching is relatively separate,
hence split it out into its own .c/.h file pair.
2023-06-02 15:56:06 +02:00
Lennart Poettering ca6cdd2605 dissect-image: fix partition label version compare
The logic was borked: if we find multiple partitions of the same
designator, we should first prefer the better arch, and then prefer the
better version, and then the first found. Fix that.

Fixes: #27897
2023-06-02 15:54:13 +02:00
Daan De Meyer a47c48cbb2 mkosi: Only lower device timeout instead of all timeouts
We only really care about lowering the device timeout so we get to
a shell faster when the root device doesn't appear so let's only
lower that timeout instead of lowering all default timeouts.
2023-06-02 15:43:28 +02:00
Daan De Meyer 6b818cd7e5 core: Add systemd.default_device_timeout_sec= cmdline option 2023-06-02 15:43:28 +02:00
Daan De Meyer ee6eedab82 mkosi: Sign expected PCRs
This is now possible without a TMP device so let's start signing
PCRs when building images with mkosi.
2023-06-02 15:43:28 +02:00
Daan De Meyer e577318ddb mkosi: Remove file blacklisting erofs module in opensuse initrd 2023-06-02 15:43:28 +02:00
Daan De Meyer 2d1d0a6cce mkosi: Enable set -e in postinst script 2023-06-02 15:43:28 +02:00
Daan De Meyer 88f7fb16f2 mkosi: Move python3-pytest-flakes to build packages on opensuse 2023-06-02 15:43:28 +02:00
Daan De Meyer 2ee97f56e1 mkosi: Add missing tss2 dependencies 2023-06-02 15:43:28 +02:00
Daan De Meyer d7a5730848 meson: Add missing tss2-tcti-device dependency 2023-06-02 15:43:28 +02:00
Daan De Meyer 2af9d5dc0e mkosi: Update to latest 2023-06-02 13:32:53 +02:00