Error with fresh Ubuntu 18.04 container

Good morning i am having an issue with Ubuntu 18.04 container i would launch it fresh and do updates after a restart it crashes and never boots until i reboot the host. here are the logs

root@games:~# lxc stop test
root@games:~# lxc start test
Error: Failed to run: /usr/lib/lxd/lxd forkstart test /var/lib/lxd/containers /var/log/lxd/test/lxc.conf: 
Try `lxc info --show-log test` for more info
root@games:~# lxc start test
Error: Failed to run: /usr/lib/lxd/lxd forkstart test /var/lib/lxd/containers /var/log/lxd/test/lxc.conf: 
Try `lxc info --show-log test` for more info
root@games:~# lxc info --show-log test
Name: test
Remote: unix://
Architecture: x86_64
Created: 2018/11/06 13:32 UTC
Status: Stopped
Type: persistent
Profiles: macvlan

Log:

lxc test 20181106133942.763 ERROR    network - network.c:lxc_setup_netdev_in_child_namespaces:2918 - Device or resource busy - Failed to set network device "eth0" up
lxc test 20181106133942.763 ERROR    network - network.c:lxc_setup_network_in_child_namespaces:3031 - failed to setup netdev
lxc test 20181106133942.763 ERROR    conf - conf.c:lxc_setup:3530 - Failed to setup network
lxc test 20181106133942.763 ERROR    start - start.c:do_start:1234 - Failed to setup container "test"
lxc test 20181106133942.763 ERROR    sync - sync.c:__sync_wait:59 - An error occurred in another process (expected sequence number 5)
lxc test 20181106133942.763 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:840 - Received container state "ABORTING" instead of "RUNNING"
lxc test 20181106133942.763 ERROR    start - start.c:__lxc_start:1910 - Failed to spawn container "test"
lxc 20181106133942.771 WARN     commands - commands.c:lxc_cmd_rsp_recv:130 - Connection reset by peer - Failed to receive response for command "get_state"

Can you show lxc config show test --expanded and uname -a?

root@games:~# lxc config show test --expanded
architecture: x86_64
config:
  image.architecture: amd64
  image.description: ubuntu 18.04 LTS amd64 (release) (20181029)
  image.label: release
  image.os: ubuntu
  image.release: bionic
  image.serial: "20181029"
  image.version: "18.04"
  volatile.base_image: 30b9f587eb6fb50566f4183240933496d7b787f719aafb4b58e6a341495a38ad
  volatile.eth0.hwaddr: 00:16:3e:ec:0b:25
  volatile.idmap.base: "0"
  volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":100000,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":100000,"Nsid":0,"Maprange":65536}]'
  volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":100000,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":100000,"Nsid":0,"Maprange":65536}]'
  volatile.last_state.power: STOPPED
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: eno1
    type: nic
  root:
    path: /
    pool: default
    type: disk
ephemeral: false
profiles:
- macvlan
stateful: false
description: ""
root@games:~# uname -a
Linux games 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@games:~#

Hmm, so something’s up with macvlan somehow, can you show ip link show from the host?

root@games:~# ip link show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether b8:ca:3a:72:ed:49 brd ff:ff:ff:ff:ff:ff
3: lxdbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 82:e6:b3:86:24:bf brd ff:ff:ff:ff:ff:ff

So this suggests a problem doing macvlan on top of your eno1 device.

Presumably the container starts fine if you change it to using bridged and lxdbr0?

If so, I’d recommend making sure your kernel is up to date and reboot to see if that unsticks macvlan.

i found a quick way to avoid the problem, instead of doing a “reboot now” in the container i exit the container then do a “lxc stop c1” and “lxc start c1” and it never crashes. but somehow reboot now does not let the container start again until the host reboots and this is only with the ubuntu:18.04 image every other image i can reboot just fine.