启动Debian 10错误:networking.service加载失败

启动Debian 10错误:networking.service加载失败

我注意到每次打开电脑时都会出现一条红线。我的电脑速度很快,所以我无法阅读问题。我没有遇到或注意到我的系统有任何问题,但我很好奇。

我已经运行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'.

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>

怎么了?我的系统有什么问题吗?

答案1

根本问题似乎是:

Jul 14 20:59:05 debian ifup[799]: Cannot find device "eth0"

您应该运行ip link show来验证网络接口的名称。您的系统可能正在使用新的可预测网络接口名称,因此如果您的 NIC 内置于系统主板中,则它可能会eno1取代经典的eth0.但是,如果系统固件中的 DMI 数据未正确将 NIC 声明为集成的,则可能类似于enp#s#其中 # 代表与 NIC 的 PCI 总线和插槽 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

那么系统就无法自动加载正确的内核模块来驱动你的网卡。在这种情况下,输出lspci -nn(或只是识别您的 NIC 的行)将有助于识别您的 NIC 的确切品牌和型号。

答案2

用户 telcoM 的 greping for 的建议以太网0当我遇到这个问题时帮助我解决了。在文件 /etc/network/interfaces.d/setup 中,我找到了两个引用以太网0并将它们更改为enp0s3,这是我正在使用的系统上的以太网接口(Debian 10.0 在 VirtualBox 的 Intel PRO/1000 MT 桌面适配器上运行。)

该文件的内容现在如下所示:

自动定位
iface lo inet环回

# 自动 eth0
# 自动 eth0 inet dhcp
自动 enp0s3
iface enp0s3 inet dhcp

希望这对其他人有用。谢谢,电信!

相关内容