首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Ubuntu16.04LTS升级到18.04LTS(未满足的依赖项)后无法升级包

从Ubuntu16.04LTS升级到18.04LTS(未满足的依赖项)后无法升级包
EN

Ask Ubuntu用户
提问于 2022-03-06 09:55:31
回答 1查看 372关注 0票数 0

我正在linux机器上运行游戏服务器,刚刚从Ubuntu16.04LTS升级到18.04LTS。连接通过SSH (命令行)进行。

服务器重新启动很好。

我可以看到,我有310个更新,可以应用。

我用:

代码语言:javascript
复制
sudo apt-get update
sudo apt-get upgrade

在第二个命令之后,我得到了以下错误消息:

代码语言:javascript
复制
Reading package lists... 
Done Building dependency tree 
Reading state information... Done 
You might want to run ‘apt-get -f install’ to correct these. The following packages have unmet dependencies. 
grub-pc: Depends: grub-common (= 2.02-2ubuntu8.23) 
grub-pc-bin : Depends: grub-common (= 2.02-2ubuntu8.23) 
grub2-common : Depends: grub-common (= 2.02-2ubuntu8.23) 
python3-apt : Depends: libapt-inst2.0 (>= 1.6.5~) but 1.2.35 is installed
Depends: libapt-pkg5.0 (>= 1.6.5~) but 1.2.35 is installed 
systemd : Depends: libsystemd0 (= 229-4ubuntu21.31) but 237-3ubuntu10.53 is installed 
udev : Depends: libudev1 (= 229-4ubuntu21.31) but 237-3ubuntu10.53 is installed 
E: Unmet dependencies. Try using -f.

接下来,我试着:

代码语言:javascript
复制
sudo apt -f install

其结果是:

代码语言:javascript
复制
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer
required:
cgmanager fonts-ubuntu-font-family-console libcgmanager0
libcryptsetup4
libgomp1 libmpc3 libquadmath0 libsub-name-perl
linux-image-3.13.0-164-generic linux-image-extra-3.13.0-164-generic
python3.5 python3.5-minimal
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
apt apt-transport-https apt-utils grub-common libapt-inst2.0
libapt-pkg5.0
libgnutls-openssl27 libgnutls30 libidn2-0 libpam-systemd libtasn1-6
libunistring2 networkd-dispatcher systemd udev
Suggested packages:
apt-doc aptitude | synaptic | wajig dpkg-dev multiboot-doc grub-emu
xorriso
desktop-base gnutls-bin systemd-container
The following packages will be REMOVED
systemd-shim
The following NEW packages will be installed
libidn2-0 libunistring2 networkd-dispatcher
The following packages will be upgraded:
apt apt-transport-https apt-utils grub-common libapt-inst2.0
libapt-pkg5.0
libgnutls-openssl27 libgnutls30 libpam-systemd libtasn1-6 systemd
udev
12 to upgrade, 3 to newly install, 1 to remove and 366 not to upgrade.
5 not fully installed or removed.
Need to get 0 B/9,316 kB of archives.
After this operation, 2,167 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 104742 files and directories currently installed.)
Removing systemd-shim (9-1bzr4ubuntu1) ...
Removing 'diversion of /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service to /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd
by systemd-shim'
dpkg-divert: error: rename involves overwriting
'/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service'
with  different file
'/usr/share/dbus-1/system-services/org.freedesktop.systemd1.service.systemd',
not allowed
dpkg: error processing package systemd-shim (--remove):
installed systemd-shim package post-removal script subprocess
returned error exit status 2 Errors were encountered while processing:
systemd-shim
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试过各种其他命令:

代码语言:javascript
复制
sudo apt clean
sudo apt autoclean

代码语言:javascript
复制
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get install -f

我还是会犯同样的错误。

我对Linux一点也不了解(我“继承”了前一位想退休的所有者的服务器)。据我所知,我既不能升级这些软件包,也不能从18.04 LTS升级到20.04 LTS (也尝试了后者)。去20.04 LTS是我的目标。

有人知道我能做什么吗?请详细描述一下,以便我能跟随你的脚步。

谢谢!

编辑:根据guiverc的建议,我运行了sudo恰当的更新:

代码语言:javascript
复制
Hit:1 http://de.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://de.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://de.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 https://esm.ubuntu.com/infra/ubuntu bionic-infra-security InRelease [7,458 B]
Get:6 https://esm.ubuntu.com/infra/ubuntu bionic-infra-updates InRelease [7,457 B]
Fetched 267 kB in 0s (406 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
378 packages can be upgraded. Run 'apt list --upgradable' to see them.
EN

回答 1

Ask Ubuntu用户

发布于 2022-03-06 15:00:32

好吧,一个朋友帮我解决了依赖问题。我会把我们在这里做的事写下来。

首先,我们尝试手动升级所有依赖项,但是在解决了所有依赖项错误之后,在删除systemd时,包的升级仍然失败。

我们通过删除与systemd卸载相关的文件来解决这个问题:

代码语言:javascript
复制
sudo cp /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service /tmp/org.freedesktop.systemd1.service

sudo rm /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service

检查该文件是否已用

代码语言:javascript
复制
sudo ls -l /usr/share/dbus-1/system-services/org.freedesktop.systemd1.service

它应该说“没有这样的文件或目录”。

然后,我们升级了依赖项:

代码语言:javascript
复制
sudo apt-get --only-upgrade install systemd udev libpam-systemd libapt-inst2.0 libapt-pkg5.0 grub-common

安装过程中没有任何错误,但我的朋友说,只有在下次重新启动后,我们才能确定是否一切正常。因为我现在已经有球员了(我想我今天不会完成这个任务,并重新启动我们的游戏过程),我会重新启动其他时间。希望能重新打开..。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1396222

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档