apt-get updateで「ターゲット〜は〜で複数回設定されています」と表示されるときの対処方法

Linux
この記事は約8分で読めます。

Ubuntuにインストールされているパッケージの更新をするときにapt updateを実行します。

apt updateを実行したところ、次のようなメッセージが表示されました。

$ sudo apt update
無視:1 http://dl.google.com/linux/chrome-remote-desktop/deb stable InRelease
〜省略〜
パッケージリストを読み込んでいます… 完了
依存関係ツリーを作成しています
状態情報を読み取っています… 完了
アップグレードできるパッケージが 4 個あります。表示するには ‘apt list –upgradable’ を実行してください。
W: ターゲット Packages (main/binary-amd64/Packages) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット Packages (main/binary-all/Packages) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット Translations (main/i18n/Translation-ja_JP) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット Translations (main/i18n/Translation-ja) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット Translations (main/i18n/Translation-en) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット DEP-11 (main/dep11/Components-amd64.yml) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット DEP-11 (main/dep11/Components-all.yml) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット DEP-11-icons-small (main/dep11/icons-48×48.tar) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット DEP-11-icons (main/dep11/icons-64×64.tar) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています
W: ターゲット DEP-11-icons-hidpi (main/dep11/icons-64×64@2.tar) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています

通常は表示されることのないメッセージが表示されているので、この表示が出ないようにしてみました。

                 

対処方法

表示されたメッセージを確認してみると、パッケージ更新のためのパッケージリスト群に同一パッケージが複数回登場するようになっているっぽい内容です。

W: ターゲット Packages (main/binary-amd64/Packages) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google.list:1 で複数回設定されています

なので、リストを確認して重複がないか確認してみます。

パッケージリストの確認

表示されたメッセージにある/etc/apt/sources.list.d/に移動します。

ディレクトリ移動
$ cd /etc/apt/sources.list.d/
ディレクトリ内を参照
$ ll 合計 20 drwxr-xr-x 2 root root 4096 3月 29 10:32 ./ drwxr-xr-x 7 root root 4096 3月 19 00:14 ../ -rw-r--r-- 1 root root 204 3月 29 10:32 chrome-remote-desktop.list -rw-r--r-- 1 root root 189 3月 19 00:15 google-chrome.list -rw-r--r-- 1 root root 55 3月 19 00:14 google.list

googleやchromeのリストが存在していました。

 

このディレクトリで『chrome』という文字列をgrepしてみました。

/etc/apt/sources.list.d$ grep chrome *
chrome-remote-desktop.list:deb [arch=amd64] http://dl.google.com/linux/chrome-remote-desktop/deb/ stable main
google-chrome.list:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
google.list:deb http://dl.google.com/linux/chrome/deb/ stable main

見ての通り、”http://dl.google.com/linux/chrome/deb/ stable main”が2行出てきました。

google-chrome.listとgoogle.listのそれぞれに1回ずつ記述されていました。

 

リストの削除

同一の参照先を指定する複数のリストがあることが原因なので、ユニークにするために不要なリストを削除します。

今回の場合、リストの中身が”deb http://dl.google.com/linux/chrome/deb/ stable main”だけだったgoogle.listのほうを削除しました。

$ sudo rm google.list

$ ll
合計 16
drwxr-xr-x 2 root root 4096 3月 30 11:03 ./
drwxr-xr-x 7 root root 4096 3月 19 00:14 ../
-rw-r--r-- 1 root root 204 3月 29 10:32 chrome-remote-desktop.list
-rw-r--r-- 1 root root 189 3月 19 00:15 google-chrome.list

↑google.listを削除しました。

 

もう一度、『chrome』という文字列をgrepしてみました。

$ grep chrome *
chrome-remote-desktop.list:deb [arch=amd64] http://dl.google.com/linux/chrome-remote-desktop/deb/ stable main
google-chrome.list:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

参照先の重複が無くなりました。

 

再度apt updateする

$ sudo apt update
ヒット:1 http://jp.archive.ubuntu.com/ubuntu focal InRelease
ヒット:2 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease
無視:3 http://dl.google.com/linux/chrome-remote-desktop/deb stable InRelease
ヒット:4 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease
ヒット:5 http://dl.google.com/linux/chrome/deb stable InRelease
ヒット:6 http://security.ubuntu.com/ubuntu focal-security InRelease
ヒット:7 http://dl.google.com/linux/chrome-remote-desktop/deb stable Release
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
アップグレードできるパッケージが 4 個あります。表示するには 'apt list --upgradable' を実行してください。

最初のようなメッセージは表示されなくなり、通常通りの挙動になりました。

コメント

タイトルとURLをコピーしました