Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPN does not work in VM if CGO_ENABLED = 0 but works with CGO_ENABLED = 1 #358

Closed
1 of 3 tasks
tricktron opened this issue Jun 30, 2022 · 5 comments · Fixed by #359
Closed
1 of 3 tasks

VPN does not work in VM if CGO_ENABLED = 0 but works with CGO_ENABLED = 1 #358

tricktron opened this issue Jun 30, 2022 · 5 comments · Fixed by #359

Comments

@tricktron
Copy link
Contributor

Description

While testing the newest #357 qemu fix with nix for NixOS/nixpkgs#179522 I noticed the following:

If CGO_ENABLED=0 my vpn did not work. If CGO_ENABLED=1 my vpn inside the vm works.

Hypothesis: CGO_ENABLED=1 means that go uses native libraries, e.g. for dns resolution. As a result, that means that vpn passthrough to the VM to QEMU may need CGO_ENABLED=1.

Possibly relevant/related: Lima needs CGO_ENABLED=1 as well. https://github.com/lima-vm/lima/blob/master/docs/network.md#dns-19216853.

Unfortunately I cannot share my vpn configs, since it is a customer.

Version

Colima Version: 0.4.3 git commit: 84fae1c
Lima Version: 0.11.1
Qemu Version: 7.0

Operating System

  • macOS Intel
  • macOS M1
  • Linux

Reproduction Steps

  1. colima start
  2. colima ssh
  3. nslookup (internal domain only reachable by vpn)

Expected behaviour

Connection works.

Additional context

No response

@abiosoft
Copy link
Owner

abiosoft commented Jun 30, 2022

Alright, then we can switch it back to using CGO_ENABLED=1.

As a side note, thanks @tricktron, you've been very helpful with your feedbacks.

@abiosoft
Copy link
Owner

@tricktron do you mind helping to confirm if it works with the CGO_ENABLED variable missing? To confirm the default behaviour.

@tricktron
Copy link
Contributor Author

@abiosoft sure, I can test it tomorrow.

@tricktron
Copy link
Contributor Author

tricktron commented Jul 1, 2022

@abiosoft

@tricktron do you mind helping to confirm if it works with the CGO_ENABLED variable missing? To confirm the default behaviour.

I can confirm, it works:+1:

I think you are ready for a new tag/release:smiley:.

@abiosoft
Copy link
Owner

abiosoft commented Jul 1, 2022

@tricktron https://github.com/abiosoft/colima/releases/tag/v0.4.4.

Release and release notes will be generated after successful build but you can point the Nix package to v0.4.4 already.

Release is done.

Thanks.

SuperSandro2000 added a commit to NixOS/nixpkgs that referenced this issue Jul 4, 2022
* colima: use updated Makefile in build and install phases

* colima: use lima-unwrapped

* colima: fix dynamic version

* colima: 0.4.2 -> 0.4.3

* colima: delete .git folder in postfetch when `leaveDotGit = true`

Otherwise it may lead to non-deterministic behaviour.

Co-authored-by: j-k <dev@j-k.io>

* colima: do not override default buildGoModule phases

The colima Makefile does more or less the same as the `buildGoModule`
implementation. Instead of overriding it and using the Makefile
directly, we reproduce the behaviour desired behaviour by customising
env variables, e.g. `ldflags` and `subPackages`.

Co-authored-by: j-k <dev@j-k.io>

* colima: use `buildGoModule = buildGo118Module;`

Co-authored-by: j-k <dev@j-k.io>

* colima: update meta.description

Co-authored-by: j-k <dev@j-k.io>

* colima: set `CGO_ENABLED = 1` to make VPN connections work

See abiosoft/colima#358

* colima: 0.4.3 -> 0.4.4

* colima: define all ldflags in preConfigure

Co-authored-by: Atemu <Atemu@users.noreply.github.com>

* colima: add version test

* colima: add meta.mainProgram and meta.platforms

* colima: remove unused runCommand input

Co-authored-by: j-k <dev@j-k.io>

* colima: cleanup meta

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

* colima: drop meta.platforms

because we use the default value of `platforms.darwin ++
platforms.linux`

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Atemu <Atemu@users.noreply.github.com>

* Update pkgs/applications/virtualization/colima/default.nix

Co-authored-by: j-k <dev@j-k.io>
Co-authored-by: Atemu <Atemu@users.noreply.github.com>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants