AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题

问题[qemu](computer)

Martin Hope
Aruna Hewapathirane
Asked: 2023-10-25 07:11:44 +0800 CST

如何将文件从 QEMU FreeDOS C: 驱动器传输到主机?

  • 5

我有一个 Linux Debian 系统。我有运行 FreeDOS 的 QEMU,一切都运行良好。现在需要将数据从 QEMU FreeDOS C 驱动器传输到主机。请问我怎样才能做到这一点?

我可以通过创建 iso 文件从主机获取数据到来宾,如下所示:

mkisofs -o ng.iso /home/aruna/qemu/NG

我可以通过执行以下操作来阅读它:

qemu-system-x86_64 -m 2048 -enable-kvm -hda c.hd -cdrom ng.iso -boot d

怎样才能从另一条路回去呢?我的 QEMU/FreeDOS C: 驱动器中有一个文件,我想将其传输到主机。请问有解决办法吗?

qemu
  • 1 个回答
  • 37 Views
Martin Hope
fireshadow52
Asked: 2023-07-11 03:25:01 +0800 CST

使用 QEMU 套接字功能的正确方法是什么?

  • 6

我似乎在任何地方都找不到太多关于使用-serial unix:/path/to/some/file参数 to 的文档qemu-system-XXXX,所以我希望这里有人能对此有所启发。具体来说,我想知道将数据发送到主机上的此套接字并在 QEMU 来宾端接收数据的正确方法是什么。

更新: 作为测试,我使用 RHEL 8 主机和 Solaris 8 来宾。正如 LawrenceC 所建议的,我添加了这个-serial udp::xxxx论点。我还编写了一个 C 程序来连接到 UDP 端口 XXXX 并向其写入一些内容。但是,我没有看到 RHEL 8 端通过nc -u -l -p xxx. 我可能会缺少什么?

看来我对这种方法有一个根本性的误解,认为端口会在 QEMU 来宾上打开,但这只是将串行端口数据从来宾转换为主机上的本地 UDP 端口。

qemu
  • 2 个回答
  • 124 Views
Martin Hope
nadermx
Asked: 2023-05-30 05:08:03 +0800 CST

尝试编写脚本在 cloud-int VM 上安装 qemue 代理

  • 5

我目前正在使用 Proxmox 来部署一些 VMS。我正在使用此处提供的脚本。

我当前的脚本是这样的

#!/bin/bash

#Create template
#args:
# vm_id
# vm_name
# file name in the current directory
function create_template() {
    #Print all of the configuration
    echo "Creating template $2 ($1)"

    #Create new VM 
    #Feel free to change any of these to your liking
    qm create $1 --name $2 --ostype l26 
    #Set networking to default bridge
    qm set $1 --net0 virtio,bridge=vmbr0
    #Set display to serial
    qm set $1 --serial0 socket --vga serial0
    #Set memory, cpu, type defaults
    #If you are in a cluster, you might need to change cpu type
    qm set $1 --memory 1024 --cores 4 --cpu host
    #Set boot device to new file
    qm set $1 --scsi0 ${storage}:0,import-from="$(pwd)/$3",discard=on
    #Set scsi hardware as default boot disk using virtio scsi single
    qm set $1 --boot order=scsi0 --scsihw virtio-scsi-single
    #Enable Qemu guest agent in case the guest has it available
    qm set $1 --agent enabled=1,fstrim_cloned_disks=1
    #Add cloud-init device
    qm set $1 --ide2 ${storage}:cloudinit
    #Set CI ip config
    #IP6 = auto means SLAAC (a reliable default with no bad effects on non-IPv6 networks)
    #IP = DHCP means what it says, so leave that out entirely on non-IPv4 networks to avoid DHCP delays
    qm set $1 --ipconfig0 "ip6=auto,ip=dhcp"
    #Import the ssh keyfile
    # qm set $1 --sshkeys ${ssh_keyfile}
    #If you want to do password-based auth instaed
    #Then use this option and comment out the line above
    qm set $1 --cipassword password
    #Add the user
    qm set $1 --ciuser ${username}
    #Resize the disk to 8G, a reasonable minimum. You can expand it more later.
    #If the disk is already bigger than 8G, this will fail, and that is okay.
    qm disk resize $1 scsi0 8G

    #Make it a template
    qm template $1

    #Remove file when done
    rm $3
}


