3

I recently installed VS code and I cannot download the g++ compiler. I type sudo apt install g++ and it returns

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-7 g++-7 gcc gcc-7 gcc-7-base libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcilkrts5
  libgcc-7-dev libgomp1 libisl19 libitm1 liblsan0 libmpc3 libmpx2 libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev manpages-dev
Suggested packages:
  binutils-doc cpp-doc gcc-7-locales g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib make autoconf automake libtool flex bison gdb gcc-doc
  gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg
  glibc-doc libstdc++-7-doc
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-7 g++ g++-7 gcc gcc-7 gcc-7-base libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0
  libcilkrts5 libgcc-7-dev libgomp1 libisl19 libitm1 liblsan0 libmpc3 libmpx2 libquadmath0 libstdc++-7-dev libtsan0 libubsan0 linux-libc-dev manpages-dev
0 upgraded, 30 newly installed, 0 to remove and 0 not upgraded.
Need to get 987 kB/35.9 MB of archives.
After this operation, 155 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Ign:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-libc-dev amd64 4.15.0-29.31
Err:1 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 linux-libc-dev amd64 4.15.0-29.31
  404  Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-29.31_amd64.deb  404  Not Found [IP: 91.189.88.161 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I have tried running apt-get update and tried deleting the sudo g++ file and reinstalling it, nothing seems to work.

Zanna
  • 70,465
  • Do you get any errors in sudo apt update. The package you're trying to download is out-dated, so I suspect you have something wrong with your sources (such as non-Ubuntu), or use a mirror that is last-update-unknown (https://launchpad.net/ubuntu/+archivemirrors) or aren't using Ubuntu (is that why you haven't told us your release?) – guiverc Mar 22 '19 at 04:09
  • Everything guiverc says is correct. In addition to what was said, it looks like you're having problems accessing that IP address. Can you ping 91.189.88.161? And also try going to http://security.ubuntu.com/ubuntu via a web browser? Both should work. – Ray Mar 22 '19 at 05:08

2 Answers2

0

Looks like you might need to setup a correct DNS server to resolve these urls.

sudo vim /etc/resolv.conf

Then add google DNS for example:

nameserver 8.8.4.4

After that run sudo apt-get update

Then proceeds with your normal install.

ognjen011
  • 1,319
0

put this first to install linux-libc-dev package which you can't download

TEMP_DEB="$(mktemp)" &&
wget -O "$TEMP_DEB" 'http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.15.0-49.53_amd64.deb' &&
sudo dpkg -i "$TEMP_DEB"
rm -f "$TEMP_DEB"

then start sudo apt-get install gcc.

sfcatz
  • 1