I have four build servers that were all setup the same originally. We've been using them to cross-compile C projects. I'm trying to update them compile C++ natively as well. Two of the servers I was able to install g++ on with no problem, the other two though gave me 404 errors.
$ sudo apt-get install g++ Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: g++-7 libstdc++-7-dev Suggested packages: g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg libstdc++-7-doc The following NEW packages will be installed: g++ g++-7 libstdc++-7-dev 0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded. Need to get 9,043 kB of archives. After this operation, 40.7 MB of additional disk space will be used. Do you want to continue? [Y/n] y Err:1 bionic-updates/main amd64 libstdc++-7-dev amd64 7.4.0-1ubuntu1~18.04 404 Not Found [IP: 91.189.88.149 80] Err:2 bionic-updates/main amd64 g++-7 amd64 7.4.0-1ubuntu1~18.04 404 Not Found [IP: 91.189.88.149 80] Err:3 bionic-updates/main amd64 g++ amd64 4:7.4.0-1ubuntu2.2 404 Not Found [IP: 91.189.88.149 80] E: Failed to fetch 404 Not Found [IP: 91.189.88.149 80] E: Failed to fetch 404 Not Found [IP: 91.189.88.149 80] E: Failed to fetch 404 Not Found [IP: 91.189.88.149 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? I have confirmed that all four report the same version info.
$ uname -a Linux build_server4 4.15.0-48-generic #51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic 26 Answers
I run into this issue almost every time I set up a new box.
Run sudo apt update before you install the packages.
If running from docker and you already have apt-get update in your Dockerfile try running with --no-cache or use cache busting.
Set your system time to the correct time of your time zone and then try sudo apt update before running your command sudo apt-get install g++
for me I solved the issue by fixing the time zone difference
- I correct the time zone
sudo apt cleansudo apt autocleansudo apt update
that works just fine.
In my case, changing the sources of ubuntu-esm-infra (located in /etc/apt/sources.list.d/ubuntu-esm-infra.list) from xenial to bionic resulted in 404 or 401 errors.
As packages of this source are not essential for running Ubuntu (mybe Canonical thinks differently), I deactivated these sources before do-release-upgrade.
after running the standard
apt-get update && apt-get upgrade no more errors showed up.
I have replaced source.list with below text, resolved my issue.
# See for how to upgrade to # newer versions of the distribution. deb precise main deb-src precise main ## Major bug fix updates produced after the final release of the ## distribution. deb precise-updates main deb-src precise-updates main ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb precise universe deb-src precise universe deb precise-updates universe deb-src precise-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. # deb precise multiverse # deb-src precise multiverse # deb precise-updates multiverse # deb-src precise-updates multiverse ## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb precise-backports main restricted universe multiverse # deb-src precise-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb precise partner # deb-src precise partner deb precise-security main deb-src precise-security main deb precise-security universe deb-src precise-security universe # deb precise-security multiverse # deb-src precise-security multiverse after that run this
sudo apt update in your terminal
1