昨天我启动计算机时出现了以下错误消息:
我正在寻找解决方案并偶然发现了这个论坛讨论: https://ubuntuforums.org/showthread.php?t=2326216
因此,我按照某人的建议,从 grub 启动菜单启动到恢复模式,然后尝试运行$ sudo apt-get update
。
这就是我开始遇到困难的地方。我无法让计算机连接到互联网。
$ ping google.com
只是给我ping: unknown host google.com
因此我尝试运行$ sudo dhclient eth0
但它返回此错误消息:
run-parts: failed to stat component /etc/dhcp/dhclient-enter-hooks.d/debug: No such file or directory
run-parts: failed to stat component /etc/dhcp/dhclient-exit-hooks.d/debug: No such file or directory
run-parts: failed to stat component /etc/dhcp/dhclient-enter-hooks.d/debug: No such file or directory
RTNETLINK answers: File exists
run-parts: failed to stat component /etc/dhcp/dhclient-exit-hooks.d/debug: No such file or directory
我怎样才能解决这个问题?
编辑:journalctl | grep modules
给我:
systemd-modules-load[214]: Inserted module 'lp'
systemd-modules-load[214]: Inserted module 'ppdev'
systemd-modules-load[214]: Inserted module 'parport_pc'
systemd-modules-load[214]: Failed to find module 'rtc'
systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status1/FAILURE
systemd[1]: systemd-modules-load.service: Unit entered failed state
systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'
答案1
OP 解决了他们的问题如下:
[FAILED] Failed to start Load Kernel Modules
是转移注意力的借口。rtc
是过时的模块。通过切换到 tty1 (ctrl+alt+F1) 并注释掉rtc
(放在#
行首) /etc/modules
(使用 sudoedit),可以删除错误消息。
现在计算机启动时只会显示一个空白屏幕。
然后,我再次在 tty1 中尝试连接到互联网,但却sudo dhclient eth0
出现了以下错误消息:
failed to stat component /etc/dhcp/dhclient-enter-hooks.d/debug: No such file or directory
failed to stat component /etc/dhcp/dhclient-exit-hooks.d/debug: No such file or directory
事实证明,损坏的符号链接是造成这一问题的原因,因此要修复它:
cd /etc/dhcp/dhclient-enter-hooks.d
sudo rm debug
sudo ln -s ../debug.dbkg-new debug`
进而
cd /etc/dhcp/dhclient-exit-hooks.d
sudo rm debug
sudo ln -s ../debug.dbkg-new debug
那么就可以做到sudo dhclient eth0
ping google.com
返回unknown host google.com
但工作正常,因此按照steeldriver的建议ping 8.8.8.8
修复了这个问题echo 'nameserver 8.8.8.8' | sudo tee /etc/resolv.conf
此评论
最后连接互联网后,所有问题都通过运行以下命令得到解决:
sudo apt-get update
dpkg --configure -a
sudo apt full-upgrade -f
sudo apt -f install