I've made some progress:
I purge ufw and iptables, then install iptables first then change to iptables-legacy.
after that install ufw.
ufw seems to works only on iptables-legacy.
apt purge ufw iptables
apt install iptables
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
apt install ufw
now:
root@linaro-alip:~# ufw allow ssh
ERROR: initcaps
[Errno 2] modprobe: FATAL: Module ip6_tables not found in directory /lib/modules/4.4.194
ip6tables v1.8.2 (legacy): can't initialize ip6tables table `filter': Table does not exist (do you need to insmod?)
Perhaps ip6tables or your kernel needs to be upgraded.
Maybe ip6tables are missing in kernel?
root@linaro-alip:~# sudo modprobe ip6_tables
modprobe: FATAL: Module ip6_tables not found in directory /lib/modules/4.4.194
root@linaro-alip:~# ^C
root@linaro-alip:~# sudo modprobe ip6tables
modprobe: FATAL: Module ip6tables not found in directory /lib/modules/4.4.194