How do I get ipv4/inet working in a arm lxc container running on intel host?

Solution 1:

(Answering due to lack of reputation.)

I had the exact same problem. The lxc container did not get an IPv4 address. Running dhclient eth0 -v resulted in the error message that luckily brought me here

Error getting interfaces; Address family not supported by protocol

This thread really saved my day. After building a new qemu binary, I can make armhf containers join my LAN with this default profile (eno1 being the ethernet interface on my host machine):

name: default
config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: eno1
    type: nic

I'm using a qemu 2.7.0 binary which you can compile from source and install in some <prefix> path with

./configure --target-list=arm-linux-user --static --prefix=<prefix>
make
make install

Before starting an armhf container, just get the new qemu in there

lxc file push <prefix>/bin/qemu-arm <name>/usr/bin/qemu-arm-static

Another nice side effect is that I can now stop containers without the --force flag!