"libvirt.libvirtError: internal error: client socket is closed" when trying to start a VM

pinoli

Dabbler
Joined
Feb 20, 2021
Messages
34
Running into this issue, with the UI disconnecting from libvirt. Running "systemctl restart middlewared" seems to fix it without having to reboot. I posted an issue to the Jira tracker
not sure if relevant, but this happened to me on the latest TrueNAS SCALE release, 22.12 Bluefin.
I see the ticket you mentioned has been closed, but alas this sneaky error still pops up.
I run 3 VM, one win11 (4 vcpus, 16 GB) and two debian (2 vcups, 8GB), and they have been excellent all this time.

also, restarting middlewared with systmctl did the trick without rebooting, thanks.
 

cptkoolbeenz

Cadet
Joined
Feb 3, 2022
Messages
7
Seeing this issue on Bluefin 22.12 after creating a new VM (Ubuntu 22.01.1). The new VM could be controlled via GUI but my other VMs showed the error. "systemctl restart middlewared" fixed the GUI but VNC/Spice would not connect. Stopping/starting the VM fixed the VNC/Spice issue.
 
Last edited:

rmr

Dabbler
Joined
Sep 8, 2021
Messages
17
To use virsh, specify the connection URI like this:
Code:
virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" list


With this, you can then (for example) notify a VM that the underlying zvol size has changed (size argument must be given but value is not important):
Code:
virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" blockresize --size 0 15_myvmname vda


You can also
Code:
export LIBVIRT_DEFAULT_URI="qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock"
to make this the default.

Just had this happen again: An anecdotal observation is that I have gotten along further uptime wise without any of my windows vms live. ~18 days before erroring out. All vms are still up and functional, I just cannot manage them through webUI or virsh:
Code:
root@truenas[/]# virsh list
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

[...]
 
Last edited:

Louis2

Contributor
Joined
Sep 7, 2019
Messages
177
I am trying to use spice viewer for an 'ubuntu-22.04.2-server-amd64 on TrueNAS-SCALE-22.12.1. That does not work ! :frown:
:frown: The initial start of the VM crashes with the following message

[EFAULT] internal error: process exited while connecting to monitor: 2023-03-05T18:59:18.548969Z qemu-system-x86_64: warning: Spice: reds.c:2655:reds_init_socket: binding socket to 192.168.18.33:5901 failed 2023-03-05T18:59:18.549044Z qemu-system-x86_64: warning: Spice: reds.c:3516:do_spice_init: Failed to open SPICE sockets 2023-03-05T18:59:18.549057Z qemu-system-x86_64: failed to initialize spice server

My TrueNas system is connected via an ip-trunk carrying multiple vlans, among them one for the TrueNAS host and one for the VM. The VM -s connected to virtual vlan'x' (no bridge and no vlan assigend IP's). Central point of the network is a pfSence router providing DHCP. dns etc.

For more info see file attached
 

Attachments

  • spice-error-log.txt
    3.2 KB · Views: 77

Louis2

Contributor
Joined
Sep 7, 2019
Messages
177
I might have found a clue. It looks like VNC and SPICE functionality are interfering. When I create an extra IP and assign the Display to that IP ..... the problem is 'gone'
 

ropeguru

Dabbler
Joined
Jan 25, 2022
Messages
29
Having the same issue and made another post about it because I didn't see this one. Same exact errors..

Some of my apps are also having issuees now too. Not sure if related, but the lack of acknowledgement is concerning..
 

tsm37

Dabbler
Joined
Feb 19, 2023
Messages
46
I'm running into the same issue - either a reboot or systemctl restart middlewared command will fix the issue. This is not a permanent solution though.
 

Tuxxin

Cadet
Joined
Dec 17, 2022
Messages
3
I'm having the same issue but reboots and restarting middlewared isn't working. My UI works in some aspects but any service changes or managing VM's isn't working. All VM's are also down. The UI keeps giving me "failed to connect socket to '/run/truenas_libvirt/libvirt-sock". I have confirmed libvirtd is running and see nothing else in the log files indicating an issue.

TrueNAS-SCALE-22.12.3.3
 
Top