Ubuntu apt 不工作

Ubuntu apt 不工作

每当我尝试在 Ubuntu linux(版本 20.04.1 LTS)上使用 apt 安装某些东西时,我总是收到此错误消息:

E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

当我尝试运行时 sudo apt --fix-broken install出现此错误:

buntu@ubuntu1:~$ 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-mutter-6 gnome-startup-applications humanity-icon-theme
  libasn1-8-heimdal libgssapi3-heimdal libgstreamer-plugins-good1.0-0
  libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal
  libhx509-5-heimdal libkrb5-26-heimdal libmozjs-68-0 libroken18-heimdal
  libwind0-heimdal session-migration ubuntu-mono
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libgstreamer-plugins-bad1.0-0
The following packages will be upgraded:
  libgstreamer-plugins-bad1.0-0
1 to upgrade, 0 to newly install, 0 to remove and 1078 not to upgrade.
192 not fully installed or removed.
Need to get 2,278 kB of archives.
After this operation, 2,230 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://kali.download/kali kali-rolling/main amd64 libgstreamer-plugins-bad1.0-0 amd64 1.18.0-2+b1 [2,278 kB]
Fetched 2,278 kB in 1s (2,652 kB/s)                   
(Reading database ... 225910 files and directories currently installed.)
Preparing to unpack .../libgstreamer-plugins-bad1.0-0_1.18.0-2+b1_amd64.deb ...
Unpacking libgstreamer-plugins-bad1.0-0:amd64 (1.18.0-2+b1) over (1.16.2-2.1ubun
tu1) ...
dpkg: error processing archive /var/cache/apt/archives/libgstreamer-plugins-bad1
.0-0_1.18.0-2+b1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libgstbasecamerabinsrc-1.0.so.0'
, which is also in package libgstreamer-plugins-good1.0-0:amd64 1.16.2-1ubuntu2
Errors were encountered while processing:
 /var/cache/apt/archives/libgstreamer-plugins-bad1.0-0_1.18.0-2+b1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
ubuntu@ubuntu1:~$ 

问题是,这个错误似乎在网上有很好的记录,有很多解决方案,但似乎都不起作用,在过去的 3 个小时里我一直在尝试很多方法,但没有一个起作用,所以我决定在这里询问。

sudo apt-get update有趣的是,当我尝试运行并收到这条非常长的消息时,我得到的输出:

ubuntu@ubuntu1:~$ sudo apt-get update
Hit:1 http://gb.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://gb.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]   
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:5 http://kali.download/kali kali-rolling InRelease                 
Fetched 214 kB in 1s (263 kB/s)
Reading package lists... Done
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target Translations (main/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target DEP-11-icons-hidpi (main/dep11/[email protected]) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:59 and /etc/apt/sources.list:61

这只是控制台给我的输出的一小部分,因为它太大而无法提出堆栈交换问题

答案1

首先要做的就是kali-rolling从你的中删除sources.list,因为它会破坏你的apt然后运行:

sudo apt update

下一步,使用--force-overwrite选项强制安装包:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/libgstreamer-plugins-bad1.0-0_1.18.0-2+b1_amd64.deb

其次是:

sudo apt install -f
sudo apt update
sudo apt upgrade

相关内容