Ubuntu

無法在 Google Compute Engine 的 ubuntu 16.10 VM 實例中安裝 g++

  • February 8, 2017

我在 zone 的 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標誌,我也會收到相同的錯誤消息。

我該如何解決這個問題?

您機器上的 apt 數據庫已過時,並且不反映它指向的 apt 儲存庫的目前狀態。您需要apt-get update在安裝軟體包之前執行。

引用自:https://serverfault.com/questions/831241