apt 自行删除

apt 自行删除
max@max-Vostro-5568:~/Desktop$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 snapd : Breaks: apt (< 1.6.3) but 1.6.1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我进一步尝试消除这些问题,但却发生了自我消除。

max@max-Vostro-5568:~/Desktop$ sudo apt install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libapt-inst1.5 libapt-pkg4.12 linux-headers-5.3.0-28
  linux-headers-5.3.0-28-generic linux-image-5.3.0-28-generic
  linux-modules-5.3.0-28-generic linux-modules-extra-5.3.0-28-generic
  python3-debconf
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  apt
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, 1 to remove and 0 not upgraded.
After this operation, 3,896 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 ... 223329 files and directories currently installed.)
Removing apt (1.6.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
max@max-Vostro-5568:~/Desktop$ apt
bash: /usr/bin/apt: No such file or directory

答案1

对于 Ubuntu 18.04。在终端中尝试此操作:

对于 AMD64 计算机:

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.6.6ubuntu0.1_amd64.deb

然后运行:

sudo dpkg -i apt_1.6.6ubuntu0.1_amd64.deb

或者对于 Intel x86 机器:

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.6.6ubuntu0.1_i386.deb

然后运行:

sudo dpkg -i apt_1.6.6ubuntu0.1_i386.deb

注意:

  • 对于其他版本的 Ubuntu,请搜索Ubuntu 软件包并选择您的版本,然后下载合适版本的 APT 并像上面一样安装它。

  • 參閱这个答案并修复你的源列表和 PPA。

  • sudo apt update在安装或升级任何软件包之前始终运行。

  • 如果你已经aptitude安装,你可以使用它来安装 APT(参照上面链接的答案检查你的存储库列表是否正确)像这样:

    sudo aptitude update

    然后:

    sudo aptitude install apt

相关内容