Failure to mount loop devices
- Linguagem predominante
- Go
- Estrelas
- 30.8k
- Forks
- 613
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
### Description
Given the following `Dockerfile`
```Dockerfile
FROM debian:bookworm-slim
WORKDIR /code/
ENTRYPOINT ["bash"]
```
when running the following script (`run.sh`)
```bash
docker build --quiet --tag 'test_image' .
docker run -it -v "$PWD/:/code" --cap-add SYS_ADMIN --device=/dev/loop0 'test_image' /code/test.sh
```
with `test.sh` containing
```bash
#!/bin/bash
# Create a 10MB image file and initialize an ext4 filesystem on it
dd if=/dev/zero bs=1M count=10 > test.img
mkfs.ext4 -O uninit_bg test.img
# Mount the image file as a loop device, and then mount it at /mnt
LOOP_DEVICE="$(losetup --find --show test.img)"
mount "$LOOP_DEVICE" /mnt
```
I receive an error for the `mount` command saying
```red
mount: /mnt: cannot mount /dev/loop0 read-only.
dmesg(1) may have more information after failed mount system call.
```
So I checked `dmesg` and found these errors:
```log
...
[ 31.517064] loop0: detected capacity change from 0 to 4096
[ 31.519716] operation not supported error, dev loop0, sector 0 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0
[ 31.521012] operation not supported error, dev loop0, sector 0 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0
[ 31.522290] operation not supported error, dev loop0, sector 3968 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
[ 31.523994] operation not supported error, dev loop0, sector 272 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
[ 31.525954] operation not supported error, dev loop0, sector 152 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
[ 31.615215] loop0: detected capacity change from 0 to 4104
[ 31.617421] operation not supported error, dev loop0, sector 0 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0
[ 31.618592] operation not supported error, dev loop0, sector 0 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0
[ 31.619754] operation not supported error, dev loop0, sector 3968 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
[ 31.623177] operation not supported error, dev loop0, sector 272 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
[ 31.624677] operation not supported error, dev loop0, sector 152 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
[ 31.716454] loop0: detected capacity change from 0 to 4096
...
```
It seems there is some issue with mounting loop devices in colima.
The same code works fine when using Docker Desktop.
### Version
colima version 0.7.5
git commit: 1588c066b9ab9dae8205ef265929c7eb43dca473
limactl version 0.23.2
qemu-img version 9.1.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
### Operating System
- [ ] macOS Intel <= 13 (Ventura)
- [ ] macOS Intel >= 14 (Sonoma)
- [ ] Apple Silicon <= 13 (Ventura)
- [X] Apple Silicon >= 14 (Sonoma)
- [ ] Linux
### Output of `colima status`
_No response_
### Reproduction Steps
1. Start colima (`colima start --memory 8`, though the 8GB of RAM are not necessary for this test, just the setup I used)
2. Create the scripts/Dockerfile described above\
3. Run the `run.sh` script
4. Observe the output
5. Enter the colima vm (`colima ssh`)
6. Check `dmesg` (`sudo dmesg`) and look for all messages containing `loop0`
### Expected behaviour
The mount should work fine, as it does on Docker Desktop
### Additional context
_No response_
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.