无法使 LCX 桥工作

无法使 LCX 桥工作

我无法让 (最新的) arch-linux 下的网桥作为主机工作:我知道 lxc 默认值是在容器创建时读取的(我在更改网络设置后创建了一个新容器)。

(base) [r0b3@toshi ~]$ sudo lxc-start -n container32 --logfile aaaaxxxxxs.txt --logpriority DEBUG
lxc-start: container32: lxccontainer.c: wait_on_daemonized_start: 868 Received container state "ABORTING" instead of "RUNNING"
lxc-start: container32: tools/lxc_start.c: main: 308 The container failed to start
lxc-start: container32: tools/lxc_start.c: main: 311 To get more details, run the container in foreground mode
lxc-start: container32: tools/lxc_start.c: main: 313 Additional information can be obtained by setting the --logfile and --logpriority options

日志的最后内容是:

lxc-start container32 20210620114326.855 WARN     cgfsng - cgroups/cgfsng.c:cgfsng_setup_limits_legacy:2749 - Invalid argument - Ignoring legacy cgroup limits on pure cgroup2 system
lxc-start container32 20210620114326.856 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_setup_limits:2857 - Limits for the unified cgroup hierarchy have been setup
lxc-start container32 20210620114326.862 ERROR    network - network.c:netdev_configure_server_veth:659 - Operation not supported - Failed to create veth pair "vethotXiCD" and "vethMRVTzD"
lxc-start container32 20210620114326.862 ERROR    network - network.c:lxc_create_network_priv:3418 - Operation not supported - Failed to create network device
lxc-start container32 20210620114326.862 ERROR    start - start.c:lxc_spawn:1844 - Failed to create the network
lxc-start container32 20210620114326.862 DEBUG    network - network.c:lxc_delete_network:4180 - Deleted network devices
lxc-start container32 20210620114326.862 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:868 - Received container state "ABORTING" instead of "RUNNING"
lxc-start container32 20210620114326.862 ERROR    lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start container32 20210620114326.862 ERROR    lxc_start - tools/lxc_start.c:main:311 - To get more details, run the container in foreground mode
lxc-start container32 20210620114326.862 ERROR    lxc_start - tools/lxc_start.c:main:313 - Additional information can be obtained by setting the --logfile and --logpriority options
lxc-start container32 20210620114326.862 ERROR    start - start.c:__lxc_start:2073 - Failed to spawn container "container32"
lxc-start container32 20210620114326.862 WARN     start - start.c:lxc_abort:1016 - No such process - Failed to send SIGKILL via pidfd 20 for process 128228
lxc-start container32 20210620114326.863 INFO     conf - conf.c:run_script_argv:332 - Executing script "/usr/share/lxcfs/lxc.reboot.hook" for container "container32", config section "lxc"

到目前为止的故障排除:

容器的配置cat /etc/lxc/default.conf给出

cat /etc/lxc/default.conf
#lxc.net.0.type = none

#lxc.net.0.type = veth
##lxc.net.0.link = lxcbr0
#lxc.net.0.link = br1
##lxc.net.0.flags = up
#lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
#lxc.net.0.name = eth0



lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.link = lxcbr0
lxc.net.0.name = eth0
lxc.net.0.hwaddr = 00:16:3e:f9:d3:03
lxc.net.0.mtu = 1500

桥梁似乎已systemctl status --lines=0 --no-pager lxc.service lxc-net.service通车

● lxc.service - LXC Container Initialization and Autoboot Code
     Loaded: loaded (/usr/lib/systemd/system/lxc.service; disabled; vendor preset: disabled)
     Active: active (exited) since Sun 2021-06-20 13:42:03 CEST; 12min ago
       Docs: man:lxc-autostart
             man:lxc
    Process: 128157 ExecStartPre=/usr/lib/lxc/lxc-apparmor-load (code=exited, status=0/SUCCESS)
    Process: 128158 ExecStart=/usr/lib/lxc/lxc-containers start (code=exited, status=0/SUCCESS)
   Main PID: 128158 (code=exited, status=0/SUCCESS)
        CPU: 24ms

● lxc-net.service - LXC network bridge setup
     Loaded: loaded (/usr/lib/systemd/system/lxc-net.service; enabled; vendor preset: disabled)
     Active: active (exited) since Sun 2021-06-20 13:42:00 CEST; 12min ago
       Docs: man:lxc
    Process: 128126 ExecStart=/usr/lib/lxc/lxc-net start (code=exited, status=0/SUCCESS)
   Main PID: 128126 (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 9421)
     Memory: 1.1M
        CPU: 38ms
     CGroup: /system.slice/lxc-net.service
             └─128150 dnsmasq --conf-file=/dev/null -u dnsmasq --strict-order --bind-interfaces --pid-file=/run/lxc/dnsmasq.pid --listen-address 10.0.3.1 --dhcp-range …

ip a给出

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 7c:05:07:ff:2e:14 brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 24:fd:52:cf:c9:86 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.153/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp3s0
       valid_lft 544603sec preferred_lft 469003sec
    inet6 2a02:810a:8cc0:5310:26fd:52ff:fecf:c986/64 scope global dynamic mngtmpaddr 
       valid_lft 86399sec preferred_lft 43199sec
    inet6 fe80::26fd:52ff:fecf:c986/64 scope link 
       valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:09:84:64:c2 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
23: lxcbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 00:16:3e:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.1/24 brd 10.0.3.255 scope global lxcbr0
       valid_lft forever preferred_lft forever

journalctl -u lxc-net.service给出

Jun 20 13:42:00 toshi systemd[1]: Starting LXC network bridge setup...
Jun 20 13:42:00 toshi dnsmasq[128150]: gestartet, Version 2.85, Zwischenspeichergröße 150
Jun 20 13:42:00 toshi dnsmasq[128150]: Optionen bei Übersetzung: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset auth cryptohash DNSSEC >
Jun 20 13:42:00 toshi systemd[1]: Finished LXC network bridge setup.
Jun 20 13:42:00 toshi dnsmasq-dhcp[128150]: DHCP, IP-Bereich 10.0.3.2 -- 10.0.3.254, Leasezeit 1h
Jun 20 13:42:00 toshi dnsmasq-dhcp[128150]: DHCP, Sockets exklusiv an die Schnittstelle lxcbr0 gebunden
Jun 20 13:42:00 toshi dnsmasq[128150]: lese /etc/resolv.conf
Jun 20 13:42:00 toshi dnsmasq[128150]: Benutze Namensserver 192.168.0.1#53
Jun 20 13:42:00 toshi dnsmasq[128150]: /etc/hosts gelesen - 3 Adressen

答案1

问题是“虚拟以太网”功能需要驱动veth程序。此驱动程序未编译到内核中,但可以作为模块加载。

手动加载驱动程序sudo modprobe veth就可以了。

相关内容