Permission problem with QEMU (Solved)

Moderator: BarryK

Post Reply
Caramel
Posts: 483
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 101 times
Been thanked: 81 times

Permission problem with QEMU (Solved)

Post by Caramel »

(EasyOS 5.6.5)

I don't know anything about virtualization and it is possible that the problem come from qemu and not from Easy.

I wanted to try an QEMU disk image from http://qemu-advent-calendar.org/2023/ and precisely TinyCore Linux behind the day 01 door.

I downloaded the file day01.tar.gz, extracted with XArchive. There are three files in this archive, A text file with a short description. An iso file (TinyCore-current.iso) and a small script run.sh to launch qemu with the iso

The main command executed by the script is

Code: Select all

qemu-system-i386 -drive file=./TinyCore-current.iso,format=raw,if=ide 

(EDIT : similar result with qemu-system-i386 -drive file=TinyCore-current.iso,format=raw,if=ide)

The result is

qemu-system-i386: Could not open './TinyCore-current.iso': Permission denied

It's not a problem of iso not found.

It's not important to me but it's intriguing when there is a "permission denied" with root

Last edited by Caramel on Sun Dec 10, 2023 5:33 pm, edited 1 time in total.
fatdoguser
Posts: 176
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Re: Permission problem with QEMU

Post by fatdoguser »

Try qemu-system-i386 -cdrom TinyCore-current.iso

Caramel
Posts: 483
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 101 times
Been thanked: 81 times

Re: Permission problem with QEMU

Post by Caramel »

fatdoguser wrote: Sun Dec 10, 2023 4:47 pm

Try qemu-system-i386 -cdrom TinyCore-current.iso

Thanks! Qemu starts.

Caramel
Posts: 483
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 101 times
Been thanked: 81 times

First (and probably last) try of qemu

Post by Caramel »

I tested the command of the last post. Very slow and the CPU temperature rose 30 degrees Celsius. So i stopped. It was only a small 23 MB iso file.

fatdoguser
Posts: 176
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Re: Permission problem with QEMU (Solved)

Post by fatdoguser »

Booting iso's even normally is relatively slow. Your test is additionally emulating a CPU etc. If your PC supports kvm - a virtual machine within the kernel, then using that and also setting the cpu to host will help. Also set the number of cores to however many you see when you run htop, perhaps 4

-cpu host \
-enable kvm \
-smp 4 \

More usually you'll boot a iso (CD/DVD image) and use that to install to a hard disk drive, or in the case of qemu a virtual hard disk drive that you create. This document written by Clarity provides useful guidance

https://docs.google.com/document/d/1SaJ ... 1d7k1snnpy

raw files are actually faster than qcow2, but less flexible. I personally prefer raw as they're easier to copy, such as once you've initially installed/setup the virtual hard disk you can make a backup copy of that file via a simple file copy operation.

You tell qemu about the disk using the drive switch
-drive file=....

and you can set the boot to be either from the cd/dvd (iso image) -boot d
or from the drive (once you've installed/setup that up) -boot c

Along with other things such as setting up sound, forwarding tcp ports such as ssh (port 22) so you can ssh into the vm from the host system via ssh port 2222
(ssh -p 2222 localhost, assuming you set up and start sshd within the virtual machine) ...etc. Mine for fatdog (I run a fatdog vm within a fatdog host) looks like the following, and boots/runs very quickly

qemu-system-x86_64 \
-vga std \
-m 4096 \
-cpu host,kvm=off \
-enable-kvm \
-smp 4 \
-k en-gb \
-usbdevice tablet \
-audiodev alsa,id=snd0,out.dev=default \
-machine type=pc,accel=kvm \
-device virtio-net,netdev=mynet0 \
-netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:2222-:22 \
-drive file=fatdog.raw,format=raw,index=0,media=disk \
-boot c

kvm is like having another core, that otherwise just sits their idle if not being used, so worth the effort of learning/persisting/investigating. It's like anything, difficult when new, OK once you're familiar.

I tried that door 1 tinycore myself and it was very slow to download and as you say very slow to boot, not a good example given the purpose is to attract new users to qemu.

fatdoguser
Posts: 176
Joined: Sat Aug 05, 2023 10:54 am
Has thanked: 22 times
Been thanked: 79 times

Re: Permission problem with QEMU (Solved)

Post by fatdoguser »

Your original permissions problem even though running as root I suspect was down to trying to boot a iso (equivalent of a read only CD/DVD) as a read/write hard disk (IDE), so it basically threw out a permissions error (can't write to a read only 'device').

Post Reply

Return to “Containers and VMs”