Apt
無法安裝 default-jre - 包“default-jre”沒有安裝候選者
如果我輸入
java -version
我明白了
Command 'java' not found, but can be installed with: sudo apt install default-jre sudo apt install openjdk-11-jre-headless sudo apt install openjdk-8-jre-headless (You will have to enable component called 'universe')
當我嘗試
sudo apt install default-jre
我明白了
Reading package lists... Done Building dependency tree Reading state information... Done Package default-jre is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'default-jre' has no installation candidate
我已經嘗試了 apt-get update 並安裝了其他的,但是當我嘗試 openjdk 時,它說無法找到包…
編輯:
apt policy
輸出:
Package files: 100 /var/lib/dpkg/status release a=now 500 http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic/main i386 Packages release v=18.04,o=LP-PPA-mosquitto-dev-mosquitto-ppa,a=bionic,n=bionic,l=mosquitto,c=main,b=i386 origin ppa.launchpad.net 500 http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic/main amd64 Packages release v=18.04,o=LP-PPA-mosquitto-dev-mosquitto-ppa,a=bionic,n=bionic,l=mosquitto,c=main,b=amd64 origin ppa.launchpad.net 500 https://download.mono-project.com/repo/ubuntu stable-bionic/main i386 Packages release v=18.04,o=XamarinBionic,a=stable-bionic,n=bionic,l=Xamarin-Stable-Bionic,c=main,b=i386 origin download.mono-project.com 500 https://download.mono-project.com/repo/ubuntu stable-bionic/main amd64 Packages release v=18.04,o=XamarinBionic,a=stable-bionic,n=bionic,l=Xamarin-Stable-Bionic,c=main,b=amd64 origin download.mono-project.com Pinned packages:
head -n -0 /etc/apt/sources.list /etc/apt/sources.list.d/*
輸出:
==> /etc/apt/sources.list <== # deb cdrom:[Ubuntu 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. # deb-src http://ca.archive.ubuntu.com/ubuntu/ xenial main restricted ## Major bug fix updates produced after the final release of the ## distribution. # deb-src http://ca.archive.ubuntu.com/ubuntu/ xenial-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. # deb-src http://ca.archive.ubuntu.com/ubuntu/ xenial universe # deb-src http://ca.archive.ubuntu.com/ubuntu/ xenial-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. # deb-src http://ca.archive.ubuntu.com/ubuntu/ xenial multiverse # deb-src http://ca.archive.ubuntu.com/ubuntu/ xenial-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb-src http://ca.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu xenial partner # deb-src http://archive.canonical.com/ubuntu xenial partner # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted # deb-src http://security.ubuntu.com/ubuntu xenial-security universe # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse ==> /etc/apt/sources.list.d/google-chrome.list <== ### THIS FILE IS AUTOMATICALLY CONFIGURED ### # You may comment out this entry, but any other modifications may be lost. # deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main ==> /etc/apt/sources.list.d/google-chrome.list.distUpgrade <== ### THIS FILE IS AUTOMATICALLY CONFIGURED ### # You may comment out this entry, but any other modifications may be lost. deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main ==> /etc/apt/sources.list.d/google-chrome.list.save <== ### THIS FILE IS AUTOMATICALLY CONFIGURED ### # You may comment out this entry, but any other modifications may be lost. # deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main ==> /etc/apt/sources.list.d/google.list <== # deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # disabled on upgrade to bionic ==> /etc/apt/sources.list.d/google.list.distUpgrade <== deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main ==> /etc/apt/sources.list.d/google.list.save <== # deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # disabled on upgrade to bionic ==> /etc/apt/sources.list.d/mono-official-preview.list <== # deb https://download.mono-project.com/repo/ubuntu preview-xenial main ==> /etc/apt/sources.list.d/mono-official-preview.list.distUpgrade <== # deb https://download.mono-project.com/repo/ubuntu preview-xenial main ==> /etc/apt/sources.list.d/mono-official-preview.list.save <== # deb https://download.mono-project.com/repo/ubuntu preview-xenial main ==> /etc/apt/sources.list.d/mono-official-stable.list <== deb https://download.mono-project.com/repo/ubuntu stable-bionic main ==> /etc/apt/sources.list.d/mono-official-stable.list.save <== deb https://download.mono-project.com/repo/ubuntu stable-bionic main ==> /etc/apt/sources.list.d/mono-xamarin.list <== # deb http://download.mono-project.com/repo/debian wheezy main ==> /etc/apt/sources.list.d/mono-xamarin.list.distUpgrade <== # deb http://download.mono-project.com/repo/debian wheezy main ==> /etc/apt/sources.list.d/mono-xamarin.list.save <== # deb http://download.mono-project.com/repo/debian wheezy main ==> /etc/apt/sources.list.d/mosquitto-dev-ubuntu-mosquitto-ppa-bionic.list <== deb http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main # deb-src http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main # deb-src http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main # deb-src http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main ==> /etc/apt/sources.list.d/mosquitto-dev-ubuntu-mosquitto-ppa-bionic.list.save <== deb http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main # deb-src http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main # deb-src http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main # deb-src http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu bionic main ==> /etc/apt/sources.list.d/notepadqq-team-ubuntu-notepadqq-xenial.list <== # deb http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial main # deb-src http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial main ==> /etc/apt/sources.list.d/notepadqq-team-ubuntu-notepadqq-xenial.list.distUpgrade <== # deb http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial main # deb-src http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial main ==> /etc/apt/sources.list.d/notepadqq-team-ubuntu-notepadqq-xenial.list.save <== # deb http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial main # deb-src http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial main ==> /etc/apt/sources.list.d/skype-stable.list <== # deb [arch=amd64] https://repo.skype.com/deb stable main ==> /etc/apt/sources.list.d/skype-stable.list.distUpgrade <== # deb [arch=amd64] https://repo.skype.com/deb stable main ==> /etc/apt/sources.list.d/skype-stable.list.save <== # deb [arch=amd64] https://repo.skype.com/deb stable main ==> /etc/apt/sources.list.d/teamviewer.list <== ### TeamViewer DEB repository list ### NOTE: Manual changes to this file ### - prevent it from being updated by TeamViewer package updates ### - will be lost after using the 'teamviewer repo' command ### The original file can be restored with this command: ### cp /opt/teamviewer/tv_bin/script/teamviewer.list /etc/apt/sources.list.d/teamviewer.list ### which has the same effect as 'teamviewer repo default' ### NOTE: It is preferred to use the following commands to edit this file: ### teamviewer repo - show current repository configuration ### teamviewer repo default - restore default configuration ### teamviewer repo disable - disable the repository ### teamviewer repo main [stable] - make all TeamViewer packages available (default) ### teamviewer repo tv14 [stable] - make TeamViewer 14 packages available ### stable omit preview and beta releases ### Choose stable main to receive updates for TeamViewer 14 and upcoming major releases ### Choose preview main to receive early updates for TeamViewer 14 and to receive major beta releases ### Choose stable tv14 to receive updates for TeamViewer 14 ### Choose preview tv14 to receive early updates for TeamViewer 14 # deb http://linux.teamviewer.com/deb stable main # deb http://linux.teamviewer.com/deb preview main # deb http://linux.teamviewer.com/deb stable tv14 # deb http://linux.teamviewer.com/deb preview tv14 ==> /etc/apt/sources.list.d/teamviewer.list.save <== ### TeamViewer DEB repository list ### NOTE: Manual changes to this file ### - prevent it from being updated by TeamViewer package updates ### - will be lost after using the 'teamviewer repo' command ### The original file can be restored with this command: ### cp /opt/teamviewer/tv_bin/script/teamviewer.list /etc/apt/sources.list.d/teamviewer.list ### which has the same effect as 'teamviewer repo default' ### NOTE: It is preferred to use the following commands to edit this file: ### teamviewer repo - show current repository configuration ### teamviewer repo default - restore default configuration ### teamviewer repo disable - disable the repository ### teamviewer repo main [stable] - make all TeamViewer packages available (default) ### teamviewer repo tv14 [stable] - make TeamViewer 14 packages available ### stable omit preview and beta releases ### Choose stable main to receive updates for TeamViewer 14 and upcoming major releases ### Choose preview main to receive early updates for TeamViewer 14 and to receive major beta releases ### Choose stable tv14 to receive updates for TeamViewer 14 ### Choose preview tv14 to receive early updates for TeamViewer 14 # deb http://linux.teamviewer.com/deb stable main # deb http://linux.teamviewer.com/deb preview main # deb http://linux.teamviewer.com/deb stable tv14 # deb http://linux.teamviewer.com/deb preview tv14 ==> /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-xenial.list <== # deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main # deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main ==> /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-xenial.list.distUpgrade <== # deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main # deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main ==> /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-xenial.list.save <== # deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main # deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main ==> /etc/apt/sources.list.d/webupd8team-ubuntu-java-bionic.list <== ==> /etc/apt/sources.list.d/webupd8team-ubuntu-java-bionic.list.save <==
看起來您從 16.04 到 18.04 的升級沒有正確完成,並且您的儲存庫配置大部分都被註釋掉了。
要修復 Ubuntu 儲存庫,請進行編輯
/etc/apt/sources.list
,使其包含deb http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse deb http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
然後執行
apt update
,你應該可以安裝default-jre
.您還應該查看您的所有文件
/etc/apt/sources.list.d
;如果.list.distUpgrade
文件看起來不錯,請重命名它們以刪除該.distUpgrade
部分。