This might be caused by the conflict with netfilter-persistent
. One can check it by
sudo service --status-all
to see whether netfilter-persistent
has been enabled.
If it is the case, one can disable it by
sudo systemctl stop netfilter-persistent
sudo systemctl disable netfilter-persistent
Now ufw
shall start on boot automatically.