apt / aptitudeを使用して展開アップグレード後にソースを持たない古いパッケージをすべて削除する方法は?

apt / aptitudeを使用して展開アップグレード後にソースを持たない古いパッケージをすべて削除する方法は?

数週間前、私はLinuxをPop_OS 21.10から22.04にアップグレードしました。

ディストリビューションのアップグレードはおそらくいくつかの古いソースを新しいバージョンに置き換えたため、Pop_OS 21.10以前の既存のパッケージの多くはソースがありません。

$ sudo aptitude update
W: Package containerd.io had been marked to reinstall, but the file for the current installed version 1.4.13-1 is not available
W: Package scala-cli had been marked to reinstall, but the file for the current installed version 0.1.2 is not available
W: Package libfam0 had been marked to reinstall, but the file for the current installed version 2.7.0-17.3build2 is not available
W: Package ksysguardd had been marked to reinstall, but the file for the current installed version 4:5.22.0-0ubuntu1 is not available
W: Package gnome-getting-started-docs-de had been marked to reinstall, but the file for the current installed version 3.36.2-0ubuntu0.1 is not available
W: Package gnome-getting-started-docs-es had been marked to reinstall, but the file for the current installed version 3.36.2-0ubuntu0.1 is not available
W: Package gnome-getting-started-docs-fr had been marked to reinstall, but the file for the current installed version 3.36.2-0ubuntu0.1 is not available
W: Package gnome-getting-started-docs-it had been marked to reinstall, but the file for the current installed version 3.36.2-0ubuntu0.1 is not available
W: Package gnome-getting-started-docs-ja had been marked to reinstall, but the file for the current installed version 3.36.2-0ubuntu0.1 is not available
W: Package gnome-getting-started-docs-pt had been marked to reinstall, but the file for the current installed version 3.36.2-0ubuntu0.1 is not available
W: Package gnome-getting-started-docs-ru had been marked to reinstall, but the file for the current installed version 3.36.2-0ubuntu0.1 is not available
W: Package docker-ce-cli had been marked to reinstall, but the file for the current installed version 5:20.10.12~3-0~ubuntu-focal is not available
W: Package wolframscript had been marked to reinstall, but the file for the current installed version 1.2.0+2019040701 is not available
W: Package libvala-0.48-0 had been marked to reinstall, but the file for the current installed version 0.48.6-0ubuntu1 is not available
W: Package linux-headers-5.11.0-7614-generic had been marked to reinstall, but the file for the current installed version 5.11.0-7614.15~1622578982~20.04~383c0a9 is not available
W: Package llvm-10-dev had been marked to reinstall, but the file for the current installed version 1:10.0.0-4ubuntu1 is not available
W: Package linux-headers-5.15.8-76051508-generic had been marked to reinstall, but the file for the current installed version 5.15.8-76051508.202112141040~1639505278~20.04~0ede46a is not available
W: Package ksysguard had been marked to reinstall, but the file for the current installed version 4:5.22.0-0ubuntu1 is not available
W: Package gcc-8 had been marked to reinstall, but the file for the current installed version 8.5.0-0ubuntu4 is not available
W: Package linux-modules-5.16.19-76051619-generic had been marked to reinstall, but the file for the current installed version 5.16.19-76051619.202204081339~1649696161~22.04~091f44b is not available
W: Package minikube had been marked to reinstall, but the file for the current installed version 1.25.2-0 is not available
W: Package oem-sutton.newell-meta had been marked to reinstall, but the file for the current installed version 4.0newell5 is not available
W: Package linux-modules-5.15.8-76051508-generic had been marked to reinstall, but the file for the current installed version 5.15.8-76051508.202112141040~1639505278~20.04~0ede46a is not available
W: Package libllvm10 had been marked to reinstall, but the file for the current installed version 1:10.0.0-4ubuntu1 is not available
W: Package gcc-8-base had been marked to reinstall, but the file for the current installed version 8.5.0-0ubuntu4 is not available
W: Package libsepol1 had been marked to reinstall, but the file for the current installed version 3.1-1ubuntu2.1 is not available

すべて削除する必要があります。そうしないと、ディスク領域が無駄になり、奇妙な競合が発生する可能性があります。どうすればいいですか?ソリューションはUbuntu / debianベースのパッケージマネージャを使用して提供できます。

ベストアンサー1

その出力をファイルに保存し(たとえば、リダイレクトを使用するか、非常に小さいリストなので、マウスのコピーと貼り付けを使用)、awk '{print $3}'パッケージ名が3つのフィールドの各行の最初にあるため、実行してパッケージ名を簡単に抽出できます。その後、またはapt-get removeコマンドを使用してapt-get purgeこれらのパッケージ名を使用できます。

aptitude searchたとえば、「古い」パッケージのリストを取得するために使用することもできますaptitude -F %p search '?obsolete'。これにより、「再インストールとしてマークされた」パッケージ名よりも大きいパッケージ名のリストが生成される可能性がありますが、source.listの構成と使用中のリポジトリの現在の状態は不明です。おそらく大丈夫でしょう。

ただし、多数のパッケージを自動的に削除すると、思ったより多くのパッケージが削除される可能性があります。他のパッケージは、削除したいパッケージによって異なります。特に、ライブラリパッケージ(例えばlibfam0libvala-0.48-0およびlibsepol1)がこの問題を引き起こす可能性が高いです。削除すると、containerd.ioDockerまたは同様のコンテナ管理ツールが削除される可能性があります。

これらのパッケージを自動的に削除しないことをお勧めします。

慎重に選択したパッケージを選択的に削除問題になると判明した場合大丈夫ですが(いくつかの例外を除いて)、彼らが消費するディスク容量は何の理由もなく削除する危険はありません。

古いカーネルヘッダーはかなり大きく(〜50 MB)、通常安全に削除できます。実際には、インストールされているカーネルのカーネルモジュールをコンパイルする必要がある場合(例:dkmsを使用する)にのみ役立ちます。そして、あまりにも多くの言語のgnomeスタートアップガイドは必要ないかもしれません。

頻繁に使用するがパッケージマネージャがメンテナンスする時間がなくなるため、ディストリビューションに含まれていないパッケージを削除することがあります。私は私のDebianコンピュータにいくつかの類似したデバイスがあることを知っています。特に、1990年代以降、継続的にアップグレードされたデバイスはさらにそうです。たとえば、私はroxtermパッケージを自動的に削除するのが嫌いです。このパッケージは長年にわたって昔ながらであり、作者によって廃棄されたことがありましたが、他のlibvteベースのターミナルエミュレータよりもパフォーマンスがはるかに低いため、まだ使用しています。 .. .. .そして、廃止されたソフトウェアにもかかわらず、まだうまくいきます。

ちなみに、W:各行のプレフィックスは次のことを示すことを覚えておく価値があります。警告する、エラー条件ではありません。これは注目すべき価値がある点を指摘していますが、必ずしも解決すべき実際の問題ではありません。

おすすめ記事