canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.76k stars 642 forks source link

[macOS] Can't multipass launch behind CNTLM proxy #1947

Open amongil opened 3 years ago

amongil commented 3 years ago

Describe the bug multipass launch fails with message "timed out waiting for response"

To Reproduce While behind a corporate proxy with env variables http_proxy and https_proxy setup pointing to CNTLM:

$ multipass launch --name foo launch failed: The following errors occurred: foo: timed out waiting for response

Expected behavior Launches the foo example image.

Logs foo-hyperkit.log: foo login: [ 19.939046] cloud-init[1176]: Cloud-init v. 20.4.1-0ubuntu1~20.04.1 running 'modules:config' at Fri, 29 Jan 2021 12:44:01 +0000. Up 19.26 seconds. .... -----END SSH HOST KEY KEYS----- [ 20.558401] cloud-init[1189]: Cloud-init v. 20.4.1-0ubuntu1~20.04.1 running 'modules:final' at Fri, 29 Jan 2021 12:44:02 +0000. Up 20.39 seconds. [ 20.560117] cloud-init[1189]: Cloud-init v. 20.4.1-0ubuntu1~20.04.1 finished at Fri, 29 Jan 2021 12:44:02 +0000. Datasource DataSourceNoCloud [seed=/dev/sr0][dsmode=net]. Up 20.55 seconds

multipassd.log:

[2021-01-29T13:44:02.934] [info] [foo] hyperkit: [INFO] Allocator: file contains cluster 0 .. 22739 will enlarge file to 0 .. 23251 [2021-01-29T13:44:02.934] [info] [foo] hyperkit: [INFO] resize: adding available clusters (Node ((x 22740) (y 23251) (l Empty) (r Empty) (h 1) (cardinal 512)))

I can't see error messages in any log file.

Additional info macOS 10.15 multpass 1.5.0+mac

I suspect this is due to proxy, and could not find any way to inject http_proxy and https_proxy variables to multipass.

Saviq commented 3 years ago

@amongil Multipass runs as a LaunchDaemon via launchd, so its environment is different than your shell's. Do you have the proxy set up system-wide?

We currently only look at the environment variables, maybe there is somewhere else we should be looking on macOS.

In the interim, you could use a similar approach to this: https://github.com/canonical/multipass/pull/1789#issuecomment-705393264 to set the variables system-wide.