[systemd-devel] How to handle loop mounts?

Eelco Dolstra eelco.dolstra at logicblox.com
Tue Aug 7 15:13:46 PDT 2012


Hi,

I have an /etc/fstab that contains the following line:

  /disk1.img /disk1 ext4 loop 0 2

where /disk1.img is a regular file containing an ext4 filesystem.  Systemd fails
to mount /disk1 if I run "systemctl start disk1.mount":

> Aug 07 23:53:24 machine systemd[1]: Job disk1.img.device/start timed out.
> Aug 07 23:53:24 machine systemd[1]: Job disk1.mount/start failed with result 'dependency'.
> Aug 07 23:53:24 machine systemd[1]: Job systemd-fsck at disk1.img.service/start failed with result 'dependency'.
> Aug 07 23:53:24 machine systemd[1]: Job disk1.img.device/start failed with result 'timeout'.

I.e. it fails because it creates a device unit "disk1.img.device", but since
/disk1.img is not a sysfs/udev device, this unit never reaches the "plugged"
state and times out.  Mounting the filesystem using "mount /disk1" does work.

A similar problem occurs if /etc/crypttab contains a loop filesystem, i.e.
systemd creates a device unit that times out.

Is this a bug/limitation in systemd or is there some other way to handle loop
mounts with systemd?  If the former, would it make sense for device units to
recognise regular files and go to the "plugged" state immediately?  (It would
need to wait for the mount point containing the file to appear, though.)

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the systemd-devel mailing list