在我的 Ubutntu 18.04 LTS 服务器(后来添加了桌面)上,我正在使用netplan
(几个月前networkd
尝试切换回来,但我认为我最好习惯 netplan)。ifup
但奇怪的是,netplan
现在突然消失了(显然是卸载了)并systemd-networkd
突然被屏蔽了,我不知道这是怎么回事,也不知道为什么会发生这种情况。我唯一做的事情就是在更新管理器提示我时安装了一些看似常规的更新,但为什么更新会扰乱我的网络设置呢?
更多细节:
我正在通过网桥运行虚拟机 (KVM),该机器突然失去网络连接。就在那时,我意识到它netplan
不再运行:
$ netplan
Command 'netplan' not found, but can be installed with:
sudo apt install netplan.io
sudo apt install netplan
和:
$ sudo systemctl restart system-networkd
Failed to restart system-networkd.service: Unit system-networkd.service not found.
所以我继续做了
$ sudo apt install --reinstall netplan.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libnetplan0 python3-netifaces
The following NEW packages will be installed:
libnetplan0 netplan.io python3-netifaces
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 106 kB of archives.
After this operation, 438 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnetplan0 amd64 0.99-0ubuntu3~18.04.3 [22.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 python3-netifaces amd64 0.10.4-0.1build4 [12.8 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 netplan.io amd64 0.99-0ubuntu3~18.04.3 [70.7 kB]
Fetched 106 kB in 0s (501 kB/s)
Selecting previously unselected package libnetplan0:amd64.
(Reading database ... 358917 files and directories currently installed.)
Preparing to unpack .../libnetplan0_0.99-0ubuntu3~18.04.3_amd64.deb ...
Unpacking libnetplan0:amd64 (0.99-0ubuntu3~18.04.3) ...
Selecting previously unselected package python3-netifaces.
Preparing to unpack .../python3-netifaces_0.10.4-0.1build4_amd64.deb ...
Unpacking python3-netifaces (0.10.4-0.1build4) ...
Selecting previously unselected package netplan.io.
Preparing to unpack .../netplan.io_0.99-0ubuntu3~18.04.3_amd64.deb ...
Unpacking netplan.io (0.99-0ubuntu3~18.04.3) ...
Setting up python3-netifaces (0.10.4-0.1build4) ...
Setting up libnetplan0:amd64 (0.99-0ubuntu3~18.04.3) ...
Setting up netplan.io (0.99-0ubuntu3~18.04.3) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1.2) ...
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...
进而
$ sudo netplan try
Failed to start systemd-networkd.service: Unit systemd-networkd.service is masked.
An error occurred: Command '['systemctl', 'start', 'systemd-networkd.service']' returned non-zero exit status 1.
Reverting.
Failed to start systemd-networkd.service: Unit systemd-networkd.service is masked.
Traceback (most recent call last):
File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 83, in command_try
NetplanApply.command_apply(run_generate=True, sync=True, exit_on_error=False)
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 179, in command_apply
utils.systemctl_networkd('start', sync=sync, extra_services=netplan_wpa)
File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd
subprocess.check_call(command)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['systemctl', 'start', 'systemd-networkd.service']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/sbin/netplan", line 23, in <module>
netplan.main()
File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 186, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 66, in run
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 186, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 94, in command_try
self.revert()
File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 117, in revert
NetplanApply.command_apply(run_generate=False, sync=True, exit_on_error=False)
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 179, in command_apply
utils.systemctl_networkd('start', sync=sync, extra_services=netplan_wpa)
File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd
subprocess.check_call(command)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['systemctl', 'start', 'systemd-networkd.service']' returned non-zero exit status 1.
我完全迷路了,不知道发生了什么。有人能指点一下吗?