首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用apt/智能,在发行版升级后删除所有原始包?

如何使用apt/智能,在发行版升级后删除所有原始包?
EN

Unix & Linux用户
提问于 2022-05-30 22:09:54
回答 1查看 140关注 0票数 0

几周前,我将linux从Pop_OS 21.10升级到22.04。

发行版升级可能用新版本取代了一些旧的源代码,因此,许多用于Pop_OS 21.10或更早版本的现有软件包现在都是没有问题的:

代码语言:javascript
复制
$ 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的包管理器提供解决方案。

EN

回答 1

Unix & Linux用户

发布于 2022-05-31 01:17:44

您可以轻松地提取包名,方法是将输出保存到文件中(例如,通过重定向或鼠标复制和粘贴,因为它是一个相当小的列表),并通过awk '{print $3}'运行它,因为包名位于每一行的第三个字段中。然后,您可以用apt-get removeapt-get purge命令使用这些包名。

您还可以使用aptitude search (例如aptitude -F %p search '?obsolete' )获得“过时”包的列表。这可能会产生比“标记为重新安装”的...but更大的包名列表--如果不知道您的sources.list配置和您正在使用的任何repos的当前状态,就不可能确定。

但是,自动删除大量包可能会大大超出您的预期,因为其他包可能依赖于您要删除的某些包。库包(例如libfam0libvala-0.48-0libsepol1)尤其有可能导致这种情况。而删除containerd.io可能会导致卸载码头或类似的容器管理工具。

我强烈建议不要自动删除这些包。

如果有选择地卸载手工挑选的软件包,如果它们被证明是一个问题的话,应该是可以的,但是(除了少数例外),它们占用的磁盘空间的数量不值得无原因地删除它们的风险。

旧的内核头相当大(~50 if ),通常可以安全地删除--只有当您需要编译内核模块(例如,使用dkms)来安装内核时,它们才是真正有用的。而且您可能不需要gnome开始使用这么多语言的文档。

您可能还会发现,您正在删除定期使用的包,但由于包维护人员没有时间维护它,所以它不在发行版中。我知道在我的Debian机器上有几台类似的,尤其是那些自20世纪90年代以来不断升级的机器。我不想让我的roxterm包被自动删除,例如,即使是作者,它也已经过时和废弃了多年,但我仍然使用它,因为它比其他基于libvte的终端emulators....and少得多,即使它是废弃的软件,它仍然工作得很好。

顺便说一句,值得记住的是,每行的W:前缀都表示警告,而不是错误条件。它指出了一些值得注意的问题,但并不一定是一个需要解决的实际问题。

票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/704430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档