You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Netplan配置执行sudo netplan apply时遇权限警告及OpenvSwitch服务问题求助

Netplan配置执行sudo netplan apply时遇权限警告及OpenvSwitch服务问题求助

我在执行sudo netplan apply时遇到了两类问题,具体终端输出如下:

权限警告信息

** (generate:2496): WARNING **: 05:24:24.943: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.
** (generate:2496): WARNING **: 05:24:24.943: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:2494): WARNING **: 05:24:25.215: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:2494): WARNING **: 05:24:25.215: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:2494): WARNING **: 05:24:25.296: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:2494): WARNING **: 05:24:25.296: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:2494): WARNING **: 05:24:25.296: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.
** (process:2494): WARNING **: 05:24:25.296: Permissions for /etc/netplan/01-network-manager-all.yaml are too open. Netplan configuration should NOT be accessible by others.

查看其中一个配置文件的权限信息:

stat /etc/netplan/00-installer-config.yaml
File: /etc/netplan/00-installer-config.yaml
Size: 117         Blocks: 8          IO Block: 4096   regular file
Device: 253,0   Inode: 787924      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-07-10 00:36:05.082334425 +0000
Modify: 2023-06-12 09:56:02.404864248 +0000
Change: 2023-06-12 09:56:02.404864248 +0000
Birth: 2023-06-12 09:56:02.404864248 +0000

该配置文件内容如下:

network:
  ethernets:
    enp0s1:
      dhcp4: true
  version: 2

OpenvSwitch服务错误

Cannot call openvswitch: ovsdb-server.service is not running.

我尝试启动了isc-dhcp-server服务:

sudo systemctl start isc-dhcp-server
sudo systemctl enable isc-dhcp-server
sudo systemctl status isc-dhcp-server

但上述问题仍然存在,希望能得到解决建议。


给你整理的解决方案,一步步来就行~

1. 先搞定Netplan配置文件的权限警告

Netplan对配置文件的权限要求很严格,不能让其他用户访问到,现在你的文件权限是0644(其他用户可读),不符合要求。咱们直接把两个配置文件的权限改成0600(只有root用户可读可写):

sudo chmod 0600 /etc/netplan/00-installer-config.yaml
sudo chmod 0600 /etc/netplan/01-network-manager-all.yaml

改完之后再跑一遍sudo netplan apply,权限警告应该就消失啦。

2. 解决OpenvSwitch服务的报错

如果你的系统根本用不到OpenvSwitch,那直接把相关服务停掉禁用就好,省得它报错:

sudo systemctl stop ovsdb-server.service
sudo systemctl disable ovsdb-server.service

要是你确实需要用OpenvSwitch,那得先安装它再启动服务(以Ubuntu/Debian为例):

sudo apt update && sudo apt install openvswitch-switch
sudo systemctl start ovsdb-server.service
sudo systemctl enable ovsdb-server.service

3. 关于isc-dhcp-server的小提醒

你启动的isc-dhcp-server是DHCP服务器,但你的Netplan配置里用的是dhcp4: true(作为客户端获取IP),这俩可能会有冲突哦。如果不需要搭建DHCP服务器,建议把isc-dhcp-server停掉禁用:

sudo systemctl stop isc-dhcp-server
sudo systemctl disable isc-dhcp-server

全部操作完成后,再执行一次sudo netplan apply,应该就能正常运行啦~

备注:内容来源于stack exchange,提问作者babayaga

火山引擎 最新活动