Ubuntu: I can't use libvirt with listen TCP



Question:

I can't figure out how to enable libvirt with '-l' option (--listen) tcp conections in Ubuntu. I think that this is a bug.

I tried the following, without success:

https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/557054

But libvirtd only runs with -d option. I'm using Ubuntu 13.10. What I'm doing wrong? Someone could help me?

http://wiki.libvirt.org/page/Libvirt_daemon_is_not_listening_on_tcp_ports_although_configured_to


Solution:1

I have found the solution, actually you also need to supply -l option to libvirt-bin init script.

Enable TCP in the libvirt service on the host OS.

Edit /etc/libvirt/libvirtd.conf to set:  listen_tls = 0  listen_tcp = 1  auth_tcp="none"  tcp_port = "16509"  

Configure the libvirt service to listen on TCP

Edit /etc/init/libvirt-bin.conf to add the "-l" argument:  exec /usr/sbin/libvirtd -d -l  

Restart libvirt service

Invoke: service libvirt-bin restart  

**Test libvirt is started with “-l” parameter **

Invoke: ps -ef | grep libvirt  

Verify that the output contains the "-l" argument:

.... /usr/sbin/libvirtd -d -l  

The source: http://pineapplesoftware.blogspot.com.tr/2012/11/configuring-unsecure-remote-access-to.html


Solution:2

Since there are small inconsistencies in @Mustafa answer, I am rewriting some of the 'steps'. The following was tested on Ubuntu 12.04

  1. Update the libvirt configurations. Modify /etc/libvirt/libvirtd.conf

    before : #listen_tls = 0
    after : listen_tls = 0

    before : #listen_tcp = 1
    after : listen_tcp = 1

    add: auth_tcp = "none"

  2. Modify /etc/init/libvirt-bin.conf. (-l is short for â€"listen)

    before : env libvirtd_opts="-d"
    after : env libvirtd_opts="-d -l"

  3. Modify /etc/default/libvirt-bin.

    before :libvirtd_opts=" -d"
    after :libvirtd_opts=" -d -l"

  4. Restart libvirt. After executing the command, ensure that libvirt is successfully restarted.

    # stop libvirt-bin && start libvirt-bin
    $ ps -ef | grep libvirt

The output of the last one should be something like:

root     XXXXX     1 22 07:55 ?        00:00:01 /usr/sbin/libvirtd -d -l  


Solution:3

You need to create /etc/pki/CA/ certificates or configure libvirtd with listen_tls = 0 option


Solution:4

Solve problem for Ubuntu 15.10

$ sudo vi /etc/systemd/system/multi-user.target.wants/libvirt-bin.service

Change line
ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS
to
ExecStart=/usr/sbin/libvirtd -l $LIBVIRTD_ARGS
add -l option

Then:
$ sudo systemctl daemon-reload
$ sudo service libvirt-bin restart


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »