Ubuntu

Ubuntu18.04 apt install で E: Unable to locate package ~ と言われた

aptコマンドでパッケージをインストールしようとしたら、今まであまり見たことのないエラーが出た。

$ sudo apt install fwlogwatch
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package fwlogwatch

 



広告


Ubuntuのリポジトリは4種類あり、今回触っているシステムは必要なリポジトリを参照する設定になっていないようだ。
TechTok / Ubuntu 18.04のapt installで”Unable to locate package”のエラーはsources.listを編集して解決できる(リンク切れのためアーカイブへ)

 

原因

fwlogwatchパッケージはどの種類なのかというと、[universe]だ
ubuntu packages / bionicのfwlogwatch

リポジトリにuniverseが入っていないのか見てみると…
/etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu bionic main
deb http://archive.ubuntu.com/ubuntu bionic-security main
deb http://archive.ubuntu.com/ubuntu bionic-updates main

 

確かに入っていない。

2020/10/04 追記
この指定が何を表しているのか、というところは後日確認している。

 

解決方法

以下のコマンドでuniverseを追加できた。
It’s FOSS / What are Ubuntu Repositories? How to enable or disable them?

$ sudo add-apt-repository universe
'universe' distribution component enabled for all sources
Hit:1 http://repo.zabbix.com/zabbix/4.0/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8,570 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4,941 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [652 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [216 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [889 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,059 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [328 kB]
Fetched 16.8 MB in 24s (690 kB/s)
Reading package lists... Done

※参照先にはupdateするように書かれていたけど、add-apt-repositoryはフォローしてくれているように見える。

コマンド実行の結果、sources.listには以下が追加された。
/etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe

 

これでfwlogwatchをインストールできるようになった。

 

その他 1

universeを外すときはこれ。

$ sudo add-apt-repository -r universe

 

 

その他 2

リポジトリの種類についてもう少し詳しく書かれていた。
あらラボ / リポジトリ:Ubuntu編

 

広告
ろっひー

コメントはこちらから お気軽にどうぞ ~ 投稿に関するご意見・感想・他