0

I accidentally ended up deleting apt-get from my system (It's an 64-bit Ubuntu 16.04 Server). I decided that I would just re-download it from here. However, when I tried to install it by issuing the following command, this happened:

dpkg -i apt_1.0.1ubuntu2.17_amd64.deb

Preparing to unpack apt_1.0.1ubuntu2.17_amd64.deb ...
Unpacking apt (1.0.1ubuntu2.17) over (1.0.1ubuntu2.17) ...
dpkg: dependency problems prevent configuration of apt:
apt depends on libapt-pkg4.12 (>= 0.9.16); however:
Version of libapt-pkg4.12:amd64 on system is 0.8.16~exp12ubuntu10.21.
libapt-pkg5.0:amd64 (1.6~alpha5) breaks apt (<< 1.1~exp14) and is installed.
Version of apt to be configured is 1.0.1ubuntu2.17.

dpkg: error processing package apt (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.6.1-4) ...
Errors were encountered while processing:
 apt

I'm not certain how to proceed, could anyone give me some help? Thanks.

ssharma
  • 103
  • you need a newer version of libapt-pkg4.12 which was also available in the link you provided, then gracefully force remove apt in dpkg use dpkg --remove apt, then first install libapt-pkg4.12 https://packages.ubuntu.com/trusty/libapt-pkg4.12 then you can proceed now to install apt. – Yien Nov 30 '17 at 03:09
  • So I first remove apt by typing dpkg --remove apt and then I install libapt-pkg4.12. After that, I then install apt. Is this correct? – ssharma Nov 30 '17 at 03:11
  • apt-get deals with dependencies, dpkg can't. Hence with dpkg you need to install the required 'depends' first, or at the same time. – guiverc Nov 30 '17 at 03:13
  • How do I do that? – ssharma Nov 30 '17 at 03:15
  • I found a file called libapt-pkg5.0. I'm not sure if I should remove this though. – ssharma Nov 30 '17 at 03:18
  • @guiverc thanks for pointing that out i totally overlooked it, @ssharma you just have to put it like this after removing apt dpkg -i apt_1.0.1ubuntu2.17_amd64.deb libapt-pkg4.12_amd64.deb this will install it at the same time. – Yien Nov 30 '17 at 03:18
  • Ok I'll try that. – ssharma Nov 30 '17 at 03:18
  • I still received an error. – ssharma Nov 30 '17 at 03:19
  • I think my error is because I have this file, libapt-pkg5.0 installed. I think this is a different version. I've tried to remove it, but it seems to have dependencies. – ssharma Nov 30 '17 at 03:23

1 Answers1

0

Ok, so I figured out the problem.

Essentially, I was installing an older version of apt (like the idiot I am). Basically, I had the apt library file libapt-pkg5.0. This library file corresponds to the .deb file found here. Once you download that file (with wget or your browser), then you can install it with dpkg -i apt_1.2.15ubuntu0.2_amd64.deb. Once that happens, then you're all good to go.

Thanks to the people who attempted to help me.

ssharma
  • 103