[systemd-devel] handling mount failure in initramfs context

Vivek Goyal vgoyal at redhat.com
Tue May 27 07:31:43 PDT 2014


On Mon, May 26, 2014 at 04:12:56PM +0800, WANG Chao wrote:
> Hi, all
> 
> In a pure initramfs enviroment, I want to mount a filesystem and I put
> an mount entry in /etc/fstab, so that fstab-generator could generate a
> mount unit and systemd will mount it at some time.
> 
> I have a question about mount failure in such case:
> 
> How can I make sure that upon a mount failure, systemd would stop
> booting and switch to emergency handling?

I will give little more context to the problem at hand.

So kdump uses --mount option of dracut to mount file systems in initramfs
context. dracut puts right values in /etc/fstab of initramfs which in
turn are parsed by systemd and mount units are generated.

Now question is what will happen if one of the mount failed? I think
currently systemd does not drop us to emergency shell and instead
continues to boot.

We are trying to figure out how to change this behavior where we can
tell systemd to drop into an emergency shell instead.

I think Chao used "x-initrd.mount" option as mount option and that changes
the behavior. With this option the mount unit becomes required by
"initrd-root-fs.target" rather than it used to be "local-fs.target". And
the way these targets are configured, we drop into emergency shell with
other untis isolated.

Point being that usage of "x-initrd.mount" to achieve the desired behavior
sounded hackish to me. Nowhere systemd guarantees that usage of this 
option will ensure certain dependencies. I think this option just means
that file system will be mounted in initramfs.

So is there a better way to achieve what we are looking for.

Thanks
Vivek


More information about the systemd-devel mailing list