Having an Ubuntu Linux operating system installed with libvirt daemon or KVM-based virtualization, there is an error suddenly triggered. So, this article written in the middle of solving by troubleshooting an error specified in the title. Actually the problem has already been discussed in the article titled ‘How to Solve Error Message : Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’: Connection refused’ in this link. But mainly the cause of it is because the virtualization socket is being used by another virtualization platform runs which is Virtualbox in that case. So, in the following case, the file virtlogd-sock is actually removed. in order to solve the error specified in the article which is also shown in the image as follows :

In the above output where the error message shown is “Failed to connect socket to ‘/var/run/libvirt/virtlogd-sock’ : No such file or directory”, it is caused by an accident or an actual trial-and-error troubleshooting to revive the libvirt daemon or service by removing the file virtlogd-sock. After restarting the service of libvirtd and also restarting service virtlogd, the file cannot be recreated.
There is an attempt to create the file manually, which is by executing the following command in the /var/run/libvirt directory :
touch virtlogd-sock
The result is still error but the error message has changed into the following display shown :
Actually, there are steps which must be taken before the restart process of each service is executed. Below are steps taken to be able to solve the problem :
1. Enable virtlogd or virtual manager log daemon. It is done by executing the following command :
systemctl enable virtlogd
Below is the following output of the above command :
root@hostmae:/var/run/libvirt# systemctl enable virtlogd Synchronizing state of virtlogd.service with SysV init with /lib/systemd/systemd-sysv-install... Executing /lib/systemd/systemd-sysv-install enable virtlogd root@hostname:/var/run/libvirt#
2. Start the virtual manager log daemon by executing the following command :
systemctl start virtlogd
Below is the following output of the above command :
root@hostname:/var/run/libvirt# systemctl start virtlogd root@hostname:/var/run/libvirt# ls hostdevmgr libvirt-sock lxc network qemu storage uml-guest virtlogd-sock root@hostname:/var/run/libvirt#
3. Don’t forget to restart the libvirtd daemon as shown as follows :
systemctl start libvirtd
Below is the following output of the above command :
The libvird daemon is started after starting the virtlogd daemon because the first daemon which is libvirtd depends on the second one which is the virtlogd. Below is the status of libvirtd deamon whenever virtlogd daemon didn’t start properly :
systemctl status libvirt-bin
The output of the above command executed can be shown as follows :
root@hostname:/var/run/libvirt# systemctl status libvirt-bin ● libvirt-bin.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirt-bin.service; enabled; vendor preset: enabled) Active: inactive (dead) since Mon 2018-05-28 10:03:40; 14min ago Docs: man:libvirtd(8) http://libvirt.org Process: 21741 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS) Main PID: 21741 (code=exited, status=0/SUCCESS) CGroup: /system.slice/libvirt-bin.service ├─21744 /usr/sbin/libvirtd -d -l ├─21811 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper └─21812 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper May 28 10:03:51 hostname dnsmasq-dhcp[21811]: read /var/lib/libvirt/dnsmasq/default.hostsfile May 28 10:04:26 hostname libvirtd[21744]: libvirt version: 1.3.1, package: 1ubuntu10.22 (Christian Ehrhardt <[email protected]> Wed, 25 Apr 2018 09:26:12 +0200 May 28 10:04:26 hostname libvirtd[21744]: hostname: hostname May 28 10:04:26 hostname libvirtd[21744]: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': No such file or directory May 28 10:04:26 hostname libvirtd[21744]: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': No such file or directory May 28 10:06:08 hostname systemd[1]: Stopped Virtualization daemon. May 28 10:07:37 hostname libvirtd[21744]: End of file while reading data: Input/output error May 28 10:07:43 hostname libvirtd[21744]: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': No such file or directory May 28 10:07:43 hostname libvirtd[21744]: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': No such file or directory May 28 10:18:17 hostname systemd[1]: Stopped Virtualization daemon. root@hostname:/var/run/libvirt#
It can be referred also from the following output which is retrieved by typing the following command :
systemctl status libvirtd root@hostname:/var/run/libvirt# systemctl status libvirtd ● libvirt-bin.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirt-bin.service; enabled; vendor preset: enabled) Active: inactive (dead) since Sen 2018-05-28 10:03:40 WIB; 46min ago Docs: man:libvirtd(8) http://libvirt.org Main PID: 21741 (code=exited, status=0/SUCCESS) CGroup: /system.slice/libvirt-bin.service ├─21744 /usr/sbin/libvirtd -d -l ├─21811 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper └─21812 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper May 28 10:07:43 hostname libvirtd[21744]: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': No such file or directory May 28 10:18:17 hostname systemd[1]: Stopped Virtualization daemon. May 28 10:47:40 hostname dnsmasq[21811]: reading /etc/resolv.conf May 28 10:47:40 hostname dnsmasq[21811]: using nameserver xxx.xxx.xxx.xxx#53 May 28 10:47:40 hostname dnsmasq[21811]: using nameserver xxx.xxx.xxx.xxx#53 May 28 10:47:40 hostname dnsmasq[21811]: using nameserver 127.0.1.1#53 May 28 10:47:42 hostname dnsmasq[21811]: reading /etc/resolv.conf May 28 10:47:42 hostname dnsmasq[21811]: using nameserver xxx.xxx.xxx.xxx#53 May 28 10:47:42 hostname dnsmasq[21811]: using nameserver xx.xxx.xxx.xxx#53 May 28 10:47:42 hostname dnsmasq[21811]: using nameserver 127.0.1.1#53 root@hostname:/var/run/libvirt#
Since the name of the daemon or service is actually referring to libvirtd daemon or libvirt-bin service, the actual status generated by executing both of the command will display the same result.
4. So, try to stop and then restart the libvirtd daemon or libvirt-bin service since the virtlogd daemon has been successfully started. Turn the service manually. Check the process first by executing the command :
ps -ef | grep libvirt
The execution can be shown as follows :
root@hostname:/var/run/libvirt# ps -ef | grep libvirt root 21744 1 0 10:03 ? 00:00:09 /usr/sbin/libvirtd -d -l libvirt+ 21811 1 0 10:03 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper root 21812 21811 0 10:03 ? 00:00:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper root 26218 23054 0 10:52 pts/30 00:00:00 grep --color=auto libvirt root@hostname:/var/run/libvirt# kill -9 21744 root@hostname:/var/run/libvirt# kill -9 21811 root@hostname:/var/run/libvirt# kill -9 21812
5. Check the status again :
root@hostname:/var/run/libvirt# systemctl status libvirtd ● libvirt-bin.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirt-bin.service; enabled; vendor preset: enabled) Active: inactive (dead) since Sen 2018-05-28 10:53:00 WIB; 3s ago Docs: man:libvirtd(8) http://libvirt.org Process: 26252 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS) Main PID: 26252 (code=exited, status=0/SUCCESS) CGroup: /system.slice/libvirt-bin.service ├─26255 /usr/sbin/libvirtd -d -l └─26286 /usr/sbin/libvirtd -d -l May 28 10:53:00 hostname systemd[1]: Starting Virtualization daemon... May 28 10:53:00 hostname systemd[1]: libvirt-bin.service: Got notification message from PID 26255, but reception only permitted for main PID 26252 May 28 10:53:00 hostname systemd[1]: Started Virtualization daemon. root@hostname:/var/run/libvirt#
5. Restart or start the libvirtd daemon :
root@hostname:/var/run/libvirt# systemctl start libvirtd root@hostname:/var/run/libvirt#
6. Check the status again :
root@hostname:/var/run/libvirt# systemctl status libvirtd ● libvirt-bin.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirt-bin.service; enabled; vendor preset: enabled) Active: inactive (dead) since Sen 2018-05-28 10:53:00 WIB; 3s ago Docs: man:libvirtd(8) http://libvirt.org Process: 26252 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS) Main PID: 26252 (code=exited, status=0/SUCCESS) CGroup: /system.slice/libvirt-bin.service ├─26255 /usr/sbin/libvirtd -d -l └─26286 /usr/sbin/libvirtd -d -l May 28 10:53:00 hostname systemd[1]: Starting Virtualization daemon... May 28 10:53:00 hostname systemd[1]: libvirt-bin.service: Got notification message from PID 26255, but reception only permitted for main PID 26252 May 28 10:53:00 hostname systemd[1]: Started Virtualization daemon. root@hostname:/var/run/libvirt#