Mount command raise an ERROR!

Hi all,
I am a user of a container, when I run the following command I receive error:

$ mount –o loop,offset=32256 /dist/m5/sytem/myfile.img /mnt
mount: /mnt: mount failed: Unknown error -1

Any help is appreciated.
Thanks,
Mohammad

Is it a privileged or unprivileged container, is that LXC or LXD?

You’re not providing a lot of context here :slight_smile:

This error usually indicates that you don’t have any /dev/loop* devices in your container. But if your container is unprivileged, solving that part of the problem won’t do you any good anyway.

To use loop devices in a container you need:

  • The container to be privileged
  • The device cgroup to allow the creation and use of loop devices
  • The loop devices to be created in the container
  • Mount of the resulting loop device to be allowed in apparmor

All of those are very privileged operations which could be used to attack the host and are therefore not allowed by default, so you need quite a bit of tweaking for that. How to do that depends on whether you’re using LXC or LXD.