LXD source instalation and Ininitialisation lxd init error after

Would you like a YAML “lxd init” preseed to be printed? (yes/no) [default=no]:
Error: Failed to create local member network “lxdbr0” in project “default”: Failed clearing firewall: Failed checking “iptables” chain “lxd_acl_lxdbr0” exists in table “filter”: exec: “iptables”: executable file not found in $PATH

i get the error when i lxd init

Sounds like you don’t have iptables installed on your system.

i have iptables installed

sudo iptables
iptables v1.8.7 (nf_tables): no command specified
Try `iptables -h’ or ‘iptables --help’ for more information.

Likely the way you’re launching LXD means that the PATH variable doesn’t contain the directory where the iptables command is.

i also wonder why the bin/lxd folder is in home directory instead of home/go directory i had to mv it there though

how can i check the coreect path for the iptables and also the required path for lxd to have the iptables path correct.

@tomp @stgraber how can i skip this part kindly. I have been on this part for a week now. I would appreciate your guidance please.

Do you know about the snap package BTW. Its a lot easier and quicker than getting up and running.

For the point in question, please show the exact invocation of the lxd command you are using.

@tomp Yeah i know Snap but i wanted to know how i can build from source too

The below command is run in a differnet terminal

sudo -E PATH=${PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} $(go env GOPATH)/bin/lxd --group sudo

and its output is as below

WARNING[2022-07-21T21:11:37+03:00] AppArmor support has been disabled because ‘apparmor_parser’ couldn’t be found
WARNING[2022-07-21T21:11:37+03:00] - AppArmor support has been disabled, Disabled because ‘apparmor_parser’ couldn’t be found
WARNING[2022-07-21T21:11:37+03:00] - Couldn’t find the CGroup blkio, disk I/O limits will be ignored
WARNING[2022-07-21T21:11:37+03:00] - Couldn’t find the CGroup blkio.weight, disk priority will be ignored
WARNING[2022-07-21T21:11:37+03:00] - Couldn’t find the CGroup CPU controller, CPU time limits will be ignored
WARNING[2022-07-21T21:11:37+03:00] - Couldn’t find the CGroup CPUacct controller, CPU accounting will not be available
WARNING[2022-07-21T21:11:37+03:00] - Couldn’t find the CGroup CPU controller, CPU pinning will be ignored
WARNING[2022-07-21T21:11:37+03:00] - Couldn’t find the CGroup hugetlb controller, hugepage limits will be ignored
WARNING[2022-07-21T21:11:37+03:00] - Couldn’t find the CGroup network priority controller, network priority will be ignored
WARNING[2022-07-21T21:11:37+03:00] Instance type not operational driver=qemu err=“KVM support is missing (no /dev/kvm)” type=virtual-machine
WARNING[2022-07-21T22:43:52+03:00] Firewall failed to detect any compatible driver, falling back to “xtables” (but some features may not work as expected due to: Backend command “iptables” missing)

You will notice it has some Warnings that \Backend command “iptables” missing\

then on a different terminal i run lxd init and follow the below steps along with the error in question

Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Name of the storage backend to use (dir, btrfs) [default=btrfs]:
Would you like to create a new btrfs subvolume under /var/lib/lxd? (yes/no) [default=yes]:
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
Would you like the LXD server to be available over the network? (yes/no) [default=no]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]:
Would you like a YAML “lxd init” preseed to be printed? (yes/no) [default=no]:

Error: Failed to create local member network “lxdbr0” in project “default”: Failed clearing firewall: Failed checking “iptables” chain “lxd_acl_lxdbr0” exists in table “filter”: exec: “iptables”: executable file not found in $PATH

What does

sudo -E PATH=${PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env | grep PATH

and

whereis iptables

show?

sudo -E PATH=${PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env | grep PATH
PATH=/home/aok/go/bin:/usr/local/go/bin:/home/aok/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/aok/go/bin
GOPATH=/home/aok/go
LD_LIBRARY_PATH=/home/aok/go/deps/dqlite/.libs/:/home/aok/go/deps/raft/.libs/:/home/aok/go/deps/raft/.libs/:/home/aok/go/deps/dqlite/.libs/

whereis iptables
iptables: /usr/sbin/iptables /etc/iptables /usr/share/iptables /usr/share/man/man8/iptables.8.gz

Right, so /usr/sbin (where iptables is) isn’t in the PATH you’re setting when running the command.

Try:

sudo -E PATH=${PATH}:/usr/sbin LD_LIBRARY_PATH=${LD_LIBRARY_PATH} $(go env GOPATH)/bin/lxd --group sudo

sudo -E PATH=${PATH}:/usr/sbin LD_LIBRARY_PATH=${LD_LIBRARY_PATH} (go env GOPATH)/bin/lxd --group sudo

bash: syntax error near unexpected token `(’

Corrected it above. I just added :/usr/sbin to the $PATH to account for your particular environment.

okay i edited this change

PATH=${PATH}:/usr/sbin

Now the lxd init error is not there
i created a container

lxc launch images:alpine/3.16 c1
Creating c1
Starting c1

but lxc ls shows the created container has no ipv4 address

is the qemu warning important

driver=qemu err=“KVM support is missing (no /dev/kvm)” type=virtual-machine

because

whereis kvm
kvm: /usr/bin/kvm /usr/share/man/man1/kvm.1.gz

@tomp you have a way around no ipv4 is not given to the created container but its given an ipv6??

There’s a few posts on this forum covering similar issues, usually it boils down to one or more of these issues:

  • Conflicting application listening on DHCP or DNS ports on your host system that is preventing LXD’s dnsmasq from starting up. Use lxc warning ls to see if there are any dnsmasq issues.
  • Firewall on your system blocking DHCP and/or DNS requests. This can also be caused if you have Docker installed on the host. See How to configure your firewall - LXD documentation

I have no docker installed in the system and no dnsmasq warning too. I happened to disable host firewall and it did solve the issue also nft flush too helped.

1 Like