Ubuntu

Chromium 瀏覽器未安裝

  • November 1, 2020

要安裝 Chromium 瀏覽器,我輸入:

sudo apt install chromium-browser

但後來我得到了幾個錯誤。之後發生的情況如下:

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:
chromium-browser : Depends: libnss3 (>= 2:3.22) but 2:3.21-1ubuntu4 is to be installed
                   Depends: chromium-codecs-ffmpeg-extra (= 86.0.4240.75-0ubuntu0.16.04.1) but 76.0.3809.100-0ubuntu0.16.04.1 is to be installed or
                            chromium-codecs-ffmpeg (= 86.0.4240.75-0ubuntu0.16.04.1) but it is not going to be installed
                   Recommends: chromium-browser-l10n but it is not going to be installed
google-chrome-stable:amd64 : Depends: libasound2:amd64 (>= 1.0.16)
                             Depends: libatk-bridge2.0-0:amd64 (>= 2.5.3) but it is not going to be installed
                             Depends: libatk1.0-0:amd64 (>= 2.2.0) but it is not going to be installed
                             Depends: libatspi2.0-0:amd64 (>= 2.9.90) but it is not going to be installed
                             Depends: libcairo2:amd64 (>= 1.6.0) but it is not going to be installed
                             Depends: libcups2:amd64 (>= 1.4.0) but it is not going to be installed
                             Depends: libdrm2:amd64 (>= 2.4.38) but it is not going to be installed
                             Depends: libexpat1:amd64 (>= 2.0.1) but it is not going to be installed
                             Depends: libgbm1:amd64 (>= 8.1~0) but it is not going to be installed
                             Depends: libgdk-pixbuf2.0-0:amd64 (>= 2.22.0) but it is not going to be installed
                             Depends: libgtk-3-0:amd64 (>= 3.9.10) but it is not going to be installed
                             Depends: libnspr4:amd64 (>= 2:4.9-2~) but it is not going to be installed
                             Depends: libnss3:amd64 (>= 2:3.22) but it is not going to be installed
                             Depends: libpango-1.0-0:amd64 (>= 1.14.0) but it is not going to be installed
                             Depends: libpangocairo-1.0-0:amd64 (>= 1.14.0) but it is not going to be installed
                             Depends: libx11-6:amd64 (>= 2:1.4.99.1) but it is not going to be installed
                             Depends: libx11-xcb1:amd64 but it is not going to be installed
                             Depends: libxcb-dri3-0:amd64 but it is not going to be installed
                             Depends: libxcb1:amd64 (>= 1.9.2) but it is not going to be installed
                             Depends: libxcomposite1:amd64 (>= 1:0.3-1) but it is not going to be installed
                             Depends: libxdamage1:amd64 (>= 1:1.1) but it is not going to be installed
                             Depends: libxext6:amd64 but it is not going to be installed
                             Depends: libxfixes3:amd64 but it is not going to be installed
                             Depends: libxrandr2:amd64 but it is not going to be installed
                             Recommends: libu2f-udev:amd64 but it is not installable
                             Recommends: libvulkan1:amd64 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

請幫忙。

這不是 Chromium 專門提供的答案,而是針對此類問題的一般答案。

當源或套件開始與 apt 混合時,就會出現此問題。假設您嘗試安裝chromium-browser. Ubuntubionic套件發布版本86.0.4240.75-0ubuntu0.18.04.1.

當您嘗試 installchromium-browser時,您會看到如下所示的一行:

Depends: 
 chromium-codecs-ffmpeg-extra (= 86.0.4240.75-0ubuntu0.16.04.1) 
                             but 76.0.3809.100-0ubuntu0.16.04.1 is to be installed
or
 chromium-codecs-ffmpeg (= 86.0.4240.75-0ubuntu0.16.04.1) 
                             but it is not going to be installed

答對了!

這意味著您的/etc/apt/sources.list/etc/apt/sources.list.d/*包含提供不同版本鉻的來源。

在查看官方 ubuntu 儲存庫時,我發現了以下版本:

  • 仿生:86.0.4240.75-0ubuntu0.16.04.1
  • 外部更新:86.0.4240.75-0ubuntu0.16.04.1
  • xenial:49.0.2623.108-0ubuntu1.1233

由於您的版本介於 xenial 和 xenial-updates 之間,因此您似乎在非官方儲存庫中找到了該軟體包。這可能是由添加 PPA 或來自其他發行版的源引起的問題。

這是我對發生的事情的猜測:

  1. 你有一個更新的 apt 發布文件,其中包含來自官方 ubuntu 檔案的所有最新軟體包,但你也有一個 PPA 沒有維護,並且與官方檔案不同步。
  2. 使用時apt install chromium-browser,在套件apt中找到首選版本。bionic
  3. Apt 嘗試安裝該chromium-codecs-ffmpeg-extra or chromium-codecs-ffmpeg軟體包。它發現的最高優先級命中來自這個未維護的 PPA。通常選擇找到的最高版本,但在這種情況下,此 PPA 優先。這可能是因為固定,或者您xenial為該 PPA 選擇了源並且在您的電腦上xenial具有優先權。bionic
  4. apt您的優先源中找到此版本時,它會失敗,因為該版本無法滿足依賴項要求。

請參閱不要製作 FrankenDebian,了解為什麼添加不兼容的源是一個壞主意。

解決方案是清理你的/etc/apt/sources.listand /etc/apt/sources.list.d/*

  1. 如果您正在使用bionic刪除與其他版本相關的所有行(bionic-security和除外bionic-updates)。
  2. 如果您使用的是 PPA,請確保您確實需要該 PPA 中的某些內容。否則刪除 PPA。如果 PPA 只是擁有更新版本的軟體:不要患上閃亮的新東西綜合症。PPA 不是受信任的來源,可以包含任何內容。它們也可能隨時變得無人維護。在您的官方版本中獲取最新版本。

引用自:https://unix.stackexchange.com/questions/616825