![sudo apt-get 问题(只能使用 sudo apt-get update)](https://linux22.com/image/1024590/sudo%20apt-get%20%E9%97%AE%E9%A2%98%EF%BC%88%E5%8F%AA%E8%83%BD%E4%BD%BF%E7%94%A8%20sudo%20apt-get%20update%EF%BC%89.png)
我只能这样做sudo apt-get update
,其他任何事情都会给我带来错误。
sudo apt-get update 的输出:
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.canonical.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,260 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [545 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [283 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [865 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [361 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [24.7 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/multiverse i386 Packages [8,252 B]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B]
Get:14 http://archive.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [29.1 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [62.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [10.4 kB]
Fetched 3,781 kB in 9s (414 kB/s)
Reading package lists... Done
操作系统:Ubuntu 20.04.3 - Focal 我尝试了所有方法来安装这些依赖项,但都无济于事。
sudo apt install -f 的输出:
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:
gir1.2-playerctl-1.0 libplayerctl-1.0-0
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
gir1.2-playerctl-2.0
The following NEW packages will be installed:
gir1.2-playerctl-2.0
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/4,224 B of archives.
After this operation, 24.6 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
dpkg: warning: files list file for package 'libplayerctl2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libplayerctl-1.0-0:amd64' missing; assuming package has no files currently installed
(Reading database ... 282830 files and directories currently installed.)
Preparing to unpack .../gir1.2-playerctl-2.0_2.0.2-1_amd64.deb ...
Unpacking gir1.2-playerctl-2.0:amd64 (2.0.2-1) ...
dpkg: error processing archive /var/cache/apt/archives/gir1.2-playerctl-2.0_2.0.2-1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/girepository-1.0/Playerctl-2.0.typelib', which is also in package gir1.2-playerctl-1.0:amd64 2.0.2-1ubuntu1~ppa2
Errors were encountered while processing:
/var/cache/apt/archives/gir1.2-playerctl-2.0_2.0.2-1_amd64.deb
sudo apt-get upgrade 的输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libplayerctl-dev : Depends: gir1.2-playerctl-2.0 (= 2.0.2-1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
sudo apt --fix-broken install 的输出:
roolz@roolz:~$ sudo apt --fix-broken install
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:
gir1.2-playerctl-1.0 libplayerctl-1.0-0
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
gir1.2-playerctl-2.0
The following NEW packages will be installed:
gir1.2-playerctl-2.0
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/4,224 B of archives.
After this operation, 24.6 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
dpkg: warning: files list file for package 'libplayerctl2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libplayerctl-1.0-0:amd64' missing; assuming package has no files currently installed
(Reading database ... 282830 files and directories currently installed.)
Preparing to unpack .../gir1.2-playerctl-2.0_2.0.2-1_amd64.deb ...
Unpacking gir1.2-playerctl-2.0:amd64 (2.0.2-1) ...
dpkg: error processing archive /var/cache/apt/archives/gir1.2-playerctl-2.0_2.0.2-1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/girepository-1.0/Playerctl-2.0.typelib', which is also in package gir1.2-playerctl-1.0:amd64 2.0.2-1ubuntu1~ppa2
Errors were encountered while processing:
/var/cache/apt/archives/gir1.2-playerctl-2.0_2.0.2-1_amd64.deb
答案1
问题似乎在输出中清楚地说明:
dpkg: error processing archive /var/cache/apt/archives/gir1.2-playerctl-2.0_2.0.2-1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/girepository-1.0/Playerctl-2.0.typelib', which is also in package gir1.2-playerctl-1.0:amd64 2.0.2-1ubuntu1~ppa2
让我们详细分析一下:
dpkg: error processing archive X (--unpack):
trying to overwrite Y, which is also in package Z
X = /var/cache/apt/archives/gir1.2-playerctl-2.0_2.0.2-1_amd64.deb
Y = '/usr/lib/x86_64-linux-gnu/girepository-1.0/Playerctl-2.0.typelib'
Z = gir1.2-playerctl-1.0:amd64 2.0.2-1ubuntu1~ppa2
X 和 Z 都尝试提供文件 Y。在这种情况下,卸载包 Z 即可解决冲突。
sudo apt remove gir1.2-playerctl-1.0:amd64