今天我想用 ansible 和我们现有的 playbook 安装一个新的服务器实例。基础系统是 Debian 9.4。
防火墙角色失败,但我不认为这是 ansible 或角色的问题。
或许只是缺少了一件小东西。
介绍自己:
$ uname -a
Linux ... 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
首先我检查了防火墙的状态:
$ systemctl status firewall
● firewall.service - Firewall
Loaded: loaded (/etc/systemd/system/firewall.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-05-16 15:59:55 CEST; 42min ago
Process: 3758 ExecStart=/etc/firewall.bash (code=exited, status=3)
Main PID: 3758 (code=exited, status=3)
CPU: 43ms
May 16 15:59:55 ... firewall.bash[3758]: modprobe: ERROR: could not insert 'ip6_tables': Unknown symbol in module, or unknown
May 16 15:59:55 ... firewall.bash[3758]: ip6tables v1.6.0: can't initialize ip6tables table `filter': Table does not exist (do
May 16 15:59:55 ... firewall.bash[3758]: Perhaps ip6tables or your kernel needs to be upgraded.
May 16 15:59:55 ... firewall.bash[3758]: modprobe: ERROR: could not insert 'ip6_tables': Unknown symbol in module, or unknown
May 16 15:59:55 ... firewall.bash[3758]: ip6tables v1.6.0: can't initialize ip6tables table `filter': Table does not exist (do
May 16 15:59:55 ... firewall.bash[3758]: Perhaps ip6tables or your kernel needs to be upgraded.
May 16 15:59:55 ... systemd[1]: firewall.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
May 16 15:59:55 ... systemd[1]: Failed to start Firewall.
May 16 15:59:55 ... systemd[1]: firewall.service: Unit entered failed state.
May 16 15:59:55 ... systemd[1]: firewall.service: Failed with result 'exit-code'.
之后,我查看了已加载的内核模块:
$ lsmod | grep filter
br_netfilter 24576 0
bridge 135168 1 br_netfilter
iptable_filter 16384 1
ip_tables 24576 3 iptable_mangle,iptable_filter,iptable_nat
x_tables 36864 10 xt_comment,xt_LOG,iptable_mangle,ip_tables,iptable_filter,xt_tcpudp,ipt_MASQUERADE,xt_limit,xt_addrtype,xt_conntrack
因此,没有 ip6_tables 模块,因为它已加载到我们的其他服务器上。接下来我尝试加载该模块:
$ modprobe ip6_tables (or modprobe ip6table_filter)
modprobe: ERROR: could not insert 'ip6_tables': Unknown symbol in module, or unknown parameter (see dmesg)
现在相关的 dmesg 输出:
$ dmesg
...
[ 9606.265051] ip6_tables: Unknown symbol xt_percpu_counter_free (err 0)
[ 9606.265850] ip6_tables: Unknown symbol xt_percpu_counter_alloc (err 0)
...
在 /lib/modules/$(uname -r)/ 下我发现了两个 IPv6 模块。
./kernel/net/ipv6/netfilter/ip6_tables.ko
./kernel/net/ipv6/netfilter/ip6table_filter.ko
如果你搜索它(ip6_tables: Unknown symbol xt_percpu_counter_free (err 0)),你不会找到太多。pastebin(https://pastebin.com/mu9HX2xq) 与 dmesg 的输出一致,但没有更多信息。
有任何想法吗?
答案1
所以我去了:https://packages.debian.org/linux-image-4.9.0-6-amd64
我从此页面下载了最新的文件:
https://packages.debian.org/stretch/linux-image-4.9.0-6-amd64
称为:
linux-镜像-4.9.0-6-amd64_4.9.88-1+deb9u1_amd64.deb
并安装它:
dpkg -i linux-镜像-4.9.0-6-amd64_4.9.88-1+deb9u1_amd64.deb
重新启动并正常工作,问题消失。
所以我猜想在稍微更新的版本中这个问题已经得到修复。