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.listapt

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

おすすめ記事