Welcome to the Linux Foundation Forum!

Lab 16.1 - LXC - no network in containers, cgroup controller missing

edited October 2021 in LFS211 Class Forum

Hi,
I'm trying to follow the LXC lab but after some trials and google searching I'm still with no networking containers.

Here my configs:

  1. root@alex-kvm:~# hostnamectl status
  2. Static hostname: alex-kvm
  3. Icon name: computer-vm
  4. Chassis: vm
  5. Machine ID: 842c7ef66a9c4d7b88ec23e7c342ce7c
  6. Boot ID: 11ef0d3089fa49f9b8b6dd474f04c73e
  7. Virtualization: kvm
  8. Operating System: Ubuntu 21.10
  9. Kernel: Linux 5.13.0-20-generic
  10. Architecture: x86-64
  11. Hardware Vendor: QEMU
  12. Hardware Model: Standard PC _Q35 + ICH9, 2009_
  13.  
  1. root@alex-kvm:~# lxc-checkconfig
  2. LXC version 4.0.10
  3. Kernel configuration not found at /proc/config.gz; searching...
  4. Kernel configuration found at /boot/config-5.13.0-20-generic
  5. --- Namespaces ---
  6. Namespaces: enabled
  7. Utsname namespace: enabled
  8. Ipc namespace: enabled
  9. Pid namespace: enabled
  10. User namespace: enabled
  11. Network namespace: enabled
  12.  
  13. --- Control groups ---
  14. Cgroups: enabled
  15. Cgroup namespace: enabled
  16.  
  17. Cgroup v1 mount points:
  18.  
  19.  
  20. Cgroup v2 mount points:
  21. /sys/fs/cgroup
  22.  
  23. Cgroup v1 systemd controller: missing
  24. Cgroup v1 freezer controller: missing
  25. Cgroup ns_cgroup: required
  26. Cgroup device: enabled
  27. Cgroup sched: enabled
  28. Cgroup cpu account: enabled
  29. Cgroup memory controller: enabled
  30. Cgroup cpuset: enabled
  31.  
  32. --- Misc ---
  33. Veth pair device: enabled, loaded
  34. Macvlan: enabled, not loaded
  35. Vlan: enabled, not loaded
  36. Bridges: enabled, loaded
  37. Advanced netfilter: enabled, loaded
  38. CONFIG_NF_NAT_IPV4: missing
  39. CONFIG_NF_NAT_IPV6: missing
  40. CONFIG_IP_NF_TARGET_MASQUERADE: enabled, not loaded
  41. CONFIG_IP6_NF_TARGET_MASQUERADE: enabled, not loaded
  42. CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled, loaded
  43. CONFIG_NETFILTER_XT_MATCH_COMMENT: enabled, not loaded
  44. FUSE (for use with lxcfs): enabled, not loaded
  45.  
  46. --- Checkpoint/Restore ---
  47. checkpoint restore: enabled
  48. CONFIG_FHANDLE: enabled
  49. CONFIG_EVENTFD: enabled
  50. CONFIG_EPOLL: enabled
  51. CONFIG_UNIX_DIAG: enabled
  52. CONFIG_INET_DIAG: enabled
  53. CONFIG_PACKET_DIAG: enabled
  54. CONFIG_NETLINK_DIAG: enabled
  55. File capabilities:
  56.  
  57. Note : Before booting a new kernel, you can check its configuration
  58. usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
  59.  

# lxc-create -n ubby -t ubuntu -o /var/log/lxc/lxc-ubby.log

lxc-start --version => 4.0.10

  1. # lxc-start -n ubby -F /bin/bash
  2.  
  3. root@ubby:/# ping google.com
  4. ping: google.com: Temporary failure in name resolution
  5.  
  6. root@ubby:/# ip addr show
  7. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  8. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  9. inet 127.0.0.1/8 scope host lo
  10. valid_lft forever preferred_lft forever
  11. inet6 ::1/128 scope host
  12. valid_lft forever preferred_lft forever
  13. 2: eth0@if19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
  14. link/ether 00:16:3e:e9:a6:0c brd ff:ff:ff:ff:ff:ff link-netnsid 0
  15. inet6 fe80::216:3eff:fee9:a60c/64 scope link
  16. valid_lft forever preferred_lft forever
  17.  
  18. root@ubby:/# ip route
  19. root@ubby:/#
  20. root@ubby:/# cat /etc/hosts
  21. 127.0.0.1 localhost
  22. 127.0.1.1 ubby
  23.  
  24. # The following lines are desirable for IPv6 capable hosts
  25. ::1 ip6-localhost ip6-loopback
  26. fe00::0 ip6-localnet
  27. ff00::0 ip6-mcastprefix
  28. ff02::1 ip6-allnodes
  29. ff02::2 ip6-allrouters
  30.  
  1. # cat /proc/1/mounts |grep cgroup
  2. cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime 0 0

Following this issue I have also tried to run the lxc-start inside a systemd-run command, but being in a kvm machine it doesn't work

  1. # systemd-run --user --scope -p "Delegate=yes" lxc-start -n ubby -F /bin/bash
  2. Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)

Any help?

Comments

  • Posts: 380

    Not sure which cgroup you are looking at,
    I see Ubuntu 21.10 and lxc 4.10.
    We use long term releases for labs, so there may be some surprises with 21.10.

    Depending on which machine or VM you are running on, connect the network in /etc/lxc/default then re-create the lxc machine.

    Let me know. Lee

  • Posts: 380

    Please show us your "/etc/lxc/default.conf" file.
    I'm using the bridge set up by libvirt and connecting the lxc-container to it; my file is below, notice the lxc.net.0.link value.

    root@ubuntu:~# cat /etc/lxc/default.conf
    lxc.net.0.type = veth
    lxc.net.0.link = virbr0
    lxc.net.0.flags = up
    lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
    root@ubuntu:~#

    And my containers have ip addresses in the same domain as KVM.
    root@ubuntu:~# lxc-ls -f
    NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
    bucket RUNNING 0 - 192.168.122.37 - false
    test01 RUNNING 0 - 192.168.122.143 - false
    test02 RUNNING 0 - 192.168.122.93 - false
    root@ubuntu:~#

    Lee

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training