大网数据广告活动
服务器运维问答

How to completely remove a package in Ubuntu (like it never existed)

· 52CE 我爱测

When I remove a package in Ubuntu using apt-get remove package , it always seems to leave behind a lot of files... for example, log files in /var/log , config files in /etc , data in /var/lib , etc. How do I COMPLETELY remove eve…

问题原文

原帖链接 · bumbleshoot · CC BY-SA 4.0

When I remove a package in Ubuntu using apt-get remove package, it always seems to leave behind a lot of files... for example, log files in /var/log, config files in /etc, data in /var/lib, etc.

How do I COMPLETELY remove every trace of a package in Ubuntu, as if it never existed?

已采纳解答

原帖链接 · Peter · CC BY-SA 4.0

You should purge those packages.

apt-get purge somepackage

from man apt-get (APT-GET(8))

   purge
       purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).

This is supposed to remove everything added by the package, such as config and data files. But I would assume it's possible that it generated something that is left behind anyway. dpkg doesn't track everything related to a package... and its cleanup scripts and such can be assumed to be imperfect and sometimes fail. Maybe it won't remove logs for example.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-02-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。