Score:0

How to set /etc/apt/apt.conf on a Linux subsystem for windows when Windows has automatically proxy setup checked?

gb flag

On my Windows machine, proxy settings are basic:

Automatic Proxy setup:
  Automatically detect settings : checked

On my Windows machine, I've installed a Linux subsystem (Ubuntu). I'm trying to perform a sudo apt update or a sudo apt install .... Apparently, in order to get this done, I need to fill in /etc/apt/apt.conf (this file does not exist yet).

I've created that file and very naïvely, I've entered the following:

Linux Prompt> cat apt.conf
Acquire::http::proxy "http://<proxy>";
Acquire::https::proxy "https://<proxy>";
Acquire::ftp::proxy "ftp://<proxy>";
Acquire::socks::proxy "socks:<proxy>";

This, obviously, does not work, and I don't know about any basic proxies, used by my computer, so this leaves me with two possibilities:

  • Either I search for a proxy, used by my computer, and I fill it in in /etc/apt/apt.conf file.
  • Either I configure /etc/apt/apt.conf in order to detect proxy settings automatically, just like the "parent" Windows machine.

Which of the two options is best and how do I do it?

Thanks

Edit, some background

I wanted to do some sudo apt install (it's a consequence of this Superuser question, but as an example, let's take "emacs-gtk"):

Linux Prompt> sudo apt install emacs-gtk
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package emacs-gtk

When I do a sudo apt update:

Get:1 http://archive.ubuntu.com/ubuntu focal InRelease
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' is not signed.
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

As requested: I pinged "8.8.8.8", and there everything seems to be fine:

Linux Prompt> ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=9.47 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=9.84 ms
...
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 9.164/9.388/9.838/0.226 ms

I thought that the apt install problems were due to the /etc/apt/apt.conf file (containing the proxy settings), hence my question.

NotTheDr01ds avatar
vn flag
The fact that your Windows host is set to automatically detect proxy settings is normal - Just about everyone has that option set by default. Since you aren't aware of any proxies you are really using, that's *likely* not your problem. So let's start with the basics - What is the actual problem that you are having? What error does `sudo apt update` give? Does other networking from inside WSL break? Try `ping 8.8.8.8` in WSL - What happens?
Dominique avatar
gb flag
@NotTheDr01ds: thanks for your quick reply, I added the background of my question (it all starts with `apt install` which doesn't work).
NotTheDr01ds avatar
vn flag
Ah, based on the error, I can see why you are suspecting proxy. I seem to recall someone having a similar issue; it might have been on Super User. Away from computer for a few hours, but I'll see if I can find it.
NotTheDr01ds avatar
vn flag
See if anything in [this answer](https://superuser.com/q/346372/1210833) helps if it really is a proxy issue.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.