Running out of loopback devices during compilation?


Hi guys,

Just trying to compile resin on Debian at the moment, and I’m coming across an issue when it comes to compiling docker-supervisor, namely that the build fails with the following error:

    ERROR: docker-resin-supervisor-disk-0.0.0-r0 do_compile: docker-disk: Host must have at least one available loop device.
ERROR: docker-resin-supervisor-disk-0.0.0-r0 do_compile: Function failed: do_compile (log file is located at /home/yocto/resin-chip/build/tmp/work/chip-poky-linux-gnueabi/docker-resin-supervisor-disk/0.0.0-r0/temp/log.do_compile.5128)
ERROR: Logfile of failure stored in: /home/yocto/resin-chip/build/tmp/work/chip-poky-linux-gnueabi/docker-resin-supervisor-disk/0.0.0-r0/temp/log.do_compile.5128
ERROR: Task (/home/yocto/resin-chip/build/../layers/meta-resin/meta-resin-common/recipes-containers/docker-disk/ failed with exit code '1'

Has anyone else had this issue before, and anyone got an idea how to solve it? From what I can tell it is due to losetup not being run as root, but if one tries to run ./resin-yocto-scripts/build/barys as root, it complains about bitbake being run as root. Any thoughts?


Hey, if you run losetup it should list all of your loop devices currently in use and what they are pointing at, it’s possible that they are all in use by things that you no longer want and you can use losetup --detach to detach those, otherwise you should be able to use modprobe loop max_loop=256 to increase the number of devices to the max of 256 which should make sure there are more than enough available



the problem is not that there is a shortage of loopback devices as far as I can tell - I’ve run the max_loop command, but it is instead that losetup -f does not work (command not found) if it is not run as root. Running the build script as root then causes a problem with bitbake, which doesn’t run as root. Hence I can either get losetup or bitbake working depending on which user I run it as, but not both at the same time :confused:


That is a strange behavior. losetup should be able to run in some modes without being invoked as root. For example losetup -f should be able to run fine as normal user. I just tested this with Ubuntu 16.04 and Arch Linux. Can you tell me what host OS are you using and what are the permissions on the losetup binary?



Hi agherzan, I’m running it on Debian (Linux version 3.16.0-4-amd64 ( (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07)). I’ve just started a new build with barys, but have this time specified an -m flag, and thus far have not seen the error, touchwood. Let me get back to you in 10 mins in case this solved it…


I don’t see how these two could be related but let’s wait for it to complete.


hi @sashahilton00 , if you still get the loop device error, can you try creating a new loop device yourself on your build machine?
First thing would be to check what loop devices you have already created so that you know how to name the next one, just to keep things tidy. So look up what other /dev/loop devices are there.
Then, just do a “sudo mknod /dev/loopX b 7 X”, where X is the new loop device number you wish to create.


In the end I got it to build and run successfully. Turns out that building with the -m flag solved the problem, though why that does solve the problem is unexplained…


Which repo are you trying to compile? The output you pasted says “resin-chip”. Can you paste the URL to the repo?