apt in Linux Subsystem for Windows 10 is failing with 404 Not Found [closed]
Asked Answered
S

5

16

I have a Windows 10 laptop on which I am trying to install gcc. I have in the past tried alternatives such as Netbeans, Cygwin and various emulators and virtual machines all to no avail.

What has been working so far is that I enabled the 'new' windows developer mode which allowed me to download a Linux bash shell from the windows store. It works for all the regular Linux commands, but doesn't have gcc installed.

When I type in gcc (or gcc --version) in the shell, it prints the following line:

The program 'gcc' is currently not installed. You can install it by typing: sudo apt install gcc

Which I tried, it then ran through a bunch of installer stuff but consistently seemed to run into errors such as the following:

Err:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libdpkg- >perl all 1.18.4ubuntu1.2

404 Not Found [IP: INSERT IP ADDRESS HERE ]

where the ip address is different on each error line.

It ultimately fails with the following line:

Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I have tried but again I get the same kinds of errors as above.

I would really like to get gcc working in the Windows/Linux shell as it is working great for everything else, and I'm trying to keep the number of programs on my computer to a minimum.

Does anyone know why this isn't working, or how (if possible) I can make it work?

P.S I do need it to be gcc because of school reasons

Shambles answered 10/1, 2018 at 3:26 Comment(4)
@ikegami: You're right. I misread the post. Comment deleted.Lives
Can you ping archive.ubuntu.com from the subsystem? How about google.com? Are you behind a proxy/firewall?Ivonneivor
no firewalls that i can think of :( and it seems to do some of the initial connections fineShambles
Sorry I forgot to post when I found my solution, turns out it must have been an issue with the schools internet as i was able to do the download when I got onto a different Internet connection.Shambles
S
35

For what it's worth: I landed on this SO topic after having a similar issue.

What fixed it for me was to run

sudo apt-get update
sudo apt-get upgrade

I guess the repo URLs were too old, even though my Ubuntu was in a recent version.

Searching answered 8/10, 2019 at 9:25 Comment(1)
Just sudo apt-get update worked for me. Thanks.Clyve
T
5

I just ran into the same thing attempting to install python-pip. According to this article, this happens when you have the Windows 10 Anniversary Update (older) instead of the Creators update (newer). The solution is to either uninstall and re-install Ubuntu, or upgrade it (from 14.04 to 16.04). I found the upgrade to be simple and painless:

sudo do-release-upgrade

To check what you have, before and after via:

lsb_release -a

Transitory answered 14/8, 2018 at 0:21 Comment(1)
The reason you get a 404 when using 14.04 is because 14.04 is EOL and the repositories no longer exist but the OP is already using 16.04 (xenial).Vaden
Z
0

I had the same problem. Pinging the IP resulted in no response and visiting the website returned a 404.

I found a ppa with most current GCC and registered the PPA and was able to successfully install GCC with it; ppa website. I used GCC to build some software I wanted that was not found with apt-get.

From their page:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
Zubkoff answered 19/4, 2018 at 22:25 Comment(2)
This doesn't solve the problem that apt can't find its default repositories. It just works around it for gcc by adding a third-party repository.Kosel
@Kosel The op says they "really want gcc working". They don't don't even mention that they care about broken repo. I get your point but I don't think it warrants a comment.Zubkoff
H
-1

Try to run Ubuntu application in Windows with an option "Run as Administrator".

Hypothermia answered 29/1, 2020 at 16:46 Comment(0)
P
-2

wsl.exe --update

use this command

Paraguay answered 3/5 at 7:54 Comment(1)
I’m sorry, but that command will not have any effect whatsoever on the problem in this question. wsl —update updates only the WSL virtual environment itself, but does not touch the underlying Linux distribution, which is where this problem is occurring.Mannose

© 2022 - 2024 — McMap. All rights reserved.