如何重新安装 APT 工具?

Jos*_*ler 4 uninstall apt software-installation

我想重新安装APT Tool,所以我卸载了它,然后我意识到如果我只是删除/etc/apt目录可能会更好。有什么办法可以解决我的问题吗?

我的 Ubuntu 版本是 18.04.2 LTS,输出ls /etc/apt

root@user-OptiPlex-755:~# ls /etc/apt 
ls: cannot access '/etc/apt': No such file or directory
Run Code Online (Sandbox Code Playgroud)

更新:我已经重新安装了apt,但是,这是我的输出:

root@user-OptiPlex-755:~# sudo apt install --reinstall apt-utils ubuntu-minimal ubuntu-release-upgrader-gtk ubuntu-desktop update-manager update-notifier update-notifier-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package update-manager is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
ubuntu-release-upgrader-core update-manager-core

Package update-notifier-common is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source

Package update-notifier is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
update-notifier-common

Package apt-utils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
apt

Package ubuntu-release-upgrader-gtk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'apt-utils' has no installation candidate
E: Unable to locate package ubuntu-minimal
E: Package 'ubuntu-release-upgrader-gtk' has no installation candidate
E: Unable to locate package ubuntu-desktop
E: Package 'update-manager' has no installation candidate
E: Package 'update-notifier' has no installation candidate
E: Package 'update-notifier-common' has no installation candidate`
Run Code Online (Sandbox Code Playgroud)

Kul*_*lfy 7

如果您使用 删除 APT sudo apt remove apt,以下软件包会在标准安装中受到影响(至少在仿生 (18.04) 中):

apt apt-utils ubuntu-minimal ubuntu-release-upgrader-gtk ubuntu-desktop update-manager update-notifier update-notifier-common
Run Code Online (Sandbox Code Playgroud)

重新安装 APT:

此外,永远不要尝试弄乱系统文件/包,如 Python、APT 等,这对操作系统来说非常重要。它们可能会导致您的系统崩溃。如果您需要重新安装软件包,请运行:

sudo apt install --reinstall <package>
Run Code Online (Sandbox Code Playgroud)