#Path to your ssh authorized_keys file
#Alternatively, use /etc/pve/priv/authorized_keys if you are already authorized
#on the Proxmox system
export ssh_keyfile=/root/id_rsa.pub
#Username to create on VM template
export username=root

#Name of your storage
export storage=main

#The images that I've found premade
#Feel free to add your own

## Debian
#Buster (10)
wget "https://cloud.debian.org/images/cloud/buster/latest/debian-10-genericcloud-amd64.qcow2"
create_template 900 "temp-debian-10" "debian-10-genericcloud-amd64.qcow2"
#Bullseye (11)
wget "https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.qcow2"
create_template 901 "temp-debian-11" "debian-11-genericcloud-amd64.qcow2" 
#Bookworm (12 dailies - not yet released)
wget "https://cloud.debian.org/images/cloud/bookworm/daily/latest/debian-12-genericcloud-amd64-daily.qcow2"
create_template 902 "temp-debian-12-daily" "debian-12-genericcloud-amd64-daily.qcow2" 

## Ubuntu
#20.04 (Focal Fossa)
wget "https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img"
create_template 910 "temp-ubuntu-20-04" "ubuntu-20.04-server-cloudimg-amd64.img" 
#22.04 (Jammy Jellyfish)
wget "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
create_template 911 "temp-ubuntu-22-04" "ubuntu-22.04-server-cloudimg-amd64.img" 
#23.04 (Lunar Lobster) - daily builds
wget "https://cloud-images.ubuntu.com/lunar/current/lunar-server-cloudimg-amd64.img"
create_template 912 "temp-ubuntu-23-04-daily" "lunar-server-cloudimg-amd64.img"

## Fedora 37
#Image is compressed, so need to uncompress first
wget https://download.fedoraproject.org/pub/fedora/linux/releases/37/Cloud/x86_64/images/Fedora-Cloud-Base-37-1.7.x86_64.raw.xz
xz -d -v Fedora-Cloud-Base-37-1.7.x86_64.raw.xz
create_template 920 "temp-fedora-37" "Fedora-Cloud-Base-37-1.7.x86_64.raw"

## CentOS Stream
#Stream 8
wget https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20220913.0.x86_64.qcow2
create_template 930 "temp-centos-8-stream" "CentOS-Stream-GenericCloud-8-20220913.0.x86_64.qcow2"
#Stream 9 (daily) - they don't have a 'latest' link?
wget https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20230123.0.x86_64.qcow2
create_template 931 "temp-centos-9-stream-daily" "CentOS-Stream-GenericCloud-9-20230123.0.x86_64.qcow2"

现在,为了尝试在每台设备上安装 qemu,我在创建模板之前尝试了类似的操作,但它失败了。所以我不确定是否有更好的方法在 VM 上安装并启用 qemu-agent?

    # Install and enable qemu-guest-agent based on the distribution
    case $2 in
        temp-debian-10 | temp-debian-11 | temp-debian-12-daily)
            qm set $1 --exec "apt update && apt install -y qemu-guest-agent"
            ;;
        temp-ubuntu-20-04 | temp-ubuntu-22-04 | temp-ubuntu-23-04-daily)
            qm set $1 --exec "apt update && apt install -y qemu-guest-agent"
            ;;
        temp-fedora-37)
            qm set $1 --exec "dnf install -y qemu-guest-agent && systemctl enable --now qemu-guest-agent"
            ;;
        temp-centos-8-stream | temp-centos-9-stream-daily)
            qm set $1 --exec "dnf install -y qemu-guest-agent && systemctl enable --now qemu-guest-agent"
            ;;
        *)
            echo "Unsupported distribution: $2"
            ;;
    esac
qemu
  • 1 个回答
  • 13 Views
Martin Hope
exebook
Asked: 2023-02-23 03:57:10 +0800 CST

QEMU 启动缩放自动化

  • 5

每次我启动 QEMU 时,我都会进行相同的一系列点击:View->Zoom to fit,然后抓住 QEMU 窗口的一角并拖动以缩放大约 2.5 倍。这可以自动化,所以 qemu 刚开始放大 2-3 倍吗?或者至少在缩放以适应模式。

qemu
  • 1 个回答
  • 8 Views
Martin Hope
aszswaz
Asked: 2023-01-10 22:46:07 +0800 CST

如何让qemu动态获取内存?

  • 5

