I have this problem when the host is Debian 10 and the container is Debian 11.
Just installed a fresh copy of Debian 10 in a VM and I could reproduce the problem there too.
All the other containers (Ubuntu 22.04, Debian 10, etc…) got an IP4 address, only Debian 11 didn’t.
root@bullseye:~# systemctl status systemd-networkd
● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/system/service.d
└─zzz-lxc-service.conf
Active: active (running) since Mon 2022-05-02 14:48:03 UTC; 21min ago
TriggeredBy: ● systemd-networkd.socket
Docs: man:systemd-networkd.service(8)
Main PID: 69 (systemd-network)
Status: "Processing requests..."
Tasks: 1 (limit: 4669)
Memory: 1.3M
CGroup: /system.slice/systemd-networkd.service
└─69 /lib/systemd/systemd-networkd
May 02 14:48:03 bullseye systemd[1]: Starting Network Service...
May 02 14:48:03 bullseye systemd-networkd[69]: Failed to increase receive buffer size for general netlink socket, ignoring: Operation not permitted
May 02 14:48:03 bullseye systemd-networkd[69]: Failed to increase buffer size for device monitor, ignoring: Operation not permitted
May 02 14:48:03 bullseye systemd-networkd[69]: Enumeration completed
May 02 14:48:03 bullseye systemd[1]: Started Network Service.
May 02 14:48:05 bullseye systemd-networkd[69]: eth0: Gained IPv6LL
There is an error in the dmesg when the container starts:
[ 1959.515677] IPv6: ADDRCONF(NETDEV_UP): vethea2c1c1e: link is not ready
[ 1959.549010] lxdbr0: port 1(vethea2c1c1e) entered blocking state
[ 1959.549012] lxdbr0: port 1(vethea2c1c1e) entered disabled state
[ 1959.549065] device vethea2c1c1e entered promiscuous mode
[ 1959.697970] audit: type=1400 audit(1651502883.247:84): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lxd-bullseye_</var/snap/lxd/common/lxd>" pid=5334 comm="apparmor_parser"
[ 1959.772695] physa0asry: renamed from vethc6dc4ece
[ 1959.785669] eth0: renamed from physa0asry
[ 1959.800572] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 1959.804561] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 1959.804653] lxdbr0: port 1(vethea2c1c1e) entered blocking state
[ 1959.804658] lxdbr0: port 1(vethea2c1c1e) entered forwarding state
[ 1959.881075] audit: type=1400 audit(1651502883.431:85): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxd-bullseye_</var/snap/lxd/common/lxd>" name="/sys/fs/cgroup/" pid=5335 comm="systemd" fstype="cgroup2" srcname="cgroup2" flags="rw, nosuid, nodev, noexec"
[ 1959.881160] audit: type=1400 audit(1651502883.431:86): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxd-bullseye_</var/snap/lxd/common/lxd>" name="/sys/fs/cgroup/" pid=5335 comm="systemd" fstype="cgroup2" srcname="cgroup2" flags="rw, nosuid, nodev, noexec"
[ 1959.881221] audit: type=1400 audit(1651502883.431:87): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxd-bullseye_</var/snap/lxd/common/lxd>" name="/sys/fs/cgroup/" pid=5335 comm="systemd" fstype="cgroup2" srcname="cgroup2" flags="rw, nosuid, nodev, noexec"