默认情况下,直接在TrueNAS SCALE里使用virsh来操作KVM的话,会报错:
1root@truenas[~]# virsh list
2error: failed to connect to the hypervisor
3error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
这是因为TrueNAS没有在默认的位置创建unix sock文件。而是放在了/run/truenas_libvirt/libvirt-sock
创建一个软链接即可
1ln -s /run/truenas_libvirt/libvirt-sock /var/run/libvirt/libvirt-sock
1root@truenas[~]# ln -s /run/truenas_libvirt/libvirt-sock /var/run/libvirt/libvirt-sock
2root@truenas[~]# virsh list
3 Id Name State
4---------------------------
5 1 3_OpenWrt running
6 2 5_WS2012 running
7 3 6_Mint running
8
9root@truenas[~]#