Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
apturl-common xul-ext-ubufox
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
apt apt-utils apturl nautilus-share python3-software-properties
software-properties-common software-properties-gtk ubuntu-desktop
unattended-upgrades
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
apt
0 upgraded, 0 newly installed, 9 to remove and 0 not upgraded.
Remv ubuntu-desktop [1.341]
Remv nautilus-share [0.7.3-1ubuntu5]
Remv apturl [0.5.2ubuntu9]
Remv software-properties-gtk [0.96.13.1]
Remv software-properties-common [0.96.13.1]
Remv python3-software-properties [0.96.13.1]
Remv unattended-upgrades [0.86.2ubuntu1]
Remv apt-utils [1.0.10.2ubuntu1]
Remv apt [1.0.10.2ubuntu1]
sudo apt-get remove apt
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
apt apt-utils apturl nautilus-share python3-software-properties
software-center software-properties-common software-properties-gtk
ubuntu-desktop ubuntu-extras-keyring ubuntu-minimal unattended-upgrades
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
apt
0 upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
After this operation, 9,031 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] Yes, do as I say!
(Reading database ... 179817 files and directories currently installed.)
Removing ubuntu-desktop (1.327) ...
Removing nautilus-share (0.7.3-1ubuntu5) ...
Removing apturl (0.5.2ubuntu4) ...
dpkg: warning: while removing apturl, directory '/usr/lib/python3/dist-packages/AptUrl/gtk/backend' not empty so not removed
Removing software-properties-gtk (0.94) ...
dpkg: warning: while removing software-properties-gtk, directory '/usr/lib/python3/dist-packages/softwareproperties/gtk' not empty so not removed
Removing software-properties-common (0.94) ...
Removing python3-software-properties (0.94) ...
Removing unattended-upgrades (0.82.8) ...
Removing ubuntu-minimal (1.327) ...
Removing apt-utils (1.0.9.2ubuntu2) ...
Removing software-center (13.10-0ubuntu4.1) ...
Removing ubuntu-extras-keyring (2010.09.27) ...
OK
Removing apt (1.0.9.2ubuntu2) ...
Processing triggers for man-db (2.7.0.2-2) ...
Processing triggers for gconf2 (3.2.6-2ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu2) ...
Processing triggers for bamfdaemon (0.5.1+14.10.20140925-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.55ubuntu1) ...
Processing triggers for dbus (1.8.8-1ubuntu2) ...
Processing triggers for libc-bin (2.19-10ubuntu2) ...
APT 允许您使用选项来模拟您的命令
-s
。您可以自己尝试,发出命令apt-get -s remove apt
(sudo
不需要)。这会产生以下输出:
所以答案应该是:是的,你可以。
你可以...
并且会被警告你即将做一些非常具有破坏性的事情。我必须说...对于节省不到 6000kb 的空间来说,软件包列表看起来很可怕:D
它确实完成了,但没有办法使用“apt-get”返回。Ubuntu 软件中心将不再工作,您需要使用“dpkg”重新安装包管理器(并且还需要手动安装所有依赖项)。
有一次,当我运行 CoreUbuntu 时,我从源代码安装了一个错误的包,它
apt
决定 obsoletedapt
。下次我跑的时候apt autoremove
,我实际上并没有看要删除的软件列表,而是在apt
列表中。想象一下下次我输入
apt install <package-name>
并得到The program 'apt' is currently not installed. You can install it by typing: sudo apt-get install apt
.幸运的是,由于某种原因,
autoremove
没有删除任何apt
's 依赖项,所以我所要做的就是使用wget
apt
'.deb
存档并重新安装dpkg -i
.如其他答案所示,如果您删除
apt
withapt
,由于它试图解决的依赖关系,您将遇到更多麻烦。我觉得这很有趣,但事实确实如此(对于 Debian,也许在某种程度上是 Fedora/openSUSE?)许多现代发行版主要是在他们选择的包管理器提供的基础架构上定义和构建的。
从技术上讲,apt 不能删除 apt... 因为 apt 不知道如何删除、安装或升级软件包。安装、删除、升级、配置软件包的任务留给 dpkg。虽然您可以告诉 apt 删除名为“apt”的包,但它所做的是检查 apt 包的反向依赖关系,记下这些包并命令 dpkg 删除它们。这是在其他 答案中可以看到的。
即使没有 apt,您也可以使用 dpkg 安装、删除或升级软件包,只是跟踪所需的依赖项和升级会更加痛苦,这就是 apt 存在的理由。
当然可以。Apt 和 dpkg 本身是包,它们是为了能够通过自己更新,所以有删除的规定;否则
/var/lib/dpkg/info/dpkg.prerm
就没/var/lib/dpkg/info/dpkg.postrm
有理由存在:)如果您不小心删除了它们而导致您没有 dpkg,您仍然可以手动解压缩 dpkg 的 .deb 存档,除非您还摆脱了 binutils、tar、gzip/bzip2。
--purge
但是,在涉及 apt 工具链的任何软件包上都可能给您带来讨厌的问题;很难分辨/var/lib/dpkg
. 如果/var/lib/dpkg/status
被删除并且没有当前备份,那么是的,该系统上的包管理器将无法修复。我发誓不久前我
apt
在基于 Ubuntu 的系统上看到了这些二进制文件,但它们不在我当前的 Ubuntu MATE 15.04 系统上(它们与大多数其他二进制文件一起存在)。如果它在,那么可能无法卸载它,因为包管理器应该忽略其中的文件。我必须承认,将(以及)置于下方将是一个好主意。/usr/local/bin
/usr/bin
/usr/local/bin
apt
/usr/local/bin
apt
dpkg
/usr/local/bin
一个更有趣的问题是 - 如果卸载会发生什么
dpkg
?果然,dpkg
被 列为一个包apt
,但我现在不打算尝试卸载它(暂时没有设置虚拟机)。理论上也可以dpkg
自行卸载。我将进行有根据的猜测,重新安装它的唯一方法是手动安装,然后希望它获取现有的配置文件(这样您就不必再次手动告诉系统安装了哪些软件包),然后告诉它dpkg
现在再次安装了该软件包。(开个玩笑:) Debian 用户相当于
# rm -rf /
is# apt-get purge ".*"
。