我启动 qemu 的命令如下所示:

$ qemu-system-x86_64 \
    -name guest=win10 \
    -m 4830196K \
    -enable-kvm \
    -drive file=win10.img,format=raw,index=0,media=disk,if=virtio \
    ......

qemu按照我给的参数占用了4G内存,但是guest机器使用的内存大小可能只有2G。

我想指定访客可用的最大内存、访客使用多少内存以及 qemu 占用多少内存。

我应该怎么办?

qemu
  • 1 个回答
  • 16 Views
Martin Hope
Eliazz
Asked: 2022-04-26 10:29:27 +0800 CST

Libvirt conf - cdrom 启动问题

  • 5

使用 libvirtd 时,我在启动 debian 或 ubuntu 网络安装映像时遇到问题,我得到了菜单,但在选择安装菜单选项时只需得到这个:

加载 /install.amd/vmlinuz 失败:没有这样的文件或目录

我已经安装了 iso 并验证了 debian netinstall iso 在 install.amd 目录中有 vmlinuz 文件等。

这是我在失败时使用的域的 libvirtd xml:


<domain type='kvm'>
  <name>myserver</name>
  <uuid>d85a11d4-78d8-2425-527b-2adef6c952a9</uuid>
  <memory unit='KiB'>18192</memory>
  <currentMemory unit='KiB'>18192</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-5.2'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='custom' match='exact' check='none'>
    <model fallback='forbid'>qemu64</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
  <emulator>/usr/bin/qemu-system-x86_64</emulator>
  <disk type='file' device='cdrom'>
    <driver name='qemu' type='raw'/>
    <source file="/var/lib/libvirt/boot/debian-11.3.0-amd64-netinst.iso"/>
     <target dev='hda' bus='ide'/>
     <readonly/>
    <boot order='2'/>
  </disk>

  <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/opt/storage/VMs/myserver.qcow2'/>
      <target dev='vdb' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='piix3-uhci'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='scsi' index='0' model='lsilogic'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:4c:d1:73'/>
      <source network='net-simplebridge'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='keyboard' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='vga' vram='8192' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
    <rng model='virtio'>
      <backend model='random'>/dev/random</backend>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </rng>
  </devices>
</domain>

上面的 xml 将在此结束:

/usr/bin/qemu-system-x86_64 -name guest=myserver,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1- myserver/master-key.aes -machine pc-i440fx-5.2,accel=kvm,usb=off,dump-guest-core=off,memory-backend=pc.ram -cpu qemu64 -m 18 -object memory-backend- ram,id=pc.ram,size=18874368 -overcommit mem-lock=off -smp 1,sockets=1,cores=1,threads=1 -uuid d85a11d4-78d8-2425-527b-2adef6c952a9 -no-user-config -nodefaults -chardev socket,id=charmonitor,fd=34,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb- uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device lsi,id=scsi0,bus=pci.0,addr=0x4 -blockdev {"driver":"file","filename":" /var/lib/libvirt/boot/debian-11.3.0-amd64-netinst.iso","节点名":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-2-format","re​​ad-only":true, "驱动程序":"raw","文件":"libvirt-2-storage"} -device ide-cd,bus=ide.0,unit=0,drive=libvirt-2-format,id=ide0-0- 0,bootindex=2 -blockdev {"driver":"file","filename":"/opt/storage/VMs/myserver.qcow2","node-name":"libvirt-1-storage","cache" :{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-1-format ","re​​ad-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage","backing":null} -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=libvirt-1-format,id=virtio-disk1,bootindex =1,write-cache=on -netdev tap,fd=36,id=hostnet0,vhost=on,vhostfd=37 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00 :4c:d1:73,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-kbd,id=input0,bus=usb。 0,port=1 -vnc 127.0.0.1:0 -device VGA,id=video0,vgamem_mb=8,bus=pci.0,addr=0x2 -device virtio-baid=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-kbd,id=input0,bus=usb.0,port=1 -vnc 127.0.0.1:0 -device VGA,id=video0, vgamem_mb=8,bus=pci.0,addr=0x2 -device virtio-baid=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-kbd,id=input0,bus=usb.0,port=1 -vnc 127.0.0.1:0 -device VGA,id=video0, vgamem_mb=8,bus=pci.0,addr=0x2 -device virtio-ba

手动执行此操作时,它可以在同一台机器上正常工作,并且可以让我进入安装过程:

