summaryrefslogtreecommitdiffstats
path: root/src/basic/initrd-util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* env-util: rename getenv_bool_secure() → secure_getenv_bool()Lennart Poettering2024-02-281-1/+1
| | | | | | The glibc API is behind the wrapper is called "secure_getenv()", hence our wrapper really should keep the order too, otherwise things are just too confusing.
* pid1: skip cleanup if root is not tmpfs/ramfsZbigniew Jędrzejewski-Szmek2022-11-091-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | in_initrd() was really doing two things: checking if we're in the initrd, and also verifying that the initrd is set up correctly. But this second check is complicated, in particular it would return false for overlayfs, even with an upper tmpfs layer. It also doesn't support the use case of having an initial initrd with tmpfs, and then transitioning into an intermediate initrd that is e.g. a DDI, i.e. a filesystem possibly with verity arranged as a disk image. We don't need to check if we're in initrd in every program. Instead, concerns are separated: - in_initrd() just does a simple check for /etc/initrd-release. - When doing cleanup, pid1 checks if it's on a tmpfs before starting to wipe the old root. The only case where we want to remove the old root is when we're on a plain tempory filesystem. With an overlay, we'd be creating whiteout files, which is not very useful. (*) This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=2137631 which is caused by systemd refusing to treat the system as an initrd because overlayfs is used. (*) I think the idea of keeping the initrd fs around for shutdown is outdated. We should just have a completely separate exitrd that is unpacked when we want to shut down. This way, we don't waste memory at runtime, and we also don't transition to a potentially older version of systemd. But we don't have support for this yet. This replaces 0fef5b0f0bd9ded1ae7bcb3e4e4b2893e36c51a6.
* Revert "initrd: extend SYSTEMD_IN_INITRD to accept non-ramfs rootfs"Zbigniew Jędrzejewski-Szmek2022-11-091-39/+8
| | | | | | | | | | | | | | | | This reverts commit 1f22621ba33f8089d2ae5fbcaf8b3970dd68aaf0. As described in the reverted commit, we don't want to get rid of the check completely. But the check requires opting-in by setting SYSTEMD_IN_INITRD=lenient, which is cumbersome and doesn't seem to actually happen. https://bugzilla.redhat.com/show_bug.cgi?id=2137631 is caused by systemd refusing to treat the system as an initrd because overlayfs is used. Let's revert this approach and do something that doesn't require opt-in instead. I don't think it makes sense to keep support for "SYSTEMD_IN_INITRD=lenient" or "SYSTEMD_IN_INITRD=auto". To get "auto" behaviour, just unset the option. And "lenient" will be reimplemented as a better check. Thus the changes to the option interface are completely reverted.
* basic: create new basic/initrd-util.[ch] for initrd-related functionsZbigniew Jędrzejewski-Szmek2022-11-081-0/+75
I changed imports of util.h to initrd-util.h, or added an import of initrd-util.h, to keep compilation working. It turns out that many files didn't import util.h directly. When viewing the patch, don't be confused by git rename detection logic: a new .c file is added and two functions moved into it.