Mender-convert not enough loop devices

When using docker-mender-convert on a pretty fresh install of xubuntu 18.04 I keep getting an error (Error: cannot find an unused loop device. Aborting.). The Error happens in stage 9/9.
Unfortunately I haven’t been able to trace the error in any way yet. Does anyone you have any insight into this?
I try to convert a stock raspbian lite image with the following command:

./docker-mender-convert from-raw-disk-image --raw-disk-image input/2019-04-08-raspbian-stretch-lite.img --mender-disk-image input/raspbian-mender-ge.img --device-type raspberrypi3 --artifact-name raspbian-mender-ge --bootloader-toolchain arm-buildroot-linux-gnueabihf --demo --demo-host-ip --storage-total-size-mb 4000

Edit: @mirzak: prettify command highlighting.

Can you check if you have the loop kernel module running, e.g

$ lsmod | grep loop
loop                   40960  14

And you should also have /dev/loopX devices, and based on the error it seems that that it can not find any available loop devices.

Loop service is running, as I can mount loop devices.

According to it doesd not appear in lsmod, as the module is compiled into the kernel.

I even tried to increase the number of loop devices of the machine to 64 - and checked that there were 64 loop entries in /dev/. This didn’t change a thing.

Wonder if it is a docker permission thing. The docker-mender-convert will execute with --privileged=true which should give it access to loop devices, but maybe something has changed here.

Can you try to manually verify if you can access loop devices from within docker containers?

I’ll try to find out. Intrestingly enough the mender-convert utility is able to mount some partitions before the error occurs - if I understand things correctly (sorry I’m very new to docker and mender) this also uses loop devices.

Yes, it does seem that it was able to mount things earlier if it fails at stage 9/9.

Can you paste the full build log, and also output of docker --version

It should be the newest one - Docker version 18.09.6, build 481bc77

To answer your previous question - Yes, I am able to access /dev from docker. For this I used:

docker run -t -i --privileged -v /dev:/dev ubuntu:18.04
ls /dev/ 

gave the output:

autofs         core             fd         initctl       loop2   mem                 ppp     sda       stderr  tty12  tty2   tty27  tty34  tty41  tty49  tty56  tty63   ttyS12  ttyS2   ttyS27  ttyS6      userio     vcs5   vcsa5        zero
block          cpu_dma_latency  full       input         loop3   memory_bandwidth    psaux   sda1      stdin   tty13  tty20  tty28  tty35  tty42  tty5   tty57  tty7    ttyS13  ttyS20  ttyS28  ttyS7      vboxguest  vcs6   vcsa6
bsg            cuse             fuse       kmsg          loop4   mqueue              ptmx    sg0       stdout  tty14  tty21  tty29  tty36  tty43  tty50  tty58  tty8    ttyS14  ttyS21  ttyS29  ttyS8      vboxuser   vcs7   vcsa7
btrfs-control  disk             hidraw0    lightnvm      loop5   net                 pts     sg1       tty     tty15  tty22  tty3   tty37  tty44  tty51  tty59  tty9    ttyS15  ttyS22  ttyS3   ttyS9      vcs        vcsa   vfio
bus            dri              hpet       log           loop6   network_latency     random  shm       tty0    tty16  tty23  tty30  tty38  tty45  tty52  tty6   ttyS0   ttyS16  ttyS23  ttyS30  ttyprintk  vcs1       vcsa1  vga_arbiter
cdrom          dvd              hugepages  loop-control  loop7   network_throughput  rfkill  snapshot  tty1    tty17  tty24  tty31  tty39  tty46  tty53  tty60  ttyS1   ttyS17  ttyS24  ttyS31  uhid       vcs2       vcsa2  vhci
char           ecryptfs         hwrng      loop0         mapper  null                rtc     snd       tty10   tty18  tty25  tty32  tty4   tty47  tty54  tty61  ttyS10  ttyS18  ttyS25  ttyS4   uinput     vcs3       vcsa3  vhost-net
console        fb0              i2c-0      loop1         mcelog  port                rtc0    sr0       tty11   tty19  tty26  tty33  tty40  tty48  tty55  tty62  ttyS11  ttyS19  ttyS26  ttyS5   urandom    vcs4       vcsa4  vhost-vsock

can you pls try following
if losetup seems more loop devices. maybe there is some issue with ubuntu 18.04 (or latest docker). I’m using mender-convert on 16.04 without any problems though.

Thanks for your help.
I just figured that the problem was that my Xubuntu installation agressively mounting all available partitions. So it’s a problem in the host system and is resolved by disabling automount during mender-convert.

@sensslen thanks for reporting back. Maybe can you pls copy some command or link how you do it -> can be helpful for others also. :+1:

Of course I can. Since my Ubuntu uses XFCE I used the Gui Application to disable automount by going to Settings:

in submenu Removable Drives and Media:
Untick all Checkboxes under Removable Drives.

1 Like

Thanks a lot.

I am having this issue right now, and I am running ubuntu server via console.

I am working on it now.

I ended up doing a

docker system prune



it seems to have fixed the issue