qemu-system-x86_64 -vnc :0 -enable-kvm -serial stdio -curses -hda /opt/storage/VMs/myserver.qcow2 -m 2G -boot d -cdrom /var/lib/libvirt/boot/debian-11.3 .0-amd64-netinst.iso

是否可以使用 libvirtd xml 配置获取“-cdrom”标志?或任何其他建议?

qemu libvirt
  • 1 个回答
  • 65 Views
Martin Hope
akashavkin
Asked: 2022-04-11 07:03:40 +0800 CST

为什么我似乎无法从 macOS 的命令行通过 virt-install 运行 VM?

  • 6

我尝试在 macOS Monterey (12.3.1) 上的 MacBook 14 M1 Pro 上运行带有仿真的 VM。我通过 brew 安装了 libvirt 8.2.0 和 virt-manager 4.0.0。

我将这个公式用于 virt-manager:

class VirtManager < Formula
  include Language::Python::Virtualenv

  desc "Desktop tool for managing virtual machines via libvirt"
  homepage "https://virt-manager.org/"
  url "https://releases.pagure.org/virt-manager/virt-manager-4.0.0.tar.gz"
  sha256 "515aaa2021a4bf352b0573098fe6958319b1ba8ec508ea37e064803f97f17086"
  license "GPL-2.0-or-later"
  head "https://github.com/virt-manager/virt-manager.git"

  depends_on "docutils" => :build
  depends_on "gettext" => :build
  depends_on "adwaita-icon-theme"
  depends_on "cdrtools"
  depends_on "glib"
  depends_on "gtk+3"
  depends_on "gtk-vnc"
  depends_on "gtksourceview4"
  depends_on "libosinfo"
  depends_on "libvirt"
  depends_on "libvirt-glib"
  depends_on "libxml2"
  depends_on "pygobject3"
  depends_on "python"
  depends_on "spice-gtk"
  depends_on "vte3"

  # To update:
  #
  #     cd "$(mktemp -d)" &&
  #         python3 -m venv venv &&
  #         . venv/bin/activate &&
  #         pip install libvirt-python argcomplete requests homebrew-pypi-poet &&
  #         poet libvirt-python -a argcomplete -a requests &&
  #         deactivate &&
  #         rm -Rf venv
  resource "argcomplete" do
    url "https://files.pythonhosted.org/packages/05/f8/67851ae4fe5396ba6868c5d84219b81ea6a5d53991a6853616095c30adc0/argcomplete-2.0.0.tar.gz"
    sha256 "6372ad78c89d662035101418ae253668445b391755cfe94ea52f1b9d22425b20"
  end

    resource "certifi" do
    url "https://files.pythonhosted.org/packages/6c/ae/d26450834f0acc9e3d1f74508da6df1551ceab6c2ce0766a593362d6d57f/certifi-2021.10.8.tar.gz"
    sha256 "78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"
  end

  resource "charset-normalizer" do
    url "https://files.pythonhosted.org/packages/56/31/7bcaf657fafb3c6db8c787a865434290b726653c912085fbd371e9b92e1c/charset-normalizer-2.0.12.tar.gz"
    sha256 "2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"
  end

  resource "idna" do
    url "https://files.pythonhosted.org/packages/62/08/e3fc7c8161090f742f504f40b1bccbfc544d4a4e09eb774bf40aafce5436/idna-3.3.tar.gz"
    sha256 "9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
  end

  resource "libvirt-python" do
    url "https://files.pythonhosted.org/packages/50/cf/3703fc97df6292c9c0ac8b828a85ca11f492f7bffd190f191ea7484024ed/libvirt-python-8.2.0.tar.gz"
    sha256 "f8b8cea67ff0d64d63029cc3410a4656e04ee9f26837a856bc0c287da55d053a"
  end

  resource "pycairo" do
    url "https://files.pythonhosted.org/packages/92/a4/506564f574fa74c90b98690e8ecc8dbae1629f31fcfe0be69de45d9e1605/pycairo-1.21.0.tar.gz"
    sha256 "251907f18a552df938aa3386657ff4b5a4937dde70e11aa042bc297957f4b74b"
  end

  resource "requests" do
    url "https://files.pythonhosted.org/packages/60/f3/26ff3767f099b73e0efa138a9998da67890793bfa475d8278f84a30fec77/requests-2.27.1.tar.gz"
    sha256 "68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"
  end

  resource "urllib3" do
    url "https://files.pythonhosted.org/packages/1b/a5/4eab74853625505725cefdf168f48661b2cd04e7843ab836f3f63abf81da/urllib3-1.26.9.tar.gz"
    sha256 "aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"
  end

  def install
    venv = virtualenv_create(libexec, "python3")
    venv.pip_install resources

    # virt-manager uses distutils, so we can't use Homebrew's helper methods
    args = %w[
      --no-user-cfg
      --no-update-icon-cache
      --no-compile-schemas
    ]
    # virt-manager requires --prefix to match between `configure` and `install`
    system "#{libexec}/bin/python3", "setup.py", *args,
      "configure", "--prefix=#{libexec}", "--default-hvs", "qemu,lxc"
    system "#{libexec}/bin/python3", "setup.py", *args,
      "install", "--prefix=#{libexec}"
    bin.install_symlink Dir["#{libexec}/bin/virt-*"]
    share.install Dir["#{libexec}/share/{bash-completion,glib-2.0,icons,locale,man}"]
  end

  def post_install
    system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas"
    system "#{Formula["gtk+3"].opt_bin}/gtk3-update-icon-cache", "-f", "-t", "#{HOMEBREW_PREFIX}/share/icons/hicolor"
  end

  test do
    system "#{bin}/virt-manager", "--version"
  end
