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

Bug while triying to configure Docker daemon service that does not exist - Ubuntu 16.04.6 LTS, vagrant-proxyconf 2.0.10 #227

Open
dostarora97 opened this issue Sep 9, 2020 · 13 comments

Comments

@dostarora97
Copy link

dostarora97 commented Sep 9, 2020

VM OS: Ubuntu 16.04.6 LTS
Vagarant Version : 2.2.10
vagrant-proxyconf version: 2.0.10

The following error pops up when trying to configure docker.service

==> default: Configuring proxy for Apt...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

sed -e 's/\[Service\]/[Service]\nEnvironmentFile=-\/etc\/default\/docker/g' /lib/systemd/system/docker.service > /tmp/docker.service

Stdout from the command:



Stderr from the command:

sed: can't read /lib/systemd/system/docker.service: No such file or directory
@dostarora97 dostarora97 changed the title Tries to configure Docker daemon service that does not exist - Ubuntu 16.04.6 LTS, vagrant-proxyconf 2.0.10 Bug while triying to configure Docker daemon service that does not exist - Ubuntu 16.04.6 LTS, vagrant-proxyconf 2.0.10 Sep 9, 2020
@codylane
Copy link
Collaborator

codylane commented Sep 9, 2020

Hi @dostarora97 Thank you for reporting this. I haven't tested this plugin yet on vagrant 2.2.10 but I will this evening. I have a feeling I know what the issue is but im not near a computer right now.

For what its worth I believe this is being caused from another issues I opened that I still need to address. Ill link that issue here.

Also can you please provide a small gist of your vagrantfile?

@codylane
Copy link
Collaborator

codylane commented Sep 9, 2020

I believe #192 is related to this one and linking just incase.

Indeed I have some more cleanup to do. Please hang tight i may not be able to resolve this quickly without some code refactoring and tests.

I keep you updated as I have a status and i will take a look jnto this later tonite.

Thanks again! I hope you are well.

@codylane codylane self-assigned this Sep 9, 2020
@codylane codylane added this to the 2.0.11 milestone Sep 9, 2020
@codylane
Copy link
Collaborator

codylane commented Sep 10, 2020

@dostarora97 - As promised, I'm looking into this issue. I'm wondering if you could share the Vagrantfile you are using when you have a moment? It will help me make sure I can produce valid tests. I appreciate your time.

@codylane
Copy link
Collaborator

codylane commented Sep 11, 2020

Ugh, I attempted to test this on vagrant 2.2.10 and it failed.

At this point I'm not sure if it's our plugin or a problem with Vagrant. I don't want to speculate until I figure out what the exact issue is. When I tried to test this last night (on 2.2.10) it complained about something with /etc/fstab on a Ubuntu 18.04 virtualbox box VM which still is not related to this plugin since we don't do anything with /etc/fstab. Sigh. I'll provide more details as I have them in the next few days.

@MaxPeal
Copy link

MaxPeal commented Sep 21, 2020

please take a look in my PR #228 with my tests its worked
but im stuck at the bundle exec rspec so i get 3 errors form the bundle tests

@micah
Copy link

micah commented Oct 27, 2020

I'm also getting this, when I haven't specified in my Vagrant file to use vagrant-proxyconf. I can add to my Vagrantfile the following:

  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.enabled = { docker: false }
  end

but I shouldn't have to specify that this should not be enabled.... because then I need to add this to every Vagrantfile I have, even when I do not use a proxy for that environment.

@codylane
Copy link
Collaborator

codylane commented Oct 28, 2020

I'm also getting this, when I haven't specified in my Vagrant file to use vagrant-proxyconf. I can add to my Vagrantfile the following:

You are also getting what? Please provide a copy of the error message you are seeing to support your "getting this" quote.

  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.enabled = { docker: false }
  end

but I shouldn't have to specify that this should not be enabled.... because then I need to add this to every Vagrantfile I have, even when I do not use a proxy for that environment.

Again, you shouldn't have to what? You just want to disable the docker proxy implementation on all your VMs and you shouldn't have to disable it? What do you expect this code to do then? Please provide a solid reason to support your request and how you expect it to work. Also please provide and example configuration that you would expect to be the "default".

I did a quick google search and found out you indeed can have a global vagrant file.
https://www.vagrantup.com/docs/vagrantfile#load-order
Hint hint!

@micah
Copy link

micah commented Oct 28, 2020

I'm also getting this, when I haven't specified in my Vagrant file to use vagrant-proxyconf. I can add to my Vagrantfile the following:

You are also getting what? Please provide a copy of the error message you are seeing to support your "getting this" quote.

I'm getting the same thing that the original reporter was experiencing. This is why I'm adding to to this issue.

If I must repeat the error message that the original reporter experienced, I can do so:

Bringing machine 'floatrp1' up with 'libvirt' provider...
==> floatrp1: Checking if box 'debian/buster64' version '10.4.0' is up to date...
==> floatrp1: Starting domain.
==> floatrp1: Waiting for domain to get an IP address...
==> floatrp1: Waiting for SSH to become available...
==> floatrp1: Creating shared folders metadata...
==> floatrp1: Configuring proxy for Apt...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

sed -e 's/\[Service\]/[Service]\nEnvironmentFile=-\/etc\/default\/docker/g' /lib/systemd/system/docker.service > /tmp/docker.service

Stdout from the command:



Stderr from the command:

sed: can't read /lib/systemd/system/docker.service: No such file or directory

but I shouldn't have to specify that this should not be enabled.... because then I need to add this to every Vagrantfile I have, even when I do not use a proxy for that environment.

Again, you shouldn't have to what?

Again, I shouldn't have to add something to every Vagrantfile I have to disable proxy configuration.

