【E: Unable to locate package】対処方法
目次
はじめに
環境
- Windows
- WSL2上のDebian
状況
sudo apt install ssh
Reading package lists… Done Building dependency tree Reading state information… Done E: Unable to locate package ssh
- sshをインストール
- エラー発生
- sshのパッケージを参照できません:「E: Unable to locate package ssh」
対処方法
原因
- aptのパッケージリストが更新されていなかった
- WSLのDebianだから?
- 補足
- Windows環境にWSL2-Debianをインストールした時の手順
対処コマンド
sudo apt-get update
- aptのパッケージリスト更新
- その後apt installする
- 以降の実行ログに手順詳細と経過を記載した
実行ログ
aptのパッケージリスト更新
更新前
apt list
apt list|wc -l
$ apt list Listing... Done adduser/now 3.115 all [installed,local] apt/now 1.4.8 amd64 [installed,local] apt-utils/now 1.4.8 amd64 [installed,local] base-files/now 9.9+deb9u5 amd64 [installed,local] base-passwd/now 3.5.43 amd64 [installed,local] bash/now 4.4-5 amd64 [installed,local] bsdmainutils/now 9.0.12+nmu1 amd64 [installed,local] bsdutils/now 1:2.29.2-1+deb9u1 amd64 [installed,local] coreutils/now 8.26-3 amd64 [installed,local] cpio/now 2.11+dfsg-6 amd64 [installed,local] cron/now 3.0pl1-128+deb9u1 amd64 [installed,local] dash/now 0.5.8-2.4 amd64 [installed,local] debconf/now 1.5.61 all [installed,local] debconf-i18n/now 1.5.61 all [installed,local] debian-archive-keyring/now 2017.5 all [installed,local] debianutils/now 4.8.1.1 amd64 [installed,local] diffutils/now 1:3.5-3 amd64 [installed,local] dmidecode/now 3.0-4 amd64 [installed,local] dmsetup/now 2:1.02.137-2 amd64 [installed,local] dpkg/now 1.18.25 amd64 [installed,local] e2fslibs/now 1.43.4-2 amd64 [installed,local] e2fsprogs/now 1.43.4-2 amd64 [installed,local] findutils/now 4.6.0+git+20161106-2 amd64 [installed,local] gcc-6-base/now 6.3.0-18+deb9u1 amd64 [installed,local] gnupg/now 2.1.18-8~deb9u2 amd64 [installed,local] gnupg-agent/now 2.1.18-8~deb9u2 amd64 [installed,local] gpgv/now 2.1.18-8~deb9u2 amd64 [installed,local] grep/now 2.27-2 amd64 [installed,local] gzip/now 1.6-5+b1 amd64 [installed,local] hostname/now 3.18+b1 amd64 [installed,local] ifupdown/now 0.8.19 amd64 [installed,local] init/now 1.48 amd64 [installed,local] init-system-helpers/now 1.48 all [installed,local] iproute2/now 4.9.0-1+deb9u1 amd64 [installed,local] iptables/now 1.6.0+snapshot20161117-6 amd64 [installed,local] iputils-ping/now 3:20161105-1 amd64 [installed,local] isc-dhcp-client/now 4.3.5-3+deb9u1 amd64 [installed,local] isc-dhcp-common/now 4.3.5-3+deb9u1 amd64 [installed,local] kmod/now 23-2 amd64 [installed,local] libacl1/now 2.2.52-3+b1 amd64 [installed,local] libapparmor1/now 2.11.0-3+deb9u2 amd64 [installed,local] libapt-inst2.0/now 1.4.8 amd64 [installed,local] libapt-pkg5.0/now 1.4.8 amd64 [installed,local] libassuan0/now 2.4.3-2 amd64 [installed,local] libattr1/now 1:2.4.47-2+b2 amd64 [installed,local] libaudit-common/now 1:2.6.7-2 all [installed,local] libaudit1/now 1:2.6.7-2 amd64 [installed,local] libblkid1/now 2.29.2-1+deb9u1 amd64 [installed,local] libbsd0/now 0.8.3-1 amd64 [installed,local] libbz2-1.0/now 1.0.6-8.1 amd64 [installed,local] libc-bin/now 2.24-11+deb9u3 amd64 [installed,local] libc-l10n/now 2.24-11+deb9u3 all [installed,local] libc6/now 2.24-11+deb9u3 amd64 [installed,local] libcap-ng0/now 0.7.7-3+b1 amd64 [installed,local] libcap2/now 1:2.25-1 amd64 [installed,local] libcomerr2/now 1.43.4-2 amd64 [installed,local] libcryptsetup4/now 2:1.7.3-4 amd64 [installed,local] libdb5.3/now 5.3.28-12+deb9u1 amd64 [installed,local] libdebconfclient0/now 0.227 amd64 [installed,local] libdevmapper1.02.1/now 2:1.02.137-2 amd64 [installed,local] libdns-export162/now 1:9.10.3.dfsg.P4-12.3+deb9u4 amd64 [installed,local] libelf1/now 0.168-1 amd64 [installed,local] libestr0/now 0.1.10-2 amd64 [installed,local] libfastjson4/now 0.99.4-1 amd64 [installed,local] libfdisk1/now 2.29.2-1+deb9u1 amd64 [installed,local] libffi6/now 3.2.1-6 amd64 [installed,local] libgcc1/now 1:6.3.0-18+deb9u1 amd64 [installed,local] libgcrypt20/now 1.7.6-2+deb9u3 amd64 [installed,local] libgmp10/now 2:6.1.2+dfsg-1 amd64 [installed,local] libgnutls30/now 3.5.8-5+deb9u3 amd64 [installed,local] libgpg-error0/now 1.26-2 amd64 [installed,local] libhogweed4/now 3.3-1+b2 amd64 [installed,local] libidn11/now 1.33-1 amd64 [installed,local] libidn2-0/now 0.16-1+deb9u1 amd64 [installed,local] libip4tc0/now 1.6.0+snapshot20161117-6 amd64 [installed,local] libip6tc0/now 1.6.0+snapshot20161117-6 amd64 [installed,local] libiptc0/now 1.6.0+snapshot20161117-6 amd64 [installed,local] libisc-export160/now 1:9.10.3.dfsg.P4-12.3+deb9u4 amd64 [installed,local] libkmod2/now 23-2 amd64 [installed,local] libksba8/now 1.3.5-2 amd64 [installed,local] liblocale-gettext-perl/now 1.07-3+b1 amd64 [installed,local] liblogging-stdlog0/now 1.0.5-2+b2 amd64 [installed,local] liblognorm5/now 2.0.1-1.1+b1 amd64 [installed,local] liblz4-1/now 0.0~r131-2+b1 amd64 [installed,local] liblzma5/now 5.2.2-1.2+b1 amd64 [installed,local] libmnl0/now 1.0.4-2 amd64 [installed,local] libmount1/now 2.29.2-1+deb9u1 amd64 [installed,local] libncurses5/now 6.0+20161126-1+deb9u2 amd64 [installed,local] libncursesw5/now 6.0+20161126-1+deb9u2 amd64 [installed,local] libnetfilter-conntrack3/now 1.0.6-2 amd64 [installed,local] libnettle6/now 3.3-1+b2 amd64 [installed,local] libnewt0.52/now 0.52.19-1+b1 amd64 [installed,local] libnfnetlink0/now 1.0.1-3 amd64 [installed,local] libnpth0/now 1.3-1 amd64 [installed,local] libp11-kit0/now 0.23.3-2 amd64 [installed,local] libpam-modules/now 1.1.8-3.6 amd64 [installed,local] libpam-modules-bin/now 1.1.8-3.6 amd64 [installed,local] libpam-runtime/now 1.1.8-3.6 all [installed,local] libpam0g/now 1.1.8-3.6 amd64 [installed,local] libpcre3/now 2:8.39-3 amd64 [installed,local] libpopt0/now 1.16-10+b2 amd64 [installed,local] libprocps6/now 2:3.3.12-3+deb9u1 amd64 [installed,local] libpsl5/now 0.17.0-3 amd64 [installed,local] libreadline7/now 7.0-3 amd64 [installed,local] libseccomp2/now 2.3.1-2.1 amd64 [installed,local] libselinux1/now 2.6-3+b3 amd64 [installed,local] libsemanage-common/now 2.6-2 all [installed,local] libsemanage1/now 2.6-2 amd64 [installed,local] libsepol1/now 2.6-2 amd64 [installed,local] libslang2/now 2.3.1-5 amd64 [installed,local] libsmartcols1/now 2.29.2-1+deb9u1 amd64 [installed,local] libsqlite3-0/now 3.16.2-5+deb9u1 amd64 [installed,local] libss2/now 1.43.4-2 amd64 [installed,local] libssl1.0.2/now 1.0.2l-2+deb9u3 amd64 [installed,local] libstdc++6/now 6.3.0-18+deb9u1 amd64 [installed,local] libsystemd0/now 232-25+deb9u4 amd64 [installed,local] libtasn1-6/now 4.10-1.1+deb9u1 amd64 [installed,local] libtext-charwidth-perl/now 0.04-7+b5 amd64 [installed,local] libtext-iconv-perl/now 1.7-5+b4 amd64 [installed,local] libtext-wrapi18n-perl/now 0.06-7.1 all [installed,local] libtinfo5/now 6.0+20161126-1+deb9u2 amd64 [installed,local] libudev1/now 232-25+deb9u4 amd64 [installed,local] libunistring0/now 0.9.6+really0.9.3-0.1 amd64 [installed,local] libustr-1.0-1/now 1.0.4-6 amd64 [installed,local] libuuid1/now 2.29.2-1+deb9u1 amd64 [installed,local] libxtables12/now 1.6.0+snapshot20161117-6 amd64 [installed,local] locales/now 2.24-11+deb9u3 all [installed,local] login/now 1:4.4-4.1 amd64 [installed,local] logrotate/now 3.11.0-0.1 amd64 [installed,local] lsb-base/now 9.20161125 all [installed,local] mawk/now 1.3.3-17+b3 amd64 [installed,local] mount/now 2.29.2-1+deb9u1 amd64 [installed,local] multiarch-support/now 2.24-11+deb9u3 amd64 [installed,local] nano/now 2.7.4-1 amd64 [installed,local] ncurses-base/now 6.0+20161126-1+deb9u2 all [installed,local] ncurses-bin/now 6.0+20161126-1+deb9u2 amd64 [installed,local] netbase/now 5.4 all [installed,local] passwd/now 1:4.4-4.1 amd64 [installed,local] perl-base/now 5.24.1-3+deb9u4 amd64 [installed,local] pinentry-curses/now 1.0.0-2 amd64 [installed,local] procps/now 2:3.3.12-3+deb9u1 amd64 [installed,local] readline-common/now 7.0-3 all [installed,local] rsyslog/now 8.24.0-1 amd64 [installed,local] sed/now 4.4-1 amd64 [installed,local] sensible-utils/now 0.0.9+deb9u1 all [installed,local] sudo/now 1.8.19p1-2.1 amd64 [installed,local] systemd/now 232-25+deb9u4 amd64 [installed,local] systemd-sysv/now 232-25+deb9u4 amd64 [installed,local] sysvinit-utils/now 2.88dsf-59.9 amd64 [installed,local] tar/now 1.29b-1.1 amd64 [installed,local] tzdata/now 2018e-0+deb9u1 all [installed,local] udev/now 232-25+deb9u4 amd64 [installed,local] util-linux/now 2.29.2-1+deb9u1 amd64 [installed,local] vim-common/now 2:8.0.0197-4+deb9u1 all [installed,local] vim-tiny/now 2:8.0.0197-4+deb9u1 amd64 [installed,local] wget/now 1.18-5+deb9u2 amd64 [installed,local] whiptail/now 0.52.19-1+b1 amd64 [installed,local] xxd/now 2:8.0.0197-4+deb9u1 amd64 [installed,local] zlib1g/now 1:1.2.8.dfsg-5 amd64 [installed,local] $ apt list|wc -l 160
- apt list
- パッケージリスト表示
- apt list|wc -l
- 件数確認
- 160件
パッケージリスト更新
sudo apt-get update
Ign:1 http://deb.debian.org/debian stretch InRelease Get:2 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB] Get:3 http://security.debian.org/debian-security stretch/updates InRelease [53.0 kB] Get:4 http://deb.debian.org/debian stretch Release [118 kB] Get:5 http://deb.debian.org/debian stretch Release.gpg [3,177 B] Get:6 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [768 kB] Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7,080 kB] Get:8 http://security.debian.org/debian-security stretch/updates/main Translation-en [360 kB] Get:9 http://deb.debian.org/debian stretch/main Translation-en [5,377 kB] Fetched 13.9 MB in 3s (3,659 kB/s) Reading package lists… Done
- apt-get update
- パッケージリストの更新
- Debianのページからダウンロードしている
- 更新された:Reading package lists… Done
- パッケージリストの更新
更新後
apt list
apt list|wc -l
51045
- apt list
- パッケージリスト表示
- 多すぎるので、貼り付けはやめた
- apt list|wc -l
- 件数確認
- 51,045件
パッケージインストール(sshの例)
インストール実行
sudo apt install ssh
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: (中略) Setting up xauth (1:1.0.9-1+b2) ... Setting up openssh-client (1:7.4p1-10+deb9u7) ... Setting up openssh-sftp-server (1:7.4p1-10+deb9u7) ... Setting up openssh-server (1:7.4p1-10+deb9u7) ... Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:ru09A0W9DKt6QWb8uWxpn3COhS4+IpnN8ovW/tNP6eU root@DESKTOP-VNHH7QE (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:O+fwyTVpb/ISe9ATxpPDw45nFW+rElctMq1mBcuUTEI root@DESKTOP-VNHH7QE (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:+4wX3QDAjzr2Fvfsr1SL3ZnDqCnalnthVR1iPp+3+EI root@DESKTOP-VNHH7QE (ED25519) Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service. Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service. invoke-rc.d: could not determine current runlevel Setting up ssh (1:7.4p1-10+deb9u7) ... Processing triggers for libc-bin (2.24-11+deb9u3) ... Processing triggers for systemd (232-25+deb9u13) ...
- apt install
- インストールコマンド
- エラーは出力されず処理が進んでいる
インストール確認
apt list ssh -a
Listing… Done ssh/oldoldstable,now 1:7.4p1-10+deb9u7 all [installed] ssh/oldoldstable 1:7.4p1-10+deb9u6 all
- apt list ssh
- sshがインストールできている:installed
- 古いバージョン(下の方)も表示される
- 補足
- 「-a」ないと次のメッセージが出た
- 「N: There is 1 additional version. Please use the '-a’ switch to see it」
事後手順(sshの場合)
sshd起動
sudo service ssh start
[ ok ] Starting OpenBSD Secure Shell server: sshd.
- service ssh start
- 「ssh」なのに注意(「sshd」ではない)
- sshd起動できた