end

启动 VM 的参数:

virt-install --name guest1-rocky8_5 --memory 4096 --vcpus 4 --disk work_space/packer/rocky8_5.qcow2 --qemu-commandline='-netdev user,id=net0,hostfwd=tcp::5555-:22 -device e1000e,netdev=net0 -accel tcg' --import --virt-type qemu --arch x86_64 --os-variant rhel8.0 -d

我得到以下输出:

[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (cli:204) Launched with command line: /opt/homebrew/bin/virt-install --name guest1-rocky8_5 --memory 4096 --vcpus 4 --disk workspace/packer/rocky8_5.qcow2 --qemu-commandline=-netdev user,id=net0,hostfwd=tcp::5555-:22 -device e1000e,netdev=net0 -accel tcg --import --virt-type qemu --arch x86_64 --os-variant rhel8.0 -d
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (virtinstall:212) Distilled --network options: ['default']
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (virtinstall:142) Distilled --disk options: ['workspace/packer/rocky8_5.qcow2']
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (cli:216) Requesting libvirt URI default
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (cli:219) Received libvirt URI qemu:///session
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (guest:330) Setting Guest osinfo name <_OsVariant name=generic>
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (guest:330) Setting Guest osinfo name <_OsVariant name=rhel8.0>
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (installer:542) No media for distro detection.
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (installer:544) installer.detect_distro returned=None
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (osdict:216) No recommended value found for key='n-cpus', using minimum=1 * 2
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (guest:535) Prefer EFI => False
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (graphics:157) App is configured with default_graphics=spice
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (graphics:167) spice requested but HV doesn't support it. Using vnc.
[Sun, 10 Apr 2022 01:52:05 virt-install 58583] DEBUG (guest:1094) Using num_pcie_root_ports=14
[Sun, 10 Apr 2022 01:52:06 virt-install 58583] DEBUG (disk:236) DeviceDisk.check_path_search path=/Users/alexey/workspace/packer/rocky8_5.qcow2
[Sun, 10 Apr 2022 01:52:06 virt-install 58583] DEBUG (cli:265)
Starting install...
[Sun, 10 Apr 2022 01:52:06 virt-install 58583] DEBUG (installer:587) Generated initial_xml: None required
[Sun, 10 Apr 2022 01:52:06 virt-install 58583] DEBUG (installer:589) Generated final_xml:
<domain type="qemu">
  <name>guest1-rocky8_5</name>
  <uuid>c9af9024-c29b-411c-b36c-ff9e9073f95a</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://redhat.com/rhel/8.0"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory>4194304</memory>
  <currentMemory>4194304</currentMemory>
  <vcpu>4</vcpu>
  <os>
    <type arch="x86_64" machine="q35">hvm</type>
    <boot dev="hd"/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
  </clock>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/opt/homebrew/bin/qemu-system-x86_64</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/Users/alexey/workspace/packer/rocky8_5.qcow2"/>
      <target dev="vda" bus="virtio"/>
    </disk>
    <controller type="usb" model="qemu-xhci" ports="15"/>
    <controller type="pci" model="pcie-root"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <controller type="pci" model="pcie-root-port"/>
    <interface type="user">
      <mac address="52:54:00:d8:a2:6d"/>
      <model type="virtio"/>
    </interface>
    <console type="pty"/>
    <channel type="unix">
      <source mode="bind"/>
      <target type="virtio" name="org.qemu.guest_agent.0"/>
    </channel>
    <input type="tablet" bus="usb"/>
    <graphics type="vnc" port="-1"/>
    <video>
      <model type="virtio"/>
    </video>
    <memballoon model="virtio"/>
    <rng model="virtio">
      <backend model="random">/dev/urandom</backend>
    </rng>
  </devices>
  <qemu:commandline xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
    <qemu:arg value="-netdev"/>
    <qemu:arg value="user,id=net0,hostfwd=tcp::5555-:22"/>
    <qemu:arg value="-device"/>
    <qemu:arg value="e1000e,netdev=net0"/>
    <qemu:arg value="-accel"/>
    <qemu:arg value="tcg"/>
  </qemu:commandline>
</domain>

[Sun, 10 Apr 2022 01:52:06 virt-install 58583] DEBUG (installer:642) XML fetched from libvirt object:
<domain type='qemu' id='25' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>guest1-rocky8_5</name>
  <uuid>c9af9024-c29b-411c-b36c-ff9e9073f95a</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://redhat.com/rhel/8.0"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-q35-6.2'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>qemu64</model>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='lahf_lm'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/opt/homebrew/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/Users/alexey/workspace/packer/rocky8_5.qcow2' index='1'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0x15'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x5'/>
    </controller>
    <controller type='pci' index='7' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='7' port='0x16'/>
      <alias name='pci.7'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x6'/>
    </controller>
    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0x17'/>
      <alias name='pci.8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x7'/>
    </controller>
    <controller type='pci' index='9' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='9' port='0x18'/>
      <alias name='pci.9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='10' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='10' port='0x19'/>
      <alias name='pci.10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/>
    </controller>
    <controller type='pci' index='11' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='11' port='0x1a'/>
      <alias name='pci.11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x2'/>
    </controller>
    <controller type='pci' index='12' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='12' port='0x1b'/>
      <alias name='pci.12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x3'/>
    </controller>
    <controller type='pci' index='13' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='13' port='0x1c'/>
      <alias name='pci.13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x4'/>
    </controller>
    <controller type='pci' index='14' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='14' port='0x1d'/>
      <alias name='pci.14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x5'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </controller>
    <interface type='user'>
      <mac address='52:54:00:d8:a2:6d'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/ttys004'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/ttys004'>
      <source path='/dev/ttys004'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/Users/alexey/.config/libvirt/qemu/channel/target/domain-25-guest1-rocky8_5/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='virtio' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
    <rng model='virtio'>
      <backend model='random'>/dev/urandom</backend>
      <alias name='rng0'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </rng>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-netdev'/>
    <qemu:arg value='user,id=net0,hostfwd=tcp::5555-:22'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='e1000e,netdev=net0'/>
    <qemu:arg value='-accel'/>
    <qemu:arg value='tcg'/>
  </qemu:commandline>
</domain>

[Sun, 10 Apr 2022 01:52:06 virt-install 58583] DEBUG (cli:383) Running: virt-viewer --connect qemu:///session --wait guest1-rocky8_5
[Sun, 10 Apr 2022 01:52:06 virt-install 58583] DEBUG (cli:265) Running graphical console command: virt-viewer --connect qemu:///session --wait guest1-rocky8_5

(virt-viewer:58588): virt-viewer-WARNING **: 01:52:06.563: (../src/virt-viewer-window.c:831):accel_key_to_keys: runtime check failed: ((accel_mods & ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0)

(virt-viewer:58588): virt-viewer-WARNING **: 01:52:06.563: (../src/virt-viewer-window.c:831):accel_key_to_keys: runtime check failed: ((accel_mods & ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0)

(virt-viewer:58588): virt-viewer-WARNING **: 01:52:06.563: (../src/virt-viewer-window.c:831):accel_key_to_keys: runtime check failed: ((accel_mods & ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0)

(virt-viewer:58588): virt-viewer-WARNING **: 01:52:06.563: (../src/virt-viewer-window.c:831):accel_key_to_keys: runtime check failed: ((accel_mods & ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0)

(virt-viewer:58588): virt-viewer-WARNING **: 01:52:06.563: (../src/virt-viewer-window.c:831):accel_key_to_keys: runtime check failed: ((accel_mods & ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0)

(virt-viewer:58588): virt-viewer-WARNING **: 01:52:06.563: (../src/virt-viewer-window.c:831):accel_key_to_keys: runtime check failed: ((accel_mods & ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == 0)
[Sun, 10 Apr 2022 01:52:10 virt-install 58583] DEBUG (cli:255)   File "/opt/homebrew/bin/virt-install", line 8, in <module>
    virtinstall.runcli()
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 1220, in runcli
    sys.exit(main())
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 1213, in main
    start_install(guest, installer, options)
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 961, in start_install
    fail(e, do_exit=False)
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/cli.py", line 255, in fail
    log.debug("".join(traceback.format_stack()))

[Sun, 10 Apr 2022 01:52:10 virt-install 58583] ERROR (cli:256) operation failed: cannot read cputime for domain
[Sun, 10 Apr 2022 01:52:10 virt-install 58583] DEBUG (cli:258)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 949, in start_install
    _process_domain(domain, guest, installer,
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 900, in _process_domain
    _wait_for_domain(installer, instdomain, autoconsole, waithandler)
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 837, in _wait_for_domain
    if instdomain.check_inactive():
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 817, in check_inactive
    dominfo = self._domain.info()
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/lib/python3.9/site-packages/libvirt.py", line 1659, in info
    raise libvirtError('virDomainGetInfo() failed')
libvirt.libvirtError: operation failed: cannot read cputime for domain 
[Sun, 10 Apr 2022 01:52:10 virt-install 58583] DEBUG (cli:271) Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start guest1-rocky8_5
otherwise, please restart your installation.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start guest1-rocky8_5
otherwise, please restart your installation.

如果我添加--autoconsole text,我可以在输出中看到:

Creating domain...                                                                                                                                                                             |    0 B  00:00:00
[Sun, 10 Apr 2022 02:08:07 virt-install 59096] DEBUG (cli:383) Running: virsh --connect qemu:///session console guest1-rocky8_5
[Sun, 10 Apr 2022 02:08:07 virt-install 59096] DEBUG (cli:265) Running text console command: virsh --connect qemu:///session console guest1-rocky8_5
Running text console command: virsh --connect qemu:///session console guest1-rocky8_5
Connected to domain 'guest1-rocky8_5'
Escape character is ^] (Ctrl + ])

什么都没有出来。

如果我尝试在端口 5555 上进行 SSH,我会得到:

ssh localhost -p 5555
kex_exchange_identification: read: Connection reset by peer
Connection reset by 127.0.0.1 port 5555

如果取消运行:

Running text console command: virsh --connect qemu:///session console guest1-rocky8_5
Connected to domain 'guest1-rocky8_5'
Escape character is ^] (Ctrl + ])
^]
[Sun, 10 Apr 2022 02:24:38 virt-install 59378] DEBUG (cli:255)   File "/opt/homebrew/bin/virt-install", line 8, in <module>
    virtinstall.runcli()
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 1220, in runcli
    sys.exit(main())
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 1213, in main
    start_install(guest, installer, options)
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 961, in start_install
    fail(e, do_exit=False)
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/cli.py", line 255, in fail
    log.debug("".join(traceback.format_stack()))

[Sun, 10 Apr 2022 02:24:38 virt-install 59378] ERROR (cli:256) operation failed: cannot read cputime for domain
[Sun, 10 Apr 2022 02:24:38 virt-install 59378] DEBUG (cli:258)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 949, in start_install
    _process_domain(domain, guest, installer,
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 900, in _process_domain
    _wait_for_domain(installer, instdomain, autoconsole, waithandler)
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 837, in _wait_for_domain
    if instdomain.check_inactive():
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/share/virt-manager/virtinst/virtinstall.py", line 817, in check_inactive
    dominfo = self._domain.info()
  File "/opt/homebrew/Cellar/virt-manager/4.0.0/libexec/lib/python3.9/site-packages/libvirt.py", line 1659, in info
    raise libvirtError('virDomainGetInfo() failed')
libvirt.libvirtError: operation failed: cannot read cputime for domain
[Sun, 10 Apr 2022 02:24:38 virt-install 59378] DEBUG (cli:271) Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start guest1-rocky8_5
otherwise, please restart your installation.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start guest1-rocky8_5
otherwise, please restart your installation.

但是,如果我尝试仅使用 qemu-system-x86_64 效果很好:

qemu-system-x86_64 -m 4G -machine type=q35,accel=tcg -smp 2 -netdev user,id=net0,hostfwd=tcp::5555-:22 -device e1000e,netdev=net0 -drive file=workspace/packer/rocky8_5.qcow2,if=ide

ssh localhost -p 5555 cat /etc/redhat-release
root@localhost's password:
Rocky Linux release 8.5 (Green Obsidian)

我认为当我在 virt-install 中运行 VM 时,默认情况下会添加一些参数,这会阻止 VM 正常启动。也许我需要更改一些参数或通过 virt-install 添加新参数以使 VM 正常运行?

如果我在 virt-manager 中使用默认参数运行 VM,我也会遇到同样的问题。

Despite running errors via virt-install or virt-manager, I can see this VM in libvirt:

virsh list
 Id   Name              State
---------------------------------
 1    guest1-rocky8_5   running

I can connect to this VM via VNC, but ssh on port 5555 not forwarding, as I wrote above.

macos qemu
  • 1 个回答
  • 943 Views
Martin Hope
Darb Elhawa
Asked: 2022-02-21 17:47:44 +0800 CST

如何从全屏 Virt Manager 中“alt-tab”?

  • 6

我想从 qemu/kvm Virt Manager 中的全屏切换回主主机操作系统上最近使用的窗口(就像alt-一样tab),但我还没有找到可行的解决方案。ctrl++不起作用(它只是在虚拟机中启动一个应用程序)alt。f

我不想退出全屏模式,而是想alt-tab回到主机并可以选择alt-tab回到全屏虚拟机。

virtual-machine qemu
  • 1 个回答
  • 2312 Views
Martin Hope
mashuptwice
Asked: 2022-02-13 15:20:22 +0800 CST

在脚本中使用 qm (qemu) 输出

  • 5

我正在尝试确定 QEMU VM 是否已使用 QEMU 代理从脚本内部完成引导。

问题是我无法将输出分配给变量,甚至无法将其通过管道传输到文件:

[root@node1 dir]# isrunning=$(qm agent 1234 ping)
VM 1234 is not running
[root@node1 dir]# echo $isrunning

[root@node1 dir]# isrunning=`qm agent 1234 ping`
VM 1234 is not running
[root@node1 dir]# echo $isrunning

[root@node1 dir]# qm agent 1234 ping > /tmp/qmclonevm
VM 1234 is not running
[root@node1 dir]# echo /tmp/qmclonevm 
/tmp/qmclonevm
[root@node1 dir]# qm agent 1234 ping | tee /tmp/qmclonevm
VM 1234 is not running
[root@node1 dir]# cat /tmp/qmclonevm 
[root@node1 dir]# 

我假设 qm 会像往常一样简单地打印到标准输出,似乎情况并非如此。

有谁知道这里发生了什么以及如何解决该问题,或者任何人都可以提供不同的解决方案来检查 VM 是否已完全启动?

bash qemu
  • 1 个回答
  • 69 Views
Martin Hope
membrillo
Asked: 2022-02-06 10:28:29 +0800 CST

QEMU-KVM UEFI 安全启动不起作用

  • 5

我尝试在 QEMU-KVM 中对此进行测试:

https://www.knopper.net/knoppix/knoppix-uefi-en.html

我的主机操作系统是 Debian 11 AMD64。我已经成功安装了ovmf .deb 包。我像这样将 OVMF 添加到我的虚拟机中,但安全启动不起作用,只有 UEFI:

kvm \
   -bios /usr/share/qemu/OVMF.fd \
   -monitor stdio \
   -cpu host \
   -smp cores=4,threads=2 \
   -k en \
   -machine accel=kvm \
   -m 4096 \
   -hda Knoppix.9.2.qcow2 \
   -net nic -net user \
   -usb -device usb-tablet \
   -rtc base=localtime \
   -name "Knoppix 9.2"

在物理 UEFI 中,Knoppix 9.2 的安全启动工作正常。

提前致谢。

debian qemu
  • 1 个回答
  • 881 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve