Subject: ufw

From: Patrick Useldinger <[email-masked]>
Date: Fri, 24 Dec 2021 11:19:31 +0100

Greetings,
I’m very new to Alpine Linux, running it under qemu as a DHCP and PiHole (docker) server currently.
Being familiar with Debian I installed ufw for packet filtering and it’s working well.
However, there’s a problematic behaviour - when starting the OS instance, ufw start fails with

- - - - - -
* Starting ufw …
Another app is currently holding the xtables lock. Perhaps you want to use the -w option?
ip6tables-restore: line 2 failed
Problem running ‘/etc/ufw/before6.rules’
* Failed to start ufw.
* ERROR: ufw failed to start
- - - - - -

The rest appears to be working correctly, although I seem to be unable to ssh into the instance unless I wait 
around 2 minutes after the startup, and without any action from my side (possibly unrelated).

To correct the problem, I console in into the instance and start ufw manually, and it works without a hitch.
So I suspect a dependency problem at startup.
I am not familiar with OpenRC but all symptoms seem to disappear when, in /etc/init.d/ufw, I change
“before net” -> “after net”.

My question is:
- what is the correct dependency for the ufw init script?

Regards,
-Patrick

---

From: Patrick <[email-masked]>
Date: Sun, 26 Dec 2021 10:30:56 +0100

> - what is the correct dependency for the ufw init script?

Plot twist: a better config seems to be

depend() {
	before net
	after iptables ip6tables
	provide firewall
}

Regards,
-Patrick