For every Vagrantfile I have, I need to add the following:

  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.enabled = { docker: false }
  end

Otherwise I cannot bring it up, or I need to install docker there... but the point is, I am not wanting to setup a proxy for every Vagrantfile.

You just want to disable the docker proxy implementation on all your VMs and you shouldn't have to disable it?

No. I want to enable the proxy implementation only on the Vagrantfiles that I want to enable it on. By installing vagrant-proxyconf it has been enabled for every Vagrant environment, regardless if I configured that specific environment to have it enabled, or not. As a result of it being enabled for every environment, I now have to disable the proxy configuration for every Vagrantfile I do not want it on, or does not have docker installed.

What do you expect this code to do then? Please provide a solid reason to support your request and how you >expect it to work. Also please provide and example configuration that you would expect to be the "default".

I want to have a proxy config, like what vagrant-proxyconf provides, for VMs that I decide should have it, and not the others.

How I would expect it to work would be:

  1. install vagrant-proxyconf
  2. configure the specific VagrantFile(s) that I would like to enable vagrant-proxyconf
  3. if I want it enabled for every Vagrant environment, then I would configure it in my global VagrantFile

I did a quick google search and found out you indeed can have a global vagrant file.
https://www.vagrantup.com/docs/vagrantfile#load-order
Hint hint!

I'm aware of the global vagrant file, but can I turn off vagrant-proxyconf in the global VagrantFile, and then turn it on in specific Vagrantfiles?

@codylane
Copy link
Collaborator

Hi @micah,

Thanks for your kind reply and for providing that information. I know it may sound like a lot to ask even though the error message will seem duplicated but it tells a story to me and can sometimes provide extra context that I would have otherwise missed. So thank you for that, I appreciate it.

That said, I think your use case is not a "general public" use case and I still cannot see how "disabling all the proxy support plugins" is a good idea for the "general public". Keep in mind that a lot of people use Vagrant it a lot of different an interesting ways and each person likes to throw in their own special sauce.

I won't lie, I'm still not sure I completely understand your use case and the need to disable vagrant-proxyconf globally if you are behind a proxy and you HAVE the docker client installed on your vagrant VM. The documentation in the README tries to explain that all supported items are enabled by default. So vagrant-proxyconf will configure a proxy for the docker if docker is found in the vagrant VM's path. (Hint: remove docker from your $PATH` in your VM could also work). You also don't have systemd setup on your VM? I don't use debian so I cannot tell you how this is supposed to work. But I hear you loud and clear that it may be misleading for some power users that this plugin while installed is technically trying to configure a proxies for all supported software contained in all your Vagrantfiles.

So, to truly fix this, yes I'll need to spend some time trying to decrap some of the code that is causing this problem. It's not a easy problem to solve especially since acceptance and regression testing are hard to do with the way this plugin currently stands today. It doesn't mean I won't get to this, it just means I don't think it's that high of a priority since you can disable a specific plugin as needed and it's no longer a problem.

Also, if you still feel strongly about your suggestion, I would highly encourage your to put in a separate issue so we can get the community members to comment and provide a reason to do this refactor. Your error message is related to this issue yes, but your configuration problem is not, so please, let's take the configuration suggestion to a different issue.

That said, I won't comment on any more configuration issues in this thread IF it's not related to this issue. If you have a suggestion and or time to help fix this issue I will accept a PR as long as it has docs + tests to support the change.

I will try one last time to get you in the right directorion for your configuration issue.

To quote your reply

I'm aware of the global vagrant file, but can I turn off vagrant-proxyconf in the global VagrantFile, and then turn it on in specific Vagrantfiles?

Oh? Cool, have you tried my suggestion there yet? Because the answer should be "in theory" yes! You should be able to disable whatever garbage you want in the higher order Vagrantfile. However keep in mind that ENV vars can still override this as the README states.

@chucknelson
Copy link
Collaborator

Hey all - just chiming in quick - I generally agree with what @codylane is saying above, but overall I think the main discussion on this issue somehow transformed into talking about behavior of vagrant-proxyconf.

From my POV:

  • I think the default behavior is clear in that it'll try to configure proxy for everything it finds on the system.
  • If you don't want it to config something, you can disable that particular item in your particular Vagrantfile.
  • If you don't want any proxy config, you don't include the plugin in your Vagrantfile.
  • If you have a global Vagrantfile or any other config like env vars applying plugins or configuration, then you take that into account per Vagrant's behavior.

For this specific issue, I think we can focus on more gracefully handling (or correctly handling?) how the docker proxy is configured depending on what we know about the system/OS the plugin is running on, right?

@codylane
Copy link
Collaborator

codylane commented Nov 3, 2020

Hi @chucknelson, thanks for chiming in I do appreciate it. So I'm thinking we should talk about this some more and come up with solution or put in new feature for cleanup. Id like to have a private discussion with you first if you are available to chat and then we can turn that into a story and put this on the board so that @micah can chime in and help us before we change the cap providers.

I feel like the main problem for this is caused by the cap providers and the detection of these binaries when they exist on different systems.

Thoughts or concerns?

@chucknelson
Copy link
Collaborator

chucknelson commented Nov 16, 2020

@codylane

Id like to have a private discussion with you first if you are available to chat...

Sure - sorry I've been MIA :-/

Let me know how you'd want to chat - maybe Gitter or something.

@codylane
Copy link
Collaborator

@codylane

Id like to have a private discussion with you first if you are available to chat...

Sure - sorry I've been MIA :-/

Let me know how you'd want to chat - maybe Gitter or something.

Hey @chucknelson - No worries, I created us a new slack channel. I'll share it with you via your personal email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants