[systemd-devel] Shutdown root fs on loop device

Lennart Poettering lennart at poettering.net
Fri Apr 22 14:41:59 UTC 2016


On Fri, 22.04.16 11:49, Michael Lipp (mnl at mnl.de) wrote:

> Hi,
> 
> I have some PCs where I have to store the Linux root file system as a
> large file in Window's NTFS file system. Everything boots fine. The NTFS
> file system is mounted as ntfs-3g in the initial ramfs as /host, the
> loopback device is created (using /host/Linux/image.img) and used as root.
> 
> However, the system doesn't shut down cleanly, usually it simply hangs.
> I admit that it isn't easy to solve this situation on shutdown. When
> executing findmnt in the running Linux system, the only "hint" is
> /dev/loop0 being mounted as root. The NTFS mount doesn't appear at all.
> It only shows in systemctl status, which starts with
> 
> init.scope
> |.   1 /sbin/init
> |- 155 mount.ntfs-3g -o permissions /dev/sda2 /host
> 
> Is it possible to configure systemd-shutdown somehow (e.g. hook
> scripts)? Or do I have to write my own systemd-shutdown?

If marking your fuse process with "@" doesn't suffice (as suggested in
the other mails in this thread), you can always define an initrd
shutdown script:

https://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/

i.e. the /run/initramfs/shutdown stuff discussed there.

But note that this is invoked after the built-in shutdown logic has
run, and thus you probably want to combine it with the "@" logic.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list