当我运行可执行脚本“sudo /usr/vm1”时出现以下错误:
cat:/sys/bus/pci/devices//vendor:没有此文件或目录 cat:/sys/bus/pci/devices//device:没有此文件或目录 /usr/vm1:第 12 行:echo:写入错误:参数无效
以下是脚本代码:
#!/bin/bash
configfile=/etc/vfio-pci1.cfg
vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
}
modprobe vfio-pci
cat $configfile | while read line;do
echo $line | grep ^# >/dev/null 2>&1 && continue
vfiobind $line
done
sudo qemu-system-x86_64 -enable-kvm -M q35 -m 4096 -cpu host,kvm=off \
-smp 4,sockets=1,cores=4,threads=1 \
-bios /usr/share/seabios/bios.bin -vga none \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=01:00.1,bus=root.1,addr=00.1 \
-device virtio-scsi-pci,id=scsi \
-device vfio-pci,host=00:1a.0,bus=pcie.0 \
#-usb -usbdevice host:046d:c534 \
-drive file=/home/username/ubuntu1.img,id=disk,format=raw,if=none -device scsi-hd,drive=disk \
-drive file=/home/username/Desktop/ubuntu-14.04.4-desktop-amd64.iso,id=isocd -device scsi-cd,drive=isocd \
-boot menu=on
exit 0
问题可能是什么原因造成的?虚拟机操作系统根本不显示