I’m seeing a strange error when trying to build with nftables, and it seems like a bug to me:
ruleset.conf:5:17-17: Error: Could not process rule: No such file or directory
flowtable f {
^
ruleset.conf:41:34-48: Error: Could not process rule: No such file or directory
ip protocol { tcp, udp } flow offload @f
^^^^^^^^^^^^^^^
error: builder for '/nix/store/jyzhwn1a2i532cw4jfjr0cpv5q083gy9-nftables-rules.drv' failed with exit code 1;
last 6 log lines:
> ruleset.conf:5:17-17: Error: Could not process rule: No such file or directory
> flowtable f {
> ^
> ruleset.conf:41:34-48: Error: Could not process rule: No such file or directory
> ip protocol { tcp, udp } flow offload @f
> ^^^^^^^^^^^^^^^
Edit:
It seems that this is a similar issue, however, I need to understand the order in which the configurations are applied and how I can control them.
I think I ran into this once. My config does something funny: I have a ruleset without flowtables, and then another service that adds flowtables to the ruleset after sys-subsystem-net-devices-<device>.device for all the network interfaces. I think I had issues where my Wireguard or VLAN interfaces weren’t coming up in time for nftables.
Showing my ruleset afterwards (nft list ruleset) showed that the substitution was temporary (during build) which I guess is the purpose of the command. I hadn’t quite understood that from the description.
LLMs 0, Search Enginess 0, Discourse 1 - Thank you
This is because nftables people had the bright idea of having the firewall rules syntax depend on the current state of the kernel, specifically what’s valid syntax changes depending on which kernel modules you have loaded, which interfaces are available at this moment, etc. This is also the reason preCheckRuleset exists.
For example, flowtables ft { devices = ... } or iifname ... will fail the check if any of the device is unavailable. Or meta ipsec exists accept will fail if you don’t load the IPSec modules beforehand. This also mean you can’t use a remote builder to build the NixOS system… unless you manually remove any line that can’t be validated with the smallest possible set of kernel modules using preCheckRuleset.