libvirt VM

JenJen

Dabbler
Joined
Jun 30, 2021
Messages
19
Hello,

I have a problem with my VM. I created a VM and try to pass USB but I break something :(
Now I can't launch my existing VM and I can't create another VM there is always the same error : failed to connect to libvirt
I reboot and there is the same error.

I try the command: service middlewared status
libvirt: XML-RPC error : Failed to connect socket to '/run/truenas_libvirt/libvirt-sock': No such file or directory

Another command:
truenas# ls -l /var/run/libvirt/libvirt-sock
srw-rw-rw- 1 root root 0 Jul 8 21:51 /var/run/libvirt/libvirt-sock

I don't know what I need to do. I need to create a symbolic link into /run/truenas_libvirt/?

JenJen
 

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
Please read "forum Rules" and provide the technical detail.

Are you trying to use libvirt directly (not supported) or going through the TrueNAS API or UI?
 

JenJen

Dabbler
Joined
Jun 30, 2021
Messages
19
Hello Morgan,

For the technical detail:
Truenas version : TrueNAS-SCALE-21.06-BETA.1

Motherboard : asrock H570m-ITX/AC
CPU : Core i3 10100
RAM : 16Go
Disk : 4*4To in raidZ2 + 250Go NVME disk cache

I want to port my automation from raspberry to Truenas in VM. I installed a debian VM. Everything was ok, I can run the VM without problem. I try to pass my ZWave stick and Zigbee stick but I didn't arrived to do that.
I tried to use lsusb but the program isn't intalled in truenas.

I tried to use : virsh nodedev-list but I had this error:
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

So I enter theses commands :
systemctl unmask libvirtd.socket
systemctl restart libvirtd.service

So for your question I tried to use libvirt directly.

Jenjen
 

silverback

Contributor
Joined
Jun 26, 2016
Messages
134
I tried to use : virsh nodedev-list but I had this error:
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused


Jenjen

Code:
virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" nodedev-list


This can get you to 'virsh', but I have not been able to get 'virsh edit' to stick.
 
Last edited:

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
I want to port my automation from raspberry to Truenas in VM. I installed a debian VM. Everything was ok, I can run the VM without problem. I try to pass my ZWave stick and Zigbee stick but I didn't arrived to do that.
I tried to use lsusb but the program isn't intalled in truenas.

So what you are trying to do nis pass a specific USB device to a specific VM?

It's not supported yet...but I think you can pass a specific USB controller via PCIe to a specific VM.

There is an accepted suggestion for a future software release:
 

JenJen

Dabbler
Joined
Jun 30, 2021
Messages
19
Thank you for your answers.

virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" nodedev-list
The problem is "/run/truenas_libvirt/libvirt-sock" doesn't exist anymore in my truenas (I think I delete it, but I don't know how :s). I don't know how to get it back... I think it will solve my problem of "failed to connect to libvirt" if I recover the "libvirt-sock".

Do you think if I copy "/var/run/libvirt/libvirt-sock" into "/run/truenas_libvirt/" it will work?

It's not supported yet...but I think you can pass a specific USB controller via PCIe to a specific VM.
I already tried but to find which PCI correspond to which USB controller... It's a bit difficult ^^. So I try another way.

There is an accepted suggestion for a future software release:
https://jira.ixsystems.com/browse/NAS-108800?jql=text ~ "SCALE usb"
I will wait so.

JenJen
 

silverback

Contributor
Joined
Jun 26, 2016
Messages
134
The problem is "/run/truenas_libvirt/libvirt-sock" doesn't exist anymore in my truenas (I think I delete it, but I don't know how :s). I don't know how to get it back... I think it will solve my problem of "failed to connect to libvirt" if I recover the "libvirt-sock".

Do you think if I copy "/var/run/libvirt/libvirt-sock" into "/run/truenas_libvirt/" it will work?



JenJen
Yes, unfortunately the only way I know to get libvirt back is to revert to a previous saved configuration or boot image.
 

JenJen

Dabbler
Joined
Jun 30, 2021
Messages
19
Yes, unfortunately the only way I know to get libvirt back is to revert to a previous saved configuration or boot image.

Ok I save the configuration after this mistake... I prefer to avoid to reinstall everything :(

Maybe the "/run/truenas_libvirt/" is a symbolic link to "/var/run/libvirt/".
I don't know if you can verify if it's a symbolic link or not.
 

JenJen

Dabbler
Joined
Jun 30, 2021
Messages
19
Hello,

I tried to install Truenas scale in virtualbox, but I had black screen. I use the iso file but it seems there is problem with it.

I wanted to compare a truenas where VM works and mine.
Somebody can execute the command ls -la in "/run/truenas_libvirt/" and "/var/run/libvirt/" and "/run/libvirt" please?

The dir on my truenas "/run/truenas_libvirt/" is empty...
"/var/run/libvirt/":
Code:
drwxr-xr-x 2 root root  40 Jul  8 21:51 hostdevmgr
drwx------ 2 root root  60 Jul 16 13:48 interface
srw-rw-rw- 1 root root   0 Jul  8 21:51 libvirt-sock
drwxr-xr-x 2 root root  80 Jul 16 13:48 lxc
drwxr-xr-x 2 root root 100 Jul 16 13:48 network
drwx------ 2 root root  60 Jul 16 13:48 nodedev
drwx------ 2 root root  60 Jul 16 13:48 nwfilter
drwx------ 2 root root  40 Jul  8 21:51 nwfilter-binding
drwxr-xr-x 4 root root 120 Jul 16 13:48 qemu
drwx------ 2 root root  60 Jul 16 13:48 secrets
drwxr-xr-x 2 root root  80 Jul 16 13:48 storage
srw------- 1 root root   0 Jul  8 21:51 virtlockd-admin-sock
srw------- 1 root root   0 Jul  8 21:51 virtlockd-sock
srw------- 1 root root   0 Jul  8 21:51 virtlogd-admin-sock
srw------- 1 root root   0 Jul  8 21:51 virtlogd-sock


I notice I have another dir with libvirt "/run/libvirt"... Maybe I need to ask a developer to help me?
"/run/libvirt":
Code:
drwxr-xr-x 2 root root  40 Jul  8 21:51 hostdevmgr
drwx------ 2 root root  60 Jul 16 13:48 interface
srw-rw-rw- 1 root root   0 Jul  8 21:51 libvirt-sock
drwxr-xr-x 2 root root  80 Jul 16 13:48 lxc
drwxr-xr-x 2 root root 100 Jul 16 13:48 network
drwx------ 2 root root  60 Jul 16 13:48 nodedev
drwx------ 2 root root  60 Jul 16 13:48 nwfilter
drwx------ 2 root root  40 Jul  8 21:51 nwfilter-binding
drwxr-xr-x 4 root root 120 Jul 16 13:48 qemu
drwx------ 2 root root  60 Jul 16 13:48 secrets
drwxr-xr-x 2 root root  80 Jul 16 13:48 storage
srw------- 1 root root   0 Jul  8 21:51 virtlockd-admin-sock
srw------- 1 root root   0 Jul  8 21:51 virtlockd-sock
srw------- 1 root root   0 Jul  8 21:51 virtlogd-admin-sock
srw------- 1 root root   0 Jul  8 21:51 virtlogd-sock


JenJen
 
Top