I have successfully created diskless Ubuntu system instance via this community help page and it works perfectly. However, I would like to enable firewall with UFW and when I tried to do that the problem appeared.
As part of the tutorial on help page I prepared complete "filesystem" with other installation and already bootstraped OS with my settings there (installed necessary packages, changed configs, ...). Later on I copied it to NFS directory and booted it via diskless machine. Everything was successfully loading (printing out OK status when started each service to console) until the moment when a loader with unlimited start time was shown. One of the starting services was also UFW. At some point system became unresponsive (I could still move the console with Shift-Pg Up/Down, but nothing was actually happening there). I could not get around that until I figured out UFW is the main problem causing this. So I disabled UFW in /etc/ufw/ufw.conf
(directly on NFS server) and retry with booting. At that time everything went well and system was successfully booted up.
But still I would like to have UFW enabled, so I tried to do that directly from the machine. And there the same problem reappeared. Soon as I executed ufw enable
system became unresponsive. I have captured output from dmesg when this command executes:
[ xxxx.xxxxxx ] bpfilter: Loaded bpfilter_umh pid 748
[ xxxx.xxxxxx ] Started filter
And then system was unresponsive for 2 minutes, when I got another few messages:
[ xxxx.xxxxxx ] INFO: task systemd-journal:278 blocked for more than 120 seconds.
[ xxxx.xxxxxx ] Not tainted 5.4.0-86-generic #97-Ubuntu
[ xxxx.xxxxxx ] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
I thought there may be problem with default rules disallowing NFS connection. So I added next rules (step by step and tried to enable UFW after each):
ufw allow from 192.168.0.5 # NFS server
ufw allow from 192.168.0.0/24 # local network
ufw allow in on eth0 # client network interface
But no luck with this (also I was not expecting it, as those rules should not have any impact by logic).
So here I am now, without any idea at the moment how to do any progress on this. I can also point out there is another problem in dmesg, but it probably does not have any relation to the one with UFW:
[ xxx.xxxxxx] systemd-journald[276]: Failed to set ACL on /var/log/jorunal/.../user-101.journal, ignoring: Operation not permitted
I believe there must be some rule with UFW which by default denies access to NFS share and therefore complete system hangs up. Any suggestion/point in the right direction would be greatly appreciated.
EDIT:
iptables output when UFW is enabled and my rules are also added (copied from the original installation) is here: https://pastebin.com/rp5QWLCh