Skip to content

Instantly share code, notes, and snippets.

@Snawoot
Last active March 16, 2024 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Snawoot/fbc263ce97744bbb773e9514d85ff7a9 to your computer and use it in GitHub Desktop.
Save Snawoot/fbc263ce97744bbb773e9514d85ff7a9 to your computer and use it in GitHub Desktop.
Fixes for openvswitch-ipsec to make it work on recent Ubuntu
# /lib/systemd/system/openvswitch-ipsec.service
[Unit]
Description=Open vSwitch IPsec daemon
Requires=openvswitch-switch.service
After=openvswitch-switch.service
[Service]
Type=forking
PIDFile=/run/openvswitch/ovs-monitor-ipsec.pid
ExecStart=/usr/share/openvswitch/scripts/ovs-ctl \
--ike-daemon=strongswan start-ovs-ipsec
ExecStop=/usr/share/openvswitch/scripts/ovs-ctl stop-ovs-ipsec
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/openvswitch-ipsec.service.d/override.conf
[Service]
Environment="OVS_PKGDATADIR=/usr/share/openvswitch"
Environment="OVS_RUNDIR=/var/run/openvswitch"
@Snawoot
Copy link
Author

Snawoot commented Mar 16, 2024

These environment variables fix errors like:

Mar 16 20:21:45 hel-tun03 ovs-monitor-ips[19261]: ovs|  2  | ovs-monitor-ipsec | ERR | traceback
                                                  Traceback (most recent call last):
                                                    File "/usr/share/openvswitch/scripts/ovs-monitor-ipsec", line 1366, in <module>
                                                      main()
                                                    File "/usr/share/openvswitch/scripts/ovs-monitor-ipsec", line 1315, in main
                                                      schema_helper = ovs.db.idl.SchemaHelper()
                                                    File "/usr/lib/python3/dist-packages/ovs/db/idl.py", line 2304, in __init__
                                                      schema_json = ovs.json.from_file(location)
                                                    File "/usr/lib/python3/dist-packages/ovs/json.py", line 61, in from_file
                                                      stream = open(name, "r")
                                                  FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/share/openvswitch/vswitch.ovsschema'

and

Mar 16 20:38:50 hel-tun03 ovs-monitor-ips[1198]: ovs|  3  | ovs-monitor-ipsec | ERR | ovs-monitor-ipsec: could not create unixctl server (No such file or directory)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment