好的,所以这是从 16.04.1 LTS 升级到 18.04.1 LTS,服务器是无头的。升级完成并重新启动完成后,会发生以下情况:
尝试升级软件包只会导致以下结果:
~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
policykit-1 screen smartmontools
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,081 kB of archives.
After this operation, 147 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 159133 files and directories currently installed.)
Preparing to unpack .../smartmontools_6.5+svn4324-1_amd64.deb ...
Failed to connect to bus: No such file or directory
[...]
它正在谈论的是Dbus吗?无论如何,恢复怎么样?
~$ sudo apt update
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://se.archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'se.archive.ubuntu.com'
Err:3 http://se.archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving 'se.archive.ubuntu.com'
Err:4 http://se.archive.ubuntu.com/ubuntu bionic-backports InRelease
Temporary failure resolving 'se.archive.ubuntu.com'
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
W: Failed to fetch http://se.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'se.archive.ubuntu.com'
W: Failed to fetch http://se.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'se.archive.ubuntu.com'
W: Failed to fetch http://se.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'se.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
什么?dns坏了吗?
~$ wget www.google.com
--2018-11-10 01:55:16-- http://www.google.com/
Resolving www.google.com (www.google.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘www.google.com’
看起来像。嗯,ifconfig 不显示 dns。谷歌引导我回答这个问题,让我们试试。
~$ systemd-resolve --status
sd_bus_open_system: No such file or directory
好吧,我现在越来越迷茫了。谷歌现在发现这个问题,是关于docker的,这不是我的情况,但也提到了systemd isnt pid 1的问题:
~$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.1 0.1 159752 9116 ? Ss 01:25 0:02 /sbin/init splash nomdmonddf nomdmonisw
root 2 0.0 0.0 0 0 ? S 01:25 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 01:25 0:00 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< 01:25 0:00 [kworker/0:0H]
root 7 0.0 0.0 0 0 ? S 01:25 0:00 [rcu_sched]
root 8 0.0 0.0 0 0 ? S 01:25 0:00 [rcu_bh]
root 9 0.0 0.0 0 0 ? S 01:25 0:00 [migration/0]
root 10 0.0 0.0 0 0 ? S 01:25 0:00 [watchdog/0]
root 11 0.0 0.0 0 0 ? S 01:25 0:00 [watchdog/1]
[...]
我猜?这是根本问题,还是症状?我怎样才能解决这个问题?
升级到 18.04.01 后,我在一台 OVH VPS 服务器上遇到了同样的错误。升级后我有其他非常相似的服务器工作正常,这帮助我解决了这个问题。
走进一个兔子洞,注意到:
这导致我到这个网站: https ://forum.proxmox.com/threads/systemd-logind-failures.44219/
我确认我的 /var/run 没有符号链接到 /run ,它在其他服务器上。这个在两个地方都有文件。
我几乎按照建议进行了符号链接,修复了每一行中的“目录不为空”错误:
此步骤解决了部分问题,例如:
但是 DNS 解析仍然失败,但使用解析可以正常工作:
根据https://superuser.com/questions/1317623/nslookup-failed-but-systemd-resolved-works中的建议
我将 /etc/resolv.conf 符号链接从更改
/run/resolvconf/resolv.conf
为/run/systemd/resolve/resolv.conf
现在一切正常。