Upon fresh install, creating fresh container wth image opensuse/15.1/amd64. then installing firewalld on the container, starting it some times fail and always has this issue.
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-02-26 16:23:31 UTC; 11s ago
Docs: man:firewalld(1)
Main PID: 67 (firewalld)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/firewalld.service
└─67 /usr/bin/python3 -Es /usr/sbin/firewalld --nofork --nopid
Feb 26 16:23:30 ct1 systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 26 16:23:31 ct1 systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 26 16:23:31 ct1 firewalld[67]: WARNING: modinfo command is missing, not able to detect conntrack helpers.
Feb 26 16:23:31 ct1 firewalld[67]: ERROR: Failed to read file "/proc/sys/net/netfilter/nf_conntrack_helper": [Errno 2] No such file or directory: '/proc/sys/net/netfilter/nf_conntrack_helper'
Feb 26 16:23:31 ct1 firewalld[67]: WARNING: Failed to get and parse nf_conntrack_helper setting```
any suggestion, thanks.
You probably need to ensure the correct kernel modules for conntrack are loaded before the container starts, as they cannot be loaded by firewalld inside the container.
You can use the instance setting linux.kernel_modules to specify that LXD should load these modules before container starts.
i have just done that, unfortunately the problem remains the same.
UPDATE: ls /etc/modules-load.d/
is empty.
UPDATE:2: cat /proc/modules | grep 'nf_conntrack'
nf_conntrack 155648 8 ipt_MASQUERADE
but sadly the issue persist.
@seven ok, so I’ve confirmed that /proc/sys/net/netfilter/nf_conntrack_helper isn’t visible inside the container. Although you’re now reliably loading the nf_conntrack module so that’s good.
Doing a google search for that error shows that it maybe something to do with firewalld trying to decide whether to allow netfilter helpers or not. This is why it is trying to access that file. But as the file is not being passed into the container it fails to start.
You may be able to work around this issue by setting: AutomaticHelpers=no
It’s also quite likely that this particular kernel feature just isn’t properly namespaced and so it was a deliberate decision not to expose it inside child network namespaces.
@seven what is your problem?
Is it the firewalld start log error ?
Feb 26 16:23:31 ct1 firewalld[67]: ERROR: Failed to read file "/proc/sys/net/netfilter/nf_conntrack_helper": [Errno 2] No such file or directory: '/proc/sys/net/netfilter/nf_conntrack_helper'
Or the fact LXD containers are not able to access internet after the firewalld startup?
I don’t know if the firewalld log error is related to the not working LXD containers but I observed this:
I installed basic LXD 3.0.3
I created a basic container named vm1 lxc launch images:debian/buster vm1
I executed apt update from vm1 lxc exec vm1 apt update and it was ok
I installed firewalld on the host: apt install firewalld (without any configuration)
I repeated step 3 and the apt update in the vm1 was not ok anymore
I stopped firewalld: systemctl stop firewalld
I repeated step 3 and the apt update in the vm1 was still not ok
I restarted lxd daemon: systemctl stop lxd
I repeated step 3 and the apt update in the vm1 was then OK
I then restarted firewalld: systemctl start firewalld
I repeated step 3 and the apt update in the vm1 was again not ok
I then restarted lxd daemon: systemctl restart lxd (notice firewalld is still running)
I then repeated step 3 and the apt update in the vm1 was finally OK !
Moral of the story, i suspect firewalld is overwriting iptables rules of LXD. I don’t know if i’m really right but if I am, i don’t know how to do to have a persistent good starting sequence: LXD should be started after firewalld and never before …
Any ideas?
@kerphi The issue is both actually.
whenever i restart the firewalld on the host, i have to restart containers 1 by 1.
and the systemctl log message too, why do we have to see it in the first place.