Setting parameter in sysctl.conf

For lxd (ubuntu 20.04) as guest in ubuntu 22.04 host
I try to set vm.nr_hugepage=40576
sysctl: permission denied on key “vm.nr_hugepages”.
What is wrong? what should i do? Thanks

AFAIK, the huge page allocation needs to be done in the host. Once done, you can configure how much a given container can use by setting the limits.hugepages.[size] key.