2

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

2

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

| improve this answer | |
  • In case someone can't find where to put the -l flag, I have found it in the file /etc/default/libvirtd the line is libvirtd_opts="-l". Ubuntu 18 – Sam Sep 23 '18 at 14:12
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
| improve this answer | |
  • I don't think that you need to edit /etc/init/libvirt-bin.conf. I got away with just editing /etc/default/libvirt-bin – kbuilds May 24 '15 at 4:40
  • @jkurtisr32 I have encounter 1-2 cases where, only one of the two was working, so I am configuring both of them, in order to be sure. – Athafoud Jun 4 '15 at 10:04
  • In my case (ubuntu 16.10) the "-l" option was ignored in any of the above files and it worked only when I added it in /etc/default/libvirtd – firepol May 4 '17 at 12:22
  • I did all the steps but I still got this error nova.virt.libvirt.driver [-] [instance: ab64119d-d075-4c99-8687-788695711b32] Migration operation has aborted – Reza Bojnordi Sep 17 '19 at 9:17
0

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

| improve this answer | |
  • +1 this actually helped me. If you don't uncomment the listen_tls option, it will not be disabled – kbuilds May 24 '15 at 4:36
0

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.