Ubuntu 不小心移除了 apt、apt-get

内容纲要

最近在安装软件时,不小心把 Ubuntu 的 apt、apt-get等移除了,当时心情是日了狗了。
当时提示输入一些文字确认。。。我以为是确认安装,直到看到一堆的 Removing …

(Reading database ... 149416 files and directories currently installed.)
Removing unattended-upgrades (1.1ubuntu1.18.04.8) ...
Removing apt-utils (1.8.4) ...
Removing apt (1.4.9) ...
Removing libapt-pkg-dev:arm64 (1.8.2) ...
Removing libapt-pkg5.90:arm64 (1.9.5) ...
Removing apport (2.20.9-0ubuntu7.9) ...
Removing command-not-found (18.04.5) ...
Removing landscape-common (18.01-0ubuntu3.2) ...
Removing ubuntu-standard (1.417) ...
Removing language-selector-common (0.188.1) ...
Removing python3-apport (2.20.9-0ubuntu7.9) ...
Removing software-properties-common (0.96.24.32.7) ...
Removing python3-software-properties (0.96.24.32.7) ...
Removing update-manager-core (1:18.04.11.9) ...
dpkg: warning: while removing update-manager-core, directory '/var/lib/update-manager' not empty so not removed
Removing ubuntu-release-upgrader-core (1:18.04.30) ...
Removing python3-commandnotfound (18.04.5) ...
Removing python3-update-manager (1:18.04.11.9) ...
Removing python3-distupgrade (1:18.04.30) ...
Removing python3-apt (1.6.3ubuntu1) ...
Setting up apt-transport-https (1.4.9) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1.1) ..

然后 apt、apt-get 命令用不了了。。。卧槽。。。
网上找到方法都用不了。。。。

好在天无绝人之路,一番折腾,终于搞好。

首先到 http://mirrors.163.com/debian/pool/main/a/apt/ 下载 相应的包。
把符合你系统CPU的包全部下载。

每种类型的 deb 包都下一个,版本要根据实际情况下,不要下最新的!!!

例如我的是 ubuntu 18.04 ARM64,把这些下载了

.
├── apt-doc_1.4.9_all.deb
├── apt-transport-https_1.4.9_arm64.deb
├── apt-utils_1.4.9_arm64.deb
├── apt_1.4.9_arm64.deb
├── libapt-inst2.0_1.4.9_arm64.deb
├── libapt-pkg-dev_1.4.9_arm64.deb
└── libapt-pkg5.0_1.4.9_arm64.deb

上传到 linux 空目录。
然后对每个 .deb 包,都进行一次

dpkg -x {xxx.deb} /

没错,有点麻烦,但是要坚持。

把以上的包都进行一次 dpkg -x 后。执行

dpkg -i *.deb

不用管报什么错。

执行完毕,马上执行一下

apt

如果正常了,那就 very good。

点赞
  1. bupropion cost说道:

    I happen to be writing to make you understand what a wonderful experience our princess went through visiting yuor web blog. She realized too many things, with the inclusion of what it is like to possess an incredible teaching style to make the rest without problems understand various very confusing topics. You undoubtedly surpassed visitors' expected results. Thanks for supplying those warm and helpful, trustworthy, revealing not to mention unique tips on your topic to Tanya.

  2. I am just writing to make you understand what a impressive encounter my friend's girl gained reading through your web page. She learned plenty of pieces, which include what it's like to possess an amazing helping mood to let most people smoothly know several impossible subject matter. You truly exceeded our own expectations. Thank you for offering these invaluable, safe, explanatory and even fun tips about this topic to Julie.

  3. Wohh just what I was searching for, appreciate it for posting.

发表评论

邮箱地址不会被公开。 必填项已用*标注

You must enable javascript to see captcha here!