Azure / AKS

Azure Kubernetes Service
https://azure.github.io/AKS/
1.96k stars 305 forks source link

[BUG] - AzureLinux has invalid `/etc/sysconfig/nftables.conf` file which result in failed systemd unit `nftables.service` #4144

Open grzesuav opened 7 months ago

grzesuav commented 7 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Exec into the node
  2. systemctl status nftables.service - it will be in failed state
  3. on systemctl restart nftables.service you will see
    root [ / ]# journalctl -u nftables.service
    Mar 06 14:42:50 aks-nodepool0605-12321702-vmss00007J systemd[1]: Starting Netfilter Tables...
    Mar 06 14:42:50 aks-nodepool0605-12321702-vmss00007J nft[3510903]: /etc/sysconfig/nftables.conf:8:1-1: Error: syntax error, unexpected junk
    Mar 06 14:42:50 aks-nodepool0605-12321702-vmss00007J nft[3510903]: # start by calling: 'nft list ruleset >/etc/sysconfig/nftables.conf'.
    Mar 06 14:42:50 aks-nodepool0605-12321702-vmss00007J nft[3510903]: ^
    Mar 06 14:42:50 aks-nodepool0605-12321702-vmss00007J systemd[1]: nftables.service: Main process exited, code=exited, status=1/FAILURE
    Mar 06 14:42:50 aks-nodepool0605-12321702-vmss00007J systemd[1]: nftables.service: Failed with result 'exit-code'.
    Mar 06 14:42:50 aks-nodepool0605-12321702-vmss00007J systemd[1]: Failed to start Netfilter Tables.
    root [ / ]#
  4. Looking at problematic file
    root [ / ]# cat -A /etc/sysconfig/nftables.conf
    # Uncomment the include statement here to load the default config sample$
    # in /etc/nftables for nftables service.$
    $
    #include "/etc/nftables/main.nft"$
    $
    # To customize, either edit the samples in /etc/nftables, append further$
    # commands to the end of this file or overwrite it after first service$
    # start by calling: 'nft list ruleset >/etc/sysconfig/nftables.conf'.root [ / ]#

    seems like there is no newline at the end of the file which is main reason for the problem

Expected behavior It works our of the box Screenshots If applicable, add screenshots to help explain your problem.

image image image

Environment (please complete the following information):

Additional context To fix the issue, you need to clear out the content of the file, i.e. by running the command as in nftables.service unit - nft list ruleset >/etc/sysconfig/nftables.conf

which clears out the content of the file.

After this, when service is restarted with systemctl, is is green

grzesuav commented 7 months ago

Small notice, when running nft list ruleset >/etc/sysconfig/nftables.conf it complains that operations is not permitted, but it clears out the content anyway:

image

and after restart it works:

image
grzesuav commented 7 months ago

actually found https://github.com/microsoft/azurelinux/issues/7301

suhuruli commented 6 months ago

Thanks for the tag Aritra and @grzesuav for tagging the corresponding fix for this. This should get pushed out with an upcoming update.