iximiuz / docker-to-linux

Make bootable Linux disk image (ab)using Docker
https://iximiuz.com/en/posts/from-docker-container-to-bootable-linux-disk-image/
669 stars 93 forks source link

Script fails with "failed to setup loop device" #2

Closed christau closed 5 years ago

christau commented 5 years ago

Hi and thanks for sharing your work, I wanted to test this, but I always get

[Format partition with ext3] losetup: /os/linux.img: failed to set up loop device: Device or resource busy Makefile:51: recipe for target 'linux.img' failed make[1]: *** [linux.img] Error 1

I ran the following cmd line

sudo make ubuntu

It also failed with the same message when doing

sudo make debian

I'm running on an ubuntu 18.04. Did I make any mistake in calling your script?

Update: I already checked issue #1 and added '--privileged=true' but the error still came up.

christau commented 5 years ago

I guess I found the problem. In the makefile it says --device=/dev/loop0 but the loop0 on my system is already taken by snapd. So I had to change the lines in Makefile and create_image.sh to a free loopback device. Maybe it's more universal to get a free loop device by issuing losetup -f. Just hadn't the time to investigate realization. But if I have, I will post it here. Thanks!

iximiuz commented 5 years ago

I will keep the issue open for a while. Hopefully, I will have some spare time to make the device allocation automatic sooner or later. Thanks for the report.

christau commented 5 years ago

I added the PR #3 with the needed changes. Hopefully you will review and accept. Thank you.