Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
550 views
in Technique[技术] by (71.8m points)

libvirt - Could not add the parameter --listen to open tcp socket

I was installed libvirtd successfully in Ubuntu20, but when add the parameter -l or --listen to enable tcp socket, service will restart failed. The file /etc/default/libvirtd shown like below:

# Defaults for libvirtd initscript (/etc/init.d/libvirtd)
# This is a POSIX shell fragment
# Start libvirtd to handle qemu/kvm:
start_libvirtd="yes"

# options passed to libvirtd, see man libvirtd for details.
# For example to enable listening on tcp add -l here
# and set up the TLS Certificates that libvirtd will need.
libvirtd_opts="-l " # won't work with -l or --listen or -d -l
libvirtd_opts="" # work without tcp socket 

# pass in location of kerberos keytab
#export KRB5_KTNAME=/etc/libvirt/libvirt.keytab

# Whether to mount a systemd like cgroup layout (only
# useful when not running systemd)
#mount_cgroups=yes
# Which cgroups to mount
#cgroups="memory devices"

Also the config file /etc/libvirt/libvirtd.conf is:

listen_tls = 0
listen_tcp = 1
tcp_port = "16509"
listen_addr = "0.0.0.0"
auth_tcp = "none"

Any idea about this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you use systemctl status libvirtd.service it ought to tell you why it has failed. Most likely it is because Ubuntu has it configured to use socket activation, which makes use of --listen obsolete, instead replacing it with a libvirtd-tcp.socket unit file. Further info is in the man pages https://libvirt.org/manpages/libvirtd.html#system-socket-activation


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...