Each time after installing Open vSwitch successfully and rebooting, I get the following error. ovs-vsctl: unix:/usr/local/var/run/openvswitch/db.sock: database connection failed (no such file or directory). Does anyone know why the db.sock file goes missing?
11
votes
4 Answers
10
votes
Start the ovsdb again, and you will connect successfully.
#!/bin/bash
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--private-key=db:Open_vSwitch,SSL,private_key \
--certificate=db:Open_vSwitch,SSL,certificate \
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
--pidfile --detach
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach
1
votes
The fact that it is looking for the file in /usr/local
suggests that you're running a locally built version of Open vSwitch. The default path for the db.sock file is /var/run/openvswitch/db.sock
.
This problem can be avoided by using the following when you configure the Open vSwitch build:
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
0
votes
On OEL7.5, I had a similar error. The fix for me was to set the service to start on reboot:
[root@controller-oel7-5 ~]# ovs-vsctl add-br br0
2018-05-17T23:00:25Z|00002|reconnect|WARN|unix:/var/run/openvswitch/db.sock:
connection attempt failed (No such file or directory)
ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No
such file or directory)
[root@controller-oel7-5 ~]# systemctl status openvswitch
openvswitch.service - Open vSwitch
Loaded: loaded (/usr/lib/systemd/system/openvswitch.service; disabled;
vendor preset: disabled)
Active: inactive (dead)
[root@controller-oel7-5 ~]# systemctl start openvswitch
[root@controller-oel7-5 ~]# systemctl enable openvswitch
Created symlink from /etc/systemd/system/multi-
user.target.wants/openvswitch.service to /usr/lib/systemd/system/openvswitch.service.
[root@controller-oel7-5 ~]# systemctl status openvswitch
● openvswitch.service - Open vSwitch
Loaded: loaded (/usr/lib/systemd/system/openvswitch.service; enabled; vendor preset: disabled)
Active: active (exited) since Thu 2018-05-17 23:04:50 GMT; 12s ago
Main PID: 30536 (code=exited, status=0/SUCCESS)
May 17 23:04:50 controller-oel7-5 systemd[1]: Starting Open vSwitch...
May 17 23:04:50 controller-oel7-5 systemd[1]: Started Open vSwitch.
[root@controller-oel7-5 ~]# ovs-vsctl show
7f36b11c-9a1f-46a8-a809-1b674e371026
ovs_version: "2.0.0"
[root@controller-oel7-5 ~]#