AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1122065
Accepted
Joshua Miller
Joshua Miller
Asked: 2019-03-01 12:28:11 +0800 CST2019-03-01 12:28:11 +0800 CST 2019-03-01 12:28:11 +0800 CST

如何重新安装 APT 工具?

  • 772

我想重新安装 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

更新:我已经重新安装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`
software-installation uninstall apt
  • 2 2 个回答
  • 5090 Views

2 个回答

  • Voted
  1. Best Answer
    Kulfy
    2019-03-01T12:43:46+08:002019-03-01T12:43:46+08:00

    如果您使用 删除 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
    

    要重新安装 APT:

    • 下载 APT 的 .deb 文件。

      wget http://mirrors.edge.kernel.org/ubuntu/pool/main/a/apt/apt_1.6.8_amd64.deb
      
    • 使用 dpkg 安装。

      sudo dpkg -i apt_1.6.8_amd64.deb
      
    • 由于您也删除/etc/apt了,请从 GitHub 下载仿生的 zip,解压缩并使用以下命令复制 apt 文件夹:

      sudo cp -r ~/Downloads/Bionic/apt /etc/
      

      并运行更新:

      sudo apt update
      
    • 再次安装已删除的软件包。

      sudo apt install apt-utils ubuntu-minimal ubuntu-release-upgrader-gtk ubuntu-desktop update-manager update-notifier update-notifier-common
      

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

    sudo apt install --reinstall <package>
    
    • 7
  2. Joshua Miller
    2019-03-01T14:02:47+08:002019-03-01T14:02:47+08:00

    更新:我旁边确实有一个 Ubuntu 服务器,所以我将它/etc/apt与这个 Ubuntu 合并,问题就解决了。感谢您的所有帮助,我很确定我的第二个问题的核心是我丢失了/etc/apt/sources.list文件。一旦我复制了这些文件,我就可以安装删除的包。再次感谢您的所有帮助!

    • 1

相关问题

  • 有没有办法重置所有包/源并从头开始?

  • 设置 LAMP 堆栈的最简单方法是什么?

  • 我应该在哪里安装 sagemath?

  • How do I install Adobe Flash player?对于 11.10 及更高版本明确修复 11.10 上的 64 位 Flash

  • 如何设置软件中心为非 root 用户安装软件?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve