I was trying to use LXCs at home while using UFW.

I configured a network interface named ‘veth_something’, and to have the network bridge working I had to add a rule to UFW.

It didn’t liked it :

  File "/usr/sbin/ufw", line 89, in <module>
    ui = ufw.frontend.UFWFrontend(pr.dryrun)
  File "/usr/lib/python2.7/dist-packages/ufw/frontend.py", line 155, in __init__
    self.backend = UFWBackendIptables(dryrun)
  File "/usr/lib/python2.7/dist-packages/ufw/backend_iptables.py", line 45, in __init__
    ufw.backend.UFWBackend.__init__(self, "iptables", dryrun, files)
  File "/usr/lib/python2.7/dist-packages/ufw/backend.py", line 53, in __init__
  File "/usr/lib/python2.7/dist-packages/ufw/backend_iptables.py", line 630, in _read_rules
    (dtype, interface) = tmp[-1].split('_')
ValueError: too many values to unpack

As a consequence, I totally messed up my UFW rules, and UFW was crashing at startup.

I had to edit the rules stored in /lib/ufw/user.rules and /lib/ufw/user6.rules to fix the lignes that contained the ‘_’.

Do not use a ‘_’ on interfaces name if you plan to add UFW rules on it.