无法在 Google Compute Engine 中的 ubuntu 16.10 VM 实例中安装 g++

无法在 Google Compute Engine 中的 ubuntu 16.10 VM 实例中安装 g++

我在区域的 GCE 中创建了一个新的 VM asia-northeast1-a。我需要安装一个 g++ 编译器。

当我运行 apt-get 时,出现以下错误消息:

$ sudo apt-get install g++ 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  binutils cpp cpp-6 g++-6 gcc gcc-6 libasan3 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libgcc-6-dev
  libgomp1 libisl15 libitm1 liblsan0 libmpc3 libmpx2 libquadmath0 libstdc++-6-dev libtsan0 libubsan0
  linux-libc-dev manpages-dev
Suggested packages:
  binutils-doc cpp-doc gcc-6-locales g++-multilib g++-6-multilib gcc-6-doc libstdc++6-6-dbg gcc-multilib make
  autoconf automake libtool flex bison gdb gcc-doc gcc-6-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg
  libatomic1-dbg libasan3-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg
  libquadmath0-dbg glibc-doc libstdc++-6-doc
The following NEW packages will be installed:
  binutils cpp cpp-6 g++ g++-6 gcc gcc-6 libasan3 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5
  libgcc-6-dev libgomp1 libisl15 libitm1 liblsan0 libmpc3 libmpx2 libquadmath0 libstdc++-6-dev libtsan0 libubsan0
  linux-libc-dev manpages-dev
0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded.
Need to get 876 kB/34.3 MB of archives.
After this operation, 147 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Err:1 http://asia-northeast1-a.gce.clouds.archive.ubuntu.com/ubuntu yakkety-updates/main amd64 linux-libc-dev amd64
 4.8.0-32.34
  404  Not Found [IP: 91.189.88.152 80]
Err:1 http://security.ubuntu.com/ubuntu yakkety-security/main amd64 linux-libc-dev amd64 4.8.0-32.34
  404  Not Found [IP: 91.189.88.152 80]
Unable to correct missing packages.
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.8.0-32.34_amd64.deb  404  N
ot Found [IP: 91.189.88.152 80]
E: Aborting install.

即使使用该--fix-missing标志,我仍然收到相同的错误消息。

我该如何解决这个问题?

答案1

您机器上的 apt 数据库已过期,并且未反映其指向的 apt 存储库的当前状态。您需要apt-get update在安装软件包之前运行。

相关内容