Geo*_* G. 6 debian troubleshooting systemctl
我注意到每次打开电脑时,都会有一条红色的线。我的电脑速度很快,所以我无法阅读问题。我没有遇到或注意到我的系统有任何问题,但我很好奇。
我跑了systemctl --failed
,得到以下输出。
UNIT LOAD ACTIVE SUB DESCRIPTION
? networking.service loaded failed failed Raise network interfaces
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
Run Code Online (Sandbox Code Playgroud)
systemctl status networking.service
然后输出以下内容。
networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled
Active: failed (Result: exit-code) since Sun 2019-07-14 20:59:05 AWST; 4min 27s ago
Docs: man:interfaces(5)
Process: 799 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE
Main PID: 799 (code=exited, status=1/FAILURE)</code></pre><pre><code>sudo journalctl _SYSTEMD_UNIT=networking.service</pre><code><pre><code>
-- Logs begin at Sun 2019-07-14 20:59:03 AWST, end at Sun 2019-07-14 21:06:14 AWST. --
Jul 14 20:59:05 debian dhclient[863]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 20:59:05 debian dhclient[863]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 20:59:05 debian ifup[799]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 20:59:05 debian ifup[799]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 20:59:05 debian ifup[799]: All rights reserved.
Jul 14 20:59:05 debian ifup[799]: For info, please visit https://www.isc.org/software/dh
Jul 14 20:59:05 debian dhclient[863]: All rights reserved.
Jul 14 20:59:05 debian dhclient[863]: For info, please visit https://www.isc.org/softwar
Jul 14 20:59:05 debian dhclient[863]:
Jul 14 20:59:05 debian ifup[799]: Cannot find device "eth0"
Jul 14 20:59:05 debian dhclient[863]: Failed to get interface index: No such device
Jul 14 20:59:05 debian ifup[799]: Failed to get interface index: No such device
Jul 14 20:59:05 debian ifup[799]: If you think you have received this message due to a b
Jul 14 20:59:05 debian ifup[799]: than a configuration issue please read the section on
Jul 14 20:59:05 debian ifup[799]: bugs on either our web page at www.isc.org or in the R
Jul 14 20:59:05 debian ifup[799]: before submitting a bug. These pages explain the prop
Jul 14 20:59:05 debian ifup[799]: process and the information we find helpful for debugg
Jul 14 20:59:05 debian ifup[799]: exiting.
Jul 14 20:59:05 debian dhclient[863]:
Jul 14 20:59:05 debian dhclient[863]: If you think you have received this message due to
Jul 14 20:59:05 debian dhclient[863]: than a configuration issue please read the section
Jul 14 20:59:05 debian dhclient[863]: bugs on either our web page at www.isc.org or in t
Jul 14 20:59:05 debian dhclient[863]: before submitting a bug. These pages explain the
Jul 14 20:59:05 debian dhclient[863]: process and the information we find helpful for de
Jul 14 20:59:05 debian dhclient[863]:
Jul 14 20:59:05 debian dhclient[863]: exiting.
Jul 14 20:59:05 debian ifup[799]: ifup: failed to bring up eth0</code></pre>
Run Code Online (Sandbox Code Playgroud)
怎么了?我的系统有问题吗?
潜在的问题似乎是:
Jul 14 20:59:05 debian ifup[799]: Cannot find device "eth0"
Run Code Online (Sandbox Code Playgroud)
您应该运行ip link show
以验证网络接口的名称。您的系统可能正在使用新的可预测网络接口名称,因此如果您的 NIC 内置于系统的主板中,则它可能eno1
不是经典的eth0
. 但是,如果系统固件中的 DMI 数据没有正确地将 NIC 声明为集成,则可能类似于enp#s#
其中 # 表示与 PCI 总线和 NIC 的插槽 ID 对应的数字。
由于消息来自ifup
,您显然没有使用 NetworkManager,因此如果网络接口的名称不是eth0
,则只需编辑/etc/network/interfaces
文件和/或目录中的任何文件/etc/network/interfaces.d/
以指定网络接口的正确名称来配置。
另一方面,如果ip link show
输出仅列出环回接口,如下所示:
# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Run Code Online (Sandbox Code Playgroud)
那么系统就无法自动加载正确的内核模块来驱动您的网卡。在这种情况下,输出lspci -nn
(或只是标识您的 NIC 的行)将有助于确定您的 NIC 的确切品牌和型号。