qemu-system-x86_64: 设备初始化 ide-cd 失败: 无法获得共享 "write" 锁

qemu-system-x86_64: Initialization of device ide-cd failed: Failed to get shared "write" lock

所以我想在 Qemu 上下载 Ubuntu,我在 cmd 中写了这个命令:

qemu-system-x86_64 -hda ubuntu-20.04.3-desktop-amd64.iso -boot d -cdrom /home/pi/Downloads/ubuntu-20.04.3-desktop-amd64.iso -m 640

但是当我执行它时,终端给我这个错误:

Unable to init server: Could not connect: Connection refused
WARNING: Image format was not specified for 'ubuntu-20.04.3-desktop-amd64.iso' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-x86_64: Initialization of device ide-cd failed: Failed to get shared "write" lock
Is another process using the image [/home/pi/Downloads/ubuntu-20.04.3-desktop-amd64.iso]?

我该怎么办?!

您的命令行尝试将同一个文件 (ubuntu-20.04.3-desktop-amd64.iso) 用作硬盘 ("-hda") 和 crdom ("-光盘”)。 QEMU 抱怨是因为它检查它要写入的文件(对于硬盘)是否也没有被其他东西读取(在这种情况下,与 CDROM 相同的 QEMU 进程)。

“-hda”参数需要是其他内容,例如您创建的空磁盘映像作为新的模拟来宾硬盘。