microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.19k stars 806 forks source link

Loopback device partitions missing from /dev/loop* #11170

Open akotulu opened 6 months ago

akotulu commented 6 months ago

Windows Version

Microsoft Windows [Version 10.0.19045.2251]

WSL Version

0.0.0.0

Are you using WSL 1 or WSL 2?

Kernel Version

6.1.21.2-microsoft-standard-WSL2+

Distro Version

debian:12.2-slim

Other Software

Docker Desktop 4.24.2 (124339)

Repro Steps

dd if=/dev/zero bs=1M count=7168 of=./bpi-r2.img loopdev=$(losetup -f) losetup ${loopdev} ./bpi-r2.img parted -s ${loopdev} mklabel msdos parted -s ${loopdev} unit MiB mkpart primary fat32 -- 100MiB 356MiB parted -s ${loopdev} unit MiB mkpart primary ext4 -- 356MiB 7167MiB partprobe ${loopdev} ls ${loopdev}*

Expected Behavior

Two loop devices added to /dev ${loopdev}p1 ${loopdev}p2

Actual Behavior

No partition loop devices are added. unable to open /dev/loop3p1: No such file or directory unable to open /dev/loop3p2: No such file or directory

Diagnostic Logs

No response

OneBlue commented 6 months ago

Thank you @akotulu. Once the loopback disk is mounted, can you share the output of cgdisk /path/to/loop ? I suspect that the partitions are most likely not properly setup

akotulu commented 6 months ago
root@BigRiG /m/a/V/D/B/BPI-R2# losetup -f
/dev/loop3
root@BigRiG /m/a/V/D/B/BPI-R2# losetup /dev/loop3 ../bpi-r2.img
root@BigRiG /m/a/V/D/B/BPI-R2# ls -al /dev/loop*
brw-rw-rw- 1 root root  7,   0 Feb 18 11:40 /dev/loop0
brw-rw-rw- 1 root root  7,   1 Feb 18 11:40 /dev/loop1
brw-rw-rw- 1 root root  7,   2 Feb 18 11:40 /dev/loop2
brw-rw-rw- 1 root root  7,   3 Feb 18 11:40 /dev/loop3
brw-rw-rw- 1 root root  7,   4 Feb 18 11:40 /dev/loop4
brw-rw-rw- 1 root root  7,   5 Feb 18 11:40 /dev/loop5
brw-rw-rw- 1 root root  7,   6 Feb 18 11:40 /dev/loop6
brw-rw-rw- 1 root root  7,   7 Feb 18 11:40 /dev/loop7
crw-rw-rw- 1 root root 10, 237 Feb 18 11:40 /dev/loop-control
root@BigRiG /m/a/V/D/B/BPI-R2# fdisk -l
Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/loop0: 445 MiB, 466614272 bytes, 911356 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop1: 181.9 MiB, 190740480 bytes, 372540 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop2: 723.09 MiB, 758218752 bytes, 1480896 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop3: 768 MiB, 805306368 bytes, 1572864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe78e50d2

Device       Boot  Start     End Sectors  Size Id Type
/dev/loop3p1      204800  729087  524288  256M  c W95 FAT32 (LBA)
/dev/loop3p2      729088 1570815  841728  411M 83 Linux

Disk /dev/sda: 256 GiB, 274877906944 bytes, 536870912 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/sdb: 256 GiB, 274877906944 bytes, 536870912 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/sdc: 256 GiB, 274877906944 bytes, 536870912 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

This image is booting on BPI R2.