[systemd-devel] [PATCH 2/3] Allow $SYSTEMD_PRETEND_INITRD to override initramfs detection
Lennart Poettering
lennart at poettering.net
Sun May 3 17:55:39 PDT 2015
On Sat, 02.05.15 13:16, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> When testing generators and other utilities, it is extremely useful
> to be able to trigger initramfs behaviour.
Hmm, what about the following solution: instead of checking with
access() for /etc/initrd-release and then also checking with statfs()
on / whether the root disk is writable, maybe we should just
immediately invoke statfs() on /etc/initrd-release and check the
results. If the call returns ENOENT we know that the file doesn't
exist, and if it returns useful data we can verify if it's tmpfs.
Now, with that in place to test initrd code something like this
suffices:
touch /etc/initrd-release /run/initrd-release
mount --bind /run/initrd-release /etc/initrd-release
As that would result in a file in /etc/initrd-release that is backed
by tmpfs....
In general I'd be very conservative when adding new APIs (which is
basically what $SYSTEMD_PRETEND_INITRD would become), especially if we
only need them for debugging, they are are quiet dangerous and when we
have other options too...
I hope that makes sense?
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list