canonical / canonical/multipass
Multipass ignores no_proxy when HTTPS_PROXY is set
- Dominant language
- C++
- Stars
- 9.2k
- Forks
- 828
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 44
Description
**Describe the bug**
Hello Team,
I'm trying to create a Multipass VM in the env running behind the proxy. I'm setting the proxy through `/etc/environment` (I'm setting both lowercase and uppercase variables for proxy). I don't want Multipass to use the proxy though, because the proxy doesn't allow connections to `cdimage.ubuntu.com`.
In order to bypass proxy, I've added `.ubuntu.com` to the `no_proxy` and `NO_PROXY` variables.
With this setup, when I try to launch a Multipass instance, I'm getting `launch failed: Remote "" is unknown or unreachable.` error.
In the daemon status I can see that it's trying to use the proxy anyway:
```shell
Mar 19 13:08:58 upf-operator multipassd[2381]: Cannot retrieve headers for https://cdimage.ubuntu.com/ubuntu-core/18/stable/current/ubuntu-core-18-amd64.img.xz: Proxy denied connection
Mar 19 13:08:58 upf-operator multipassd[2381]: Using the 'default' storage pool.
Mar 19 13:08:58 upf-operator multipassd[2381]: Cannot retrieve headers for https://cdimage.ubuntu.com/ubuntu-core/22/stable/current/ubuntu-core-22-amd64.img.xz: Proxy denied connection
Mar 19 13:08:58 upf-operator multipassd[2381]: Cannot retrieve headers for https://cdimage.ubuntu.com/ubuntu-core/16/stable/current/ubuntu-core-16-amd64.img.xz: Proxy denied connection
Mar 19 13:08:58 upf-operator multipassd[2381]: Error getting https://cdimage.ubuntu.com/ubuntu-core/appliances/streams/v1/index.json: Proxy denied connection - trying cache.
Mar 19 13:08:58 upf-operator multipassd[2381]: Could not update manifest: failed to download from 'https://cdimage.ubuntu.com/ubuntu-core/appliances/streams/v1/index.json': Error opening https://cdimage.ubuntu.>
Mar 19 13:08:58 upf-operator multipassd[2381]: Cannot retrieve headers for https://cdimage.ubuntu.com/ubuntu-core/20/stable/current/ubuntu-core-20-amd64.img.xz: Proxy denied connection
Mar 19 13:08:58 upf-operator multipassd[2381]: Could not update manifest: failed to download from 'https://cdimage.ubuntu.com/ubuntu-core/16/stable/current/ubuntu-core-16-amd64.img.xz': Proxy denied connection
```
Proxy envs passed to the process are:
```shell
ubuntu@upf-operator:~$ sudo cat /proc/2554/environ | tr '\0' '\n' | grep -i proxy
HTTPS_PROXY=http://squid.internal:3128
no_proxy=localhost,127.0.0.1,.jujucharms.com,.ubuntu.com,upf-operator
NO_PROXY=localhost,127.0.0.1,.jujucharms.com,.ubuntu.com,upf-operator
https_proxy=
http_proxy=
HTTP_PROXY=http://squid.internal:3128
```
I tried overwriting the variables using drop-in config, but it didn't help. I tried removing proxy config for the snap using `snap set system` and `snap unset system`; also without any luck.
Eventually, I was able to make it run by removing the uppercase env variables from my `/etc/environment` (`HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY`). This doesn't seem right tho.
Would be great if someone could look into it.
Please let me know in case any additional info is needed.
BR,
Bartek
**To Reproduce**
How, and what happened?
1. Setup env as described above
2. `multipass launch 22.04`
**Expected behavior**
What did you expect to happen?
**Logs**
Relevant logs available in the description
**Additional info**
- OS: Ubuntu 22.04
- `multipass version` = 1.13.1
- `multipass get local.driver` = lxd
-
Contributor guide
Research direction
Start by reproducing `multipass launch 22.04` with the `/etc/environment` proxy configuration and the listed uppercase and lowercase variables. Trace the Multipass proxy-environment handling and verify that `NO_PROXY` causes requests to `cdimage.ubuntu.com` to bypass the proxy, with a regression test covering the reported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100