LoginSignup
1
0

More than 1 year has passed since last update.

UbuntuでUnable to locate packageの解決法

Last updated at Posted at 2023-01-21

シェルスクリプトの勉強中に少々躓いた箇所があったので、以下に解決法を記載する。

◆作業環境
Windows 11

◆実行内容
最初にfingerコマンドを試し打ちしてみた。

$ finger
Command 'finger' not found, but can be installed with:
sudo apt install finger

最初はインストールされていないだけかと思いきや、違った。

$ sudo apt install finger
[sudo] password for user:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package finger 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 'finger' has no installation candidate

ちなみにtreeコマンドを実行してみても同じような結果だった。

$ tree
Command 'tree' not found, but can be installed with:
sudo apt install tree

インストールを試みてみたが結果は同じ。

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

最終的にはapt自体をアップデートすることが必要だったことが発覚。

$ sudo apt update
(中略)
22 packages can be upgraded. Run 'apt list --upgradable' to see them.

aptのupdateを実行した結果、fingerコマンドもtreeコマンドも使えるようになった。

◆後書き

せっかくなのでaptコマンドについても調べてみた。
結果を以下にて要約。

・aptコマンドはパッケージ管理コマンドである。
・そもそもaptコマンドはAPTの操作をするコマンドである。
・更に掘り下げると、APTはLinuxのソフトウェアの導入や管理、削除に用いられるパッケージ管理システムの一つ。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0