0

I am having the following error when I run the executable script "sudo /usr/vm1" :

cat: /sys/bus/pci/devices//vendor: No such file or directory cat: /sys/bus/pci/devices//device: No such file or directory /usr/vm1: line 12: echo: write error: Invalid argument

Below is the script code :

#!/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

What could be the cause of the problem ? The VM OS is not displayed at all

0 Answers0