virt-manager unable to connect to xen domain

Bug #1889064 reported by Marietto
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Invalid
Low
Unassigned
xen (Ubuntu)
Invalid
Low
Unassigned

Bug Description

On Ubuntu 20.04 while running the Xen kernel (I have been able to boot succesfully a phisical installation of windows 10 in dom U with the passed through graphic card (rtx 2080 ti),so the xen kernel is working right),I get the error "libxenlight state driver" is not active when I try to create a new connection to my XEN domain (localhost) using virt-manager:

Unable to connect to libvirt xen:///.

internal error: libxenlight state driver is not active

Verify that:
 - A Xen host kernel was booted
 - The Xen service has been started

Libvirt URI is: xen:///

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 956, in _do_open
    self._backend.open(connectauth.creds_dialog, self)
  File "/usr/share/virt-manager/virtinst/connection.py", line 172, in open
    conn = libvirt.openAuth(self._open_uri,
  File "/usr/lib/python3/dist-packages/libvirt.py", line 104, in openAuth
    if ret is None:raise libvirtError('virConnectOpenAuth() failed')

libvirt.libvirtError: internal error: libxenlight state driver is not active

Package versions that might be relevent:

virt-manager: (1:2.2.1-3ubuntu2).

xen_version : 4.14-unstable

libvirt-bin:

  Installed: 1.2.2-0ubuntu13.1

virsh --version = 6.0.0

libvirtd --version
libvirtd (libvirt) 6.0.0

Revision history for this message
Mark Morlino (markmorlino) wrote : Bug is not a security issue

Thanks for taking the time to report this bug and helping to make Ubuntu better. We appreciate the difficulties you are facing, but this appears to be a "regular" (non-security) bug. I have unmarked it as a security issue since this bug does not show evidence of allowing attackers to cross privilege boundaries nor directly cause loss of data/privacy. Please feel free to report any other bugs you may find.

information type: Private Security → Public
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI this is a continuation of
1. need to install the right packages for xen after its demotion to universe they are no more auto-installed
https://askubuntu.com/questions/1259086/socket-to-var-run-libvirt-virtxend-sock-file-o-directory-not-found
2. Xen setup is incomplete
https://askubuntu.com/questions/1259374/libxenlight-state-driver-is-not-active

Revision history for this message
Marietto (marietto2008) wrote :

I don't know if it is useful,but I have configured xen on the debian 10.4 exactly as I did with ubuntu 20.04,to see the differences and to be sure that this bug is also there. is not there. on debian 10.4 I can create a new xen connection using virt-manager.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Download full text (3.6 KiB)

I was using a new system with Ubuntu 20.04.
Obviously for Xen it needs a few packages installed - a bit more than in the past even since since Xen is demoted to Universe for it's low adoption by the community (KVM IMHO beats it in all cases).

Step #1 - prep packages:
$ sudo apt install xen-hypervisor xen-utils libvirt-daemon-driver-xen libvirt-clients libvirt-daemon-system

Please do note that e.g. the further dependencies that you were missing like "qemu-system-x86-xen" are pulled in via dependencies automatically. As xen-utils-4.11 depends on it.

Step #2 - since xen needs to boot into it's special Dom0 reboot:
$ sudo reboot

After reboot check if things work so far:
$ sudo xl list
[sudo] password for ubuntu:
Name ID Mem VCPUs State Time(s)
Domain-0 0 15921 4 r----- 29.0

-- I assume you are here atm, xen working but libvirt can't connect --

# Step 3 - libvirt

Check libvirt is connected to Xen:

$ virsh --connect xen:/// list --all
 Id Name State
--------------------------
 0 Domain-0 running

If running in a Dom0 the xen connection is the default, but for the sake of showing the connection URL I added it to the command.

Also capabilities probing by libvirt went well
$ virsh capabilities | grep xen
    <os_type>xen</os_type>
      <emulator>/usr/lib/xen-4.11/bin/qemu-system-i386</emulator>
      <machine>xenpv</machine>
      <domain type='xen'/>
    <os_type>xen</os_type>
      <emulator>/usr/lib/xen-4.11/bin/qemu-system-i386</emulator>
      <machine>xenpv</machine>
      <domain type='xen'/>
      <emulator>/usr/lib/xen-4.11/bin/qemu-system-i386</emulator>
      <loader>/usr/lib/xen-4.11/boot/hvmloader</loader>
      <machine>xenfv</machine>
      <domain type='xen'/>
    <os_type>xenpvh</os_type>
      <emulator>/usr/lib/xen-4.11/bin/qemu-system-i386</emulator>
      <machine>xenpvh</machine>
      <domain type='xen'/>
      <emulator>/usr/lib/xen-4.11/bin/qemu-system-i386</emulator>
      <loader>/usr/lib/xen-4.11/boot/hvmloader</loader>
      <machine>xenfv</machine>
      <domain type='xen'/>
    <os_type>xenpvh</os_type>
      <emulator>/usr/lib/xen-4.11/bin/qemu-system-i386</emulator>
      <machine>xenpvh</machine>
      <domain type='xen'/>

Step #4 - virt-manager

So libvirt is able to talk&work with Xen it seems, your error report was from virt-manager.
Therefore let me install that.

$ sudo apt install virt-manager
$ virt-manager

This gets me into virt-manager also auto-connecting with Xen.

(screenshot attached)

Step #5 - install something from virt-manager

$ wget https://releases.ubuntu.com/20.04/ubuntu-20.04-live-server-amd64.iso
$ sudo mv ubuntu-20.04-live-server-amd64.iso /var/lib/libvirt/images/

Then in virt-manager
- New
- From local ISO
- select ISO
- forward
- forward(keep defaults)
- forward (get me storage)

- Finish will get you into trouble because the defaults are bad, but not into the connection issues you had.
The error is more like "/usr/lib/xen-4.11/bin/qemu-system-i386 not found"

From here either modify the wrong defaults in the guest config for the Emulator from /usr/lib/xen-4.11/bin/qemu-s...

Read more...

Changed in libvirt (Ubuntu):
status: New → Incomplete
Changed in xen (Ubuntu):
status: New → Incomplete
Changed in libvirt (Ubuntu):
importance: Undecided → Low
Changed in xen (Ubuntu):
importance: Undecided → Low
Revision history for this message
Marietto (marietto2008) wrote :

I have reinstalled ubuntu 20.04 and I have issed the following commands :

sudo apt install xen-hypervisor xen-utils libvirt-daemon-driver-xen libvirt-clients libvirt-daemon-system
sudo reboot
sudo xl list

Name ID Mem VCPUs State Time(s)
Domain-0 0 15921 4 r----- 29.0

virsh --connect xen:/// list --all

it says :

 Id Name State
--------------------------
 0 Domain-0 running

so it's working. at this point,I would like to know if there is a command that I can give to restore the original libvirt configuration so that I can make it work also on the current installation of ubuntu that I'm using. Maybe I can purge some package configuration file ?

thanks for the time that you have dedicated to this problem,even if u don't love xen at all.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks for trying the suggestions Mario,

The libvirt configuration on your current system isn't modified by the commands you issues so far.
I assume you mean the guest configuration/definition instead?

If you can boot into your old installation the easiest way would be:

1. disk images
virsh domblklist <guest>
# copy the files you see there to the same path on the new system

2. guest definition
virsh dumpxml <guest> > myguest.xml
# copy that xml over to the new system

3. restore
virsh define myguest.xml

If anything mismatches on the new system you need to adapt it accordingly.

I'll mark the bug invalid as it isn't anything to fix in the packages.
Glad I could help.

P.S. I have loved it in like 2006 or so (http://www-archive.xenproject.org/files/xensummit_4/2007XenSummitSpringPPC_Xenidis.pdf), but times change :-)

Changed in libvirt (Ubuntu):
status: Incomplete → Invalid
Changed in xen (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Marietto (marietto2008) wrote :

if the error does not happens in a fresh installation,it happens after some time,because some kind of misconfiguration. I don't think that it is an isolated problem. If you give a look on internet,you will find that it happened many times. I mean the configuration that I tried to apply to establish a connection between xen and libvirt by reading here :

https://trueconf.com/blog/knowledge-base/configure-xen-hypervisor-ubuntu-server-14-4-05.html

even if it didn't work also before to try that.

Revision history for this message
Marietto (marietto2008) wrote :

its ok if u don't like xen,it is in your right,but it's not ok if you don't want to investigate if some xen related bug comes out. In addition to this,it's better that dont try to universalize what u think. ok if you don't like xen,but maybe there are people who likes it and want to take care of it.

Revision history for this message
Marietto (marietto2008) wrote :

I don't think that the problem is related to a misconfiguration on the guest side.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I didn't mean guest, but Host misconfiguration of some sort.

Revision history for this message
Marietto (marietto2008) wrote : Re: [Bug 1889064] Re: virt-manager unable to connect to xen domain

yes. now the problem is to understand whats wrong or at least,make it work
on my daily work ubuntu 20.04 machine. it's not easy.

Il giorno mer 29 lug 2020 alle ore 16:10 Christian Ehrhardt  <
<email address hidden>> ha scritto:

> I didn't mean guest, but Host misconfiguration of some sort.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1889064
>
> Title:
> virt-manager unable to connect to xen domain
>
> Status in libvirt package in Ubuntu:
> Invalid
> Status in xen package in Ubuntu:
> Invalid
>
> Bug description:
> On Ubuntu 20.04 while running the Xen kernel (I have been able to boot
> succesfully a phisical installation of windows 10 in dom U with the
> passed through graphic card (rtx 2080 ti),so the xen kernel is working
> right),I get the error "libxenlight state driver" is not active when I
> try to create a new connection to my XEN domain (localhost) using
> virt-manager:
>
> Unable to connect to libvirt xen:///.
>
> internal error: libxenlight state driver is not active
>
> Verify that:
> - A Xen host kernel was booted
> - The Xen service has been started
>
> Libvirt URI is: xen:///
>
> Traceback (most recent call last):
> File "/usr/share/virt-manager/virtManager/connection.py", line 956, in
> _do_open
> self._backend.open(connectauth.creds_dialog, self)
> File "/usr/share/virt-manager/virtinst/connection.py", line 172, in
> open
> conn = libvirt.openAuth(self._open_uri,
> File "/usr/lib/python3/dist-packages/libvirt.py", line 104, in openAuth
> if ret is None:raise libvirtError('virConnectOpenAuth() failed')
>
> libvirt.libvirtError: internal error: libxenlight state driver is not
> active
>
>
> Package versions that might be relevent:
>
> virt-manager: (1:2.2.1-3ubuntu2).
>
> xen_version : 4.14-unstable
>
> libvirt-bin:
>
> Installed: 1.2.2-0ubuntu13.1
>
> virsh --version = 6.0.0
>
> libvirtd --version
> libvirtd (libvirt) 6.0.0
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1889064/+subscriptions
>

--
Mario.

Revision history for this message
Marietto (marietto2008) wrote :

yes. now the problem is to understand whats wrong or at least,make it work on my daily work ubuntu 20.04 machine. it's not easy.

Revision history for this message
Marietto (marietto2008) wrote :
Download full text (5.7 KiB)

This is what I done but it didn't work (same error as before)

PURGE :

root@ziomario-I9:/home/ziomario# sudo apt-get purge xen-hypervisor xen-utils libvirt-daemon-driver-xen libvirt-clients libvirt-daemon-system
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
Nota, viene selezionato "xen-hypervisor-4.11-amd64" al posto di "xen-hypervisor"
Nota, viene selezionato "xen-utils-4.11" al posto di "xen-utils"
I seguenti pacchetti saranno RIMOSSI:
  libvirt-clients* libvirt-daemon-driver-xen* libvirt-daemon-system*
0 aggiornati, 0 installati, 3 da rimuovere e 1 non aggiornati.
Dopo quest'operazione, verranno liberati 2.193 kB di spazio su disco.
Continuare? [S/n] s
(Lettura del database... 499280 file e directory attualmente installati.)
Rimozione di libvirt-daemon-system (6.0.0-0ubuntu8.2)...
Removing libvirt-daemon dnsmasq configuration
Rimozione di libvirt-clients (6.0.0-0ubuntu8.2)...
Rimozione di libvirt-daemon-driver-xen (6.0.0-0ubuntu8.2)...
Elaborazione dei trigger per man-db (2.9.1-1)...
(Lettura del database... 499206 file e directory attualmente installati.)
Eliminazione dei file di configurazione di libvirt-clients (6.0.0-0ubuntu8.2)...
Eliminazione dei file di configurazione di libvirt-daemon-system (6.0.0-0ubuntu8.2)...
dpkg: attenzione: nel rimuovere libvirt-daemon-system, la directory "/var/lib/libvirt/qemu" è risultata non vuota e non viene rimossa
dpkg: attenzione: nel rimuovere libvirt-daemon-system, la directory "/var/lib/libvirt/images" è risultata non vuota e non viene rimossa
dpkg: attenzione: nel rimuovere libvirt-daemon-system, la directory "/etc/libvirt/qemu/networks" è risultata non vuota e non viene rimossa
dpkg: attenzione: nel rimuovere libvirt-daemon-system, la directory "/etc/apparmor.d/libvirt" è risultata non vuota e non viene rimossa

REINSTALL :

root@ziomario-I9:/home/ziomario# sudo apt-get install xen-hypervisor xen-utils libvirt-daemon-driver-xen libvirt-clients libvirt-daemon-system
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
Nota, viene selezionato "xen-hypervisor-4.11-amd64" al posto di "xen-hypervisor"
Nota, viene selezionato "xen-utils-4.11" al posto di "xen-utils"
xen-hypervisor-4.11-amd64 è già alla versione più recente (4.11.3+24-g14b62ab3e5-1ubuntu2).
xen-utils-4.11 è già alla versione più recente (4.11.3+24-g14b62ab3e5-1ubuntu2).
Pacchetti suggeriti:
  auditd open-iscsi pm-utils radvd systemtap zfsutils
I seguenti pacchetti NUOVI saranno installati:
  libvirt-clients libvirt-daemon-driver-xen libvirt-daemon-system
0 aggiornati, 3 installati, 0 da rimuovere e 1 non aggiornati.
È necessario scaricare 526 kB di archivi.
Dopo quest'operazione, verranno occupati 2.193 kB di spazio su disco.
Continuare? [S/n] s
Scaricamento di:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libvirt-clients amd64 6.0.0-0ubuntu8.2 [343 kB]
Scaricamento di:2 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libvirt-daemon-driver-xen amd64 6.0.0-0ubuntu8.2 [115 kB]
Scaricamento di:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libvirt-daemon-...

Read more...

Revision history for this message
Marietto (marietto2008) wrote :

root@ziomario-I9:/home/ziomario# virsh --connect xen:/// list --all
error: failed to connect to the hypervisor
error: internal error: libxenlight state driver is not active

Revision history for this message
Marietto (marietto2008) wrote :

I think that I have understood what's the problem. is that I have installed xen 4.14 unstable from mercurial instead of doing with the command apt install xen-hypervisor. now I don't know how to remove it,and I have started this thread :

https://stackoverflow.com/questions/63163012/how-do-i-remove-xen-4-14-unstable-gotten-and-compiled-from-mercurial-from-ubuntu

Revision history for this message
Marietto (marietto2008) wrote :

I should open a new bug request,not sure if it is correlated with this,you should understand it.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI: I have answered the question on SO (twice) and triaged the new bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.