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

make alpine: Fails with mount: /dev/loop0 is write-protected, mounting read-only #1

Closed Lakshmipathi closed 5 years ago

Lakshmipathi commented 5 years ago

$ make alpine

Fails with message like:


[Format partition with ext3]
mke2fs 1.43.4 (31-Jan-2017)
Discarding device blocks: done                            
Creating filesystem with 261888 4k blocks and 65536 inodes
Filesystem UUID: 603c1544-a156-4188-bcb4-aca0eccf23cb
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

[Copy linux directory structure to partition]
mount: /dev/loop0 is write-protected, mounting read-only
mount: cannot mount /dev/loop0 read-only
Makefile:51: recipe for target 'linux.img' failed
make[1]: *** [linux.img] Error 32
make[1]: Leaving directory '/root/docker-to-linux'
Makefile:38: recipe for target 'alpine.img' failed
make: *** [alpine.img] Error 2

Any thoughts on this?

iximiuz commented 5 years ago

Hi, thanks for the report! What are your host OS and the docker version? In the meantime, you can try to replace --cap-add SYS_ADMIN on this line https://github.com/iximiuz/docker-to-linux/blob/aa9bc0afa51631e92976d48c1262279b13a51f74/Makefile#L55 with --privileged=true and check it out again.

iximiuz commented 5 years ago

Probably similar issue https://stackoverflow.com/a/33096253/1201488. The suggestion is to use --security-opt apparmor:unconfine instead of --privileged=true.

Lakshmipathi commented 5 years ago

Yes, I'm using Debian - let me check SO suggestion and update the results.

Lakshmipathi commented 5 years ago

Your suggestion worked! thanks.