initrd: extend SYSTEMD_IN_INITRD to accept non-ramfs rootfs
authorKairui Song <kasong@redhat.com>
Tue, 12 Jan 2021 16:04:53 +0000 (00:04 +0800)
committerKairui Song <kasong@redhat.com>
Wed, 13 Jan 2021 17:19:09 +0000 (01:19 +0800)
commit1f22621ba33f8089d2ae5fbcaf8b3970dd68aaf0
tree531e245c979a1550c133949ecf903a88d06ca707
parent96cceb35e7985f5ee6c9b17e129a76259273cdde
initrd: extend SYSTEMD_IN_INITRD to accept non-ramfs rootfs

Sometimes, non-ramfs initrd root are useful. Eg, for kdump, because
initramfs is memory consuming, so mount a compressed image in earlier
initrd, chroot into it then let systemd do the rest of job is a good
solution.

But systemd doesn't recognize the initrd environment if rootfs is not a
temporary fs. This is a reasonable check, because switch-root in initrd
will wipe the whole rootfs, will be a disaster if there are any
misdetect.

So extend SYSTEMD_IN_INITRD environment variable, now it accepts boolean
value and two extra keyword, "auto" and "lenient". "auto" is same as
before, and it's the default value. "lenient" will let systemd bypass
the rootfs check.
docs/ENVIRONMENT.md
src/basic/util.c