简体   繁体   English

如何在 Fedora 31 上修复 LXD 的网络问题?

[英]How to fix network issues with LXD on Fedora 31?

Has anyone had success using LXD on Fedora 31?有人在 Fedora 31 上成功使用 LXD 吗? I have been using it on another machine with Fedora 30 just fine, but after installing Fedora 31 on a new laptop, the containers don't get an IPv4 address:我一直在另一台装有 Fedora 30 的机器上使用它,但在新笔记本电脑上安装 Fedora 31 后,容器没有获得 IPv4 地址:

$ lxc list
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
+-------+---------+------+------+------------+-----------+
| NAME  |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS |
+-------+---------+------+------+------------+-----------+
| c1    | RUNNING |      |      | PERSISTENT | 0         |
+-------+---------+------+------+------------+-----------+

Attempting something like ping inside the container gives the error:尝试在容器内进行 ping 之类的操作会出现错误:

connect: Network is unreachable

Nothing works that needs the network, but otherwise the containers seem fine and the network is fine on the host laptop.没有任何工作需要网络,但除此之外,容器看起来很好,主机笔记本电脑上的网络也很好。

The one notable difference I see is the warning on Fedora 31:我看到的一个显着区别是 Fedora 31 上的警告:

WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement

The version of LXD is 3.18 on both machines (installed using snap), and I've compared with both environments but couldn't see any glaring differences that would point to a problem other the cgroup warning.两台机器上的 LXD 版本都是 3.18(使用 snap 安装),我已经与两种环境进行了比较,但没有看到任何明显的差异,这些差异会指向 cgroup 警告之外的问题。

This is what the network bridge looks like:这是网桥的样子:

$ lxc network show lxdbr0
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
config:
  ipv4.address: 10.192.103.1/24
  ipv4.nat: "true"
  ipv6.address: none
description: ""
name: lxdbr0
type: bridge
used_by:
- /1.0/containers/c1
managed: true
status: Created
locations:
- none

Any ideas on where to start looking?关于从哪里开始寻找的任何想法?

I found the fix to the problem.我找到了解决问题的方法。 Turns out that cgroup v2 warning was more than just a warning.事实证明,cgroup v2 警告不仅仅是一个警告。 If cgroup v2 is disabled, it works as expected.如果 cgroup v2 被禁用,它会按预期工作。

To disable cgroup v2, add the following to the linux boot line:要禁用 cgroup v2,请将以下内容添加到 linux 引导行:

systemd.unified_cgroup_hierarchy=0

There may be other ways to fix it, but this works for now.可能还有其他方法可以修复它,但这暂时有效。

根据官方文档

sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM