linsk icon indicating copy to clipboard operation
linsk copied to clipboard

Permission Denied when attempting to read /dev/disk5, which is a disk image

Open GuillaumeDIDIER opened this issue 1 year ago • 4 comments

Link 0.2.2 arm64 binary release for Darwin.

/dev/disk5 is a read-only image, attached through hdiutils.

/dev/disk5 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        +42.9 GB    disk5
   1:                      Linux                         1.1 GB     disk5s1
   2:                  Linux_LVM                         41.9 GB    disk5s2
$ sudo linsk ls dev:/dev/disk5  
time=2024-10-12T11:15:35.563+02:00 level=WARN msg="Using raw block device passthrough. Please note that it's YOUR responsibility to ensure that no device is mounted in your OS and the VM at the same time. Otherwise, you run serious risks. No further warnings will be issued." caller=vm
time=2024-10-12T11:15:35.570+02:00 level=INFO msg="Booting the VM" caller=vm
time=2024-10-12T11:15:35.620+02:00 level=WARN msg="Canceling the VM context" caller=vm
time=2024-10-12T11:15:35.620+02:00 level=ERROR msg="Failed to start the VM" error="cancel on exit: interrupt cmd: no such process (qemu stderr log: 'qemu-system-aarch64: -device driver=virtio-blk-pci,drive=drive1728724535569297000,logical_block_size=512,physical_block_size=512: Could not open '/dev/disk5': Permission denied')"

Is there any way to debug this ?

Bonus, would there be a way to just use a file from the file system instead of a device (pretty sure qemu would be quite capable of digesting all sorts of disk images)

GuillaumeDIDIER avatar Oct 12 '24 09:10 GuillaumeDIDIER

In other news, it worked great to read my Asahi Linux disk, sudo linsk run dev:/dev/disk0sX vdb

Do you want me to make a PR to hint that you can pass a partition instead of a full disk (because disk0 has some partitions mounted on my host obviously) ?

GuillaumeDIDIER avatar Oct 12 '24 09:10 GuillaumeDIDIER

Hi @GuillaumeDIDIER. Glad you were able to sort that out, and apologies for my delayed response. PRs are always welcome.

AlexSSD7 avatar Oct 22 '24 17:10 AlexSSD7

I haven’t sorted out my original issue (wanted to mount the disks of some old virtual machines).

I’ll make a PR with the other thing I found though !

GuillaumeDIDIER avatar Oct 22 '24 18:10 GuillaumeDIDIER

I don't think this is an issue As far as i know if you want to pass the entire disk and have sip enable you need to use /dev/rdisk# (some part of macos takes exclusive control over all the /dev/disk# devices) I assume this is done to prevent writing to parts of the drive that make up the system volume while the system is running.

ty802 avatar Nov 07 '24 19:11 ty802