我意外删除了 apt-get,现在重新安装它时遇到了问题。
这是我所做的
dpkg -r apt (uninstalled apt-get)
我尝试下载 apt.deb 文件并重新安装
sudo dpkg -i apt_1.2.32ubuntu0.1_amd64.deb
它给了我这个错误:
Selecting previously unselected package aptitude:amd64.
(Reading database ... 200534 files and directories currently installed.)
Preparing to unpack aptitude_0.8.10-6ubuntu1_amd64.deb ...
Unpacking aptitude:amd64 (0.8.10-6ubuntu1) ...
dpkg: dependency problems prevent configuration of aptitude:amd64:
aptitude:amd64 depends on aptitude-common (= 0.8.10-6ubuntu1).
aptitude:amd64 depends on libboost-filesystem1.65.1.
aptitude:amd64 depends on libboost-iostreams1.65.1.
aptitude:amd64 depends on libboost-system1.65.1.
aptitude:amd64 depends on libcwidget3v5.
aptitude:amd64 depends on libncursesw5 (>= 6).
aptitude:amd64 depends on libsigc++-2.0-0v5 (>= 2.8.0).
aptitude:amd64 depends on libxapian30.
dpkg: error processing package aptitude:amd64 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
aptitude:amd64
然后我尝试了这个:
sudo dpkg -i --force-all apt_1.2.32ubuntu0.1_amd64.deb
它给了我这个输出:
Selecting previously unselected package apt:amd64.
(Reading database ... 200540 files and directories currently installed.)
Preparing to unpack apt_1.2.32ubuntu0.1_amd64.deb ...
Unpacking apt:amd64 (1.2.32ubuntu0.1) ...
dpkg: apt:amd64: dependency problems, but configuring anyway as you requested:
snapd (2.48+18.04) breaks apt (<< 1.6.3) and is installed.
Version of apt:amd64 to be configured is 1.2.32ubuntu0.1.
Setting up apt:amd64 (1.2.32ubuntu0.1) ...
Configuration file '/etc/apt/apt.conf.d/01-vendor-ubuntu', does not exist on system.
Installing new config file as you requested.
Configuration file '/etc/apt/apt.conf.d/01autoremove', does not exist on system.
Installing new config file as you requested.
Configuration file '/etc/cron.daily/apt-compat', does not exist on system.
Installing new config file as you requested.
Configuration file '/etc/kernel/postinst.d/apt-auto-removal', does not exist on system.
Installing new config file as you requested.
Configuration file '/etc/logrotate.d/apt', does not exist on system.
Installing new config file as you requested.
/etc/kernel/postinst.d/apt-auto-removal: 14: /etc/kernel/postinst.d/apt-auto-removal: apt-config: Exec format error
/etc/kernel/postinst.d/apt-auto-removal: 18: /etc/kernel/postinst.d/apt-auto-removal: apt-config: Exec format error
/etc/kernel/postinst.d/apt-auto-removal: 49: /etc/kernel/postinst.d/apt-auto-removal: apt-config: Exec format error
Created symlink /etc/systemd/system/timers.target.wants/apt-daily-upgrade.timer → /lib/systemd/system/apt-daily-upgrade.timer.
Created symlink /etc/systemd/system/timers.target.wants/apt-daily.timer → /lib/systemd/system/apt-daily.timer.
Processing triggers for libc-bin (2.27-3ubuntu1.3) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
现在当我尝试使用
sudo apt-get update
它给了我这个:
/usr/bin/apt-get: 1: /usr/bin/apt-get: ELF: not found
/usr/bin/apt-get: 1: /usr/bin/apt-get: @8�@8: not found
/usr/bin/apt-get: 2: /usr/bin/apt-get: ����: not found
/usr/bin/apt-get: 3: /usr/bin/apt-get: : not found
/usr/bin/apt-get: 3: /usr/bin/apt-get: cannot open ½���������hI��p�: No such file
rm�: not foundet: 3: /usr/bin/apt-get: c
/usr/bin/apt-get: 4: /usr/bin/apt-get: �7��: not found
�F�'�: /usr/bin/apt-get:
�
�J
n\���� \
Y[#�� �d��=
�: not found
/usr/bin/apt-get: 6: /usr/bin/apt-get: �C��+: not found
/usr/bin/apt-get: 16: /usr/bin/apt-get: Syntax error: "(" unexpected
Ubuntu 18.04.5 LTS
答案1
您正在尝试安装 Ubuntu 16.04 版本apt
,而不是 Ubuntu 18.04 版本apt
。
查看此页面apt
(1.2.32ubuntu0.1)。请注意,页面中 URL 的面包屑导航为:
» Ubuntu » 软件包 » xenial (16.04LTS) » admin » apt
这显然是 Ubuntu 16.04 版本。但你运行的是 Ubuntu 18.04。因此你需要获取apt
(1.6.12ubuntu0.1)可以是找到这里。再次查看页面中 URL 的面包屑导航:
» Ubuntu » 软件包 » bionic (18.04LTS) » admin » apt
下载它直接从这里然后运行这个命令:
sudo dpkg --install apt_1.6.12ubuntu0.1_amd64.deb
你应该坚强。