linuxkit: Metadata panics when trying to read cdrom
Description
Metadata panics and quits when trying to read cloud-config from ISO cdrom with error:
panic: runtime error: index out of range [0] with length 0
Steps to reproduce the issue:
- Run linuxkit as a guest on libvirt qemu.
- Create iso with cloud-config on a host machine:
mkisofs -output <isoDestination> -volid cidata -joliet -rock <userDataFileName> <metaDataFileName> <networkConfigFileName>
- Attach iso as a cdrom
- Run
metadata -v
Describe the results you received:
metadata -v
DEBU[0000] cdrom devices to be checked: [/dev/sr0]
DEBU[0000] block devices found: [/sys/class/block/loop0 /sys/class/block/loop1 /sys/class/block/loop2 /sys/class/block/loop3 /sys/class/block/loop4 /sys/class/block/loop5 /sys/class/block/loop6 /sys/class/block/loop7 /sys/class/block/sr0 /sys/class/block/vda /sys/class/block/vda1]
DEBU[0000] ignoring loop or ram device: loop0
DEBU[0000] ignoring loop or ram device: loop1
DEBU[0000] ignoring loop or ram device: loop2
DEBU[0000] ignoring loop or ram device: loop3
DEBU[0000] ignoring loop or ram device: loop4
DEBU[0000] ignoring loop or ram device: loop5
DEBU[0000] ignoring loop or ram device: loop6
DEBU[0000] ignoring loop or ram device: loop7
DEBU[0000] checking device: /dev/sr0
DEBU[0000] initDisk(): start
DEBU[0000] initDisk(): block device
DEBU[0000] initDisk(): logical block size 2048, physical block size 4096
DEBU[0000] trying fat32
DEBU[0000] fat32 failed: blocksize for FAT32 must be either 512 bytes or 0, not 2048
DEBU[0000] trying iso9660 with physical block size 4096
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/linuxkit/linuxkit/pkg/metadata/vendor/github.com/diskfs/go-diskfs/filesystem/iso9660.parseDirEntry(0xa60458, 0x0, 0x0, 0xc0000d8000, 0x1c000, 0x0, 0x0)
/go/src/github.com/linuxkit/linuxkit/pkg/metadata/vendor/github.com/diskfs/go-diskfs/filesystem/iso9660/directoryentry.go:281 +0x789
github.com/linuxkit/linuxkit/pkg/metadata/vendor/github.com/diskfs/go-diskfs/filesystem/iso9660.Read(0x818500, 0xc00000e048, 0x5c000, 0x0, 0x1000, 0x1, 0x8122e0, 0xc0000450c0)
/go/src/github.com/linuxkit/linuxkit/pkg/metadata/vendor/github.com/diskfs/go-diskfs/filesystem/iso9660/iso9660.go:223 +0x965
github.com/linuxkit/linuxkit/pkg/metadata/vendor/github.com/diskfs/go-diskfs/disk.(*Disk).GetFilesystem(0xc0000765a0, 0x0, 0x0, 0xc0000765a0, 0x0, 0x0)
/go/src/github.com/linuxkit/linuxkit/pkg/metadata/vendor/github.com/diskfs/go-diskfs/disk/disk.go:227 +0x241
main.FindCIs(0xc0000481e0, 0x7a75a4, 0x1f)
/go/src/github.com/linuxkit/linuxkit/pkg/metadata/provider_cdrom.go:85 +0x4a0
main.ListCDROMs(0x750dc0, 0xc00000c2a0, 0x4)
/go/src/github.com/linuxkit/linuxkit/pkg/metadata/provider_cdrom.go:45 +0xf8
main.main()
/go/src/github.com/linuxkit/linuxkit/pkg/metadata/main.go:105 +0x1795
Describe the results you expected:
metadata to be able to read cloud-config from a cdrom
Additional information you deem important (e.g. issue happens only occasionally):
blkid /dev/sr0:
/dev/sr0: BLOCK_SIZE="2048" UUID="2020-10-13-11-17-22-64" LABEL="cidata" TYPE="iso9660"
virsh vol-dumpxml:
<volume type='file'>
<name>name.iso</name>
<key>redacted.iso</key>
<source>
</source>
<capacity unit='bytes'>376832</capacity>
<allocation unit='bytes'>376832</allocation>
<physical unit='bytes'>376832</physical>
<target>
<path>redacted.iso</path>
<format type='iso'/>
<permissions>
<mode>0644</mode>
<owner>1000</owner>
<group>1001</group>
<label>system_u:object_r:virt_content_t:s0</label>
</permissions>
<timestamps>
<atime>1602577058.070323377</atime>
<mtime>1602577043.271064392</mtime>
<ctime>1602577044.112135943</ctime>
</timestamps>
</target>
</volume>
virsh dumpxml domain:
...
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='redacted.iso'/>
<backingStore/>
<target dev='hdd' bus='ide'/>
<readonly/>
<alias name='ide0-1-1'/>
<address type='drive' controller='0' bus='1' target='0' unit='1'/>
</disk>
...
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 4
- Comments: 21 (6 by maintainers)
Commits related to this issue
- remove -rock https://github.com/linuxkit/linuxkit/issues/3562#issuecomment-717224884 — committed to ulm0/terraform-provider-libvirt by ulm0 4 years ago
Any update on this? I also just encountered this, also with k3OS on Proxmox.
I think this needs to land first: https://github.com/linuxkit/linuxkit/pull/3627
did the thing: https://github.com/linuxkit/linuxkit/pull/3618
oh, i encountered this, but didn’t see this issue. it was fixed in go-diskfs in the meantime:
could someone update
go-diskfs
in the metadata workspace so this panic is gone for proxmox hosts?