UFWはiptablesのバージョンを確認できません

UFWはiptablesのバージョンを確認できません

私はYoctoを使ってNXP i.MX8ベースのカスタム組み込みLinuxプラットフォームを構築しています。 UFWを使ってファイアウォールを設定したいです。システムを起動してUFWを使用しようとすると、エラーが返されます。

Couldn't determine iptables version. 

iptablesとnftablesパッケージをインストールしました。 iptables-legacy バイナリを指すように itpables シンボリックリンクを手動で変更してみました。それでも失敗します。この問題をどのように解決できますか?以下のバージョンをご覧ください。

    root@iot-gate-imx8plus:~# iptables -v
    iptables v1.8.7 (legacy): no command specified
    Try `iptables -h' or 'iptables --help' for more information.
    root@iot-gate-imx8plus:~# nft -v
    nftables v1.0.2 (Lester Gooch)
    root@iot-gate-imx8plus:~# ufw version
    ufw 0.36.2
    Copyright 2008-2023 Canonical Ltd.
    root@iot-gate-imx8plus:~# ufw status
    ERROR: Couldn't determine iptables version
    root@iot-gate-imx8plus:~# uname -r
    5.15.32+g07c574e56d60
    root@iot-gate-imx8plus:~#

IPテーブル:

    root@iot-gate-imx8plus:/usr/sbin# ls -lrt *iptables*

>    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-save -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-restore -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-legacy-save -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-legacy-restore -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables-legacy -> xtables-legacy-multi\
    lrwxrwxrwx 1 root root 20 Mar  9  2018 iptables -> xtables-legacy-multi
    

修正する:

ストレスは問題を指摘した。 UFWはiptablesバイナリの場所を仮定し、Yoctoはそれを他の場所にインストールします。

strace: Process 700 attached
[pid   700] openat(AT_FDCWD, "/proc/self/fd", O_RDONLY|O_CLOEXEC) = 3
[pid   700] execve("/sbin/iptables", ["/sbin/iptables", "-V"], 0xffffec437b88 /* 21 vars */) = -1 ENOENT (No such file or directory)
[pid   700] +++ exited with 255 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=700, si_uid=0, si_status=255, si_utime=0, si_stime=0} ---
ERROR: Couldn't determine iptables version
+++ exited with 1 +++
root@iot-gate-imx8plus:~# which iptables
/usr/sbin/iptables
root@iot-gate-imx8plus:~# ln -sf /usr/sbin/iptables /sbin/iptables
root@iot-gate-imx8plus:~# ufw status
Status: inactive

ベストアンサー1

strace -f -s 1000 -e trace=file ufw status使用されているファイルパスを確認するために使用でき、エラーが見つかる可能性があります。

おすすめ記事