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

Unable to install another plugin into Docker based Installation #1198

Closed
pgillich opened this issue Jan 5, 2021 · 1 comment · Fixed by #1246
Closed

Unable to install another plugin into Docker based Installation #1198

pgillich opened this issue Jan 5, 2021 · 1 comment · Fixed by #1246
Assignees

Comments

@pgillich
Copy link
Contributor

pgillich commented Jan 5, 2021

Steps to reproduce

  1. Define alias for Docker based Installation, described on README.md
  2. Try to install another plugin locally (not into the container), for example:
    vagrant plugin install --local vagrant-mutate
  3. The result is an error, including (see the whole error message below):
    ERROR: Failed to build gem native extension.

Expected behaviour

$ vagrant plugin install --local vagrant-mutate
Starting with UID: 1000, GID: 1001
Installing the 'vagrant-mutate' plugin. This can take a few minutes...
Fetching racc-1.5.2.gem
Building native extensions. This could take a while...
Fetching nokogiri-1.11.0-x86_64-linux.gem
Fetching excon-0.78.1.gem
Fetching formatador-0.2.5.gem
Fetching fog-core-2.2.3.gem
Fetching fog-json-1.2.0.gem
Fetching fog-xml-0.1.3.gem
Fetching ruby-libvirt-0.7.1.gem
Building native extensions. This could take a while...
Fetching fog-libvirt-0.7.0.gem
Fetching vagrant-mutate-1.2.0.gem
Installed the plugin 'vagrant-mutate (1.2.0)'!

$ vagrant plugin install --local vagrant-hostmanager
Starting with UID: 1000, GID: 1001
Installing the 'vagrant-hostmanager' plugin. This can take a few minutes...
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Fetching vagrant-hostmanager-1.8.9.gem
Installed the plugin 'vagrant-hostmanager (1.8.9)'!

$ ls .vagrant/plugins/gems/2.6.6/gems/ | grep vagrant
vagrant-hostmanager-1.8.9
vagrant-mutate-1.2.0

Actual behaviour

$ vagrant plugin install --local vagrant-mutate
Starting with UID: 1000, GID: 1001
Installing the 'vagrant-mutate' plugin. This can take a few minutes...
Fetching excon-0.78.1.gem
Fetching formatador-0.2.5.gem
Fetching fog-core-2.2.3.gem
Fetching fog-json-1.2.0.gem
Fetching racc-1.5.2.gem
Building native extensions. This could take a while...
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations                                                                                                                                                                   
or transient network issues. The reported error is:                                                                                                                                                                                   
                                                                                                                                                                                                                                      
ERROR: Failed to build gem native extension.                                                                                                                                                                                          
                                                                                                                                                                                                                                      
    current directory: /home/peter/work/k8s/pgillich_kubeadm-vagrant/Ubuntu/.vagrant/plugins/gems/2.6.6/gems/racc-1.5.2/ext/racc/cparse                                                                                               
/opt/vagrant/embedded/bin/ruby -I /opt/vagrant/embedded/lib/ruby/2.6.0 -r ./siteconf20210105-45-98t3dr.rb extconf.rb                                                                                                                  
checking for rb_ary_subseq()... *** extconf.rb failed ***                                                                                                                                                                             
Could not create Makefile due to some reason, probably lack of necessary                                                                                                                                                              
libraries and/or headers.  Check the mkmf.log file for more details.  You may                                                                                                                                                         
need configuration options.                                                                                                                                                                                                           
                                                                                                                                                                                                                                      
Provided configuration options:                                                                                                                                                                                                       
        --with-opt-dir                                                                                                                                                                                                                
        --with-opt-include                                                                                                                                                                                                            
        --without-opt-include=${opt-dir}/include                                                                                                                                                                                      
        --with-opt-lib                                                                                                                                                                                                                
        --without-opt-lib=${opt-dir}/lib                                                                                                                                                                                              
        --with-make-prog                                                                                                                                                                                                              
        --without-make-prog                                                                                                                                                                                                           
        --srcdir=.                                                                                                                                                                                                                    
        --curdir                                                                                                                                                                                                                      
        --ruby=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)                                                                                                                                                                            
/opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)                                                                                                      
You have to install development tools first.                                                                                                                                                                                          
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'                                                                                                                                                          
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'                                                                                                                                                           
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'                                                                                                                                                           
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:1069:in `block in have_func'                                                                                                                                                
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'                                                                                                                                              
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'                                                                                                                                       
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:331:in `open'                                                                                                                                                               
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'                                                                                                                                                  
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:331:in `open'                                                                                                                                                               
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'                                                                                                                                                           
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'                                                                                                                                                       
        from /opt/vagrant/embedded/lib/ruby/2.6.0/mkmf.rb:1068:in `have_func'                                                                                                                                                         
        from extconf.rb:6:in `<main>'                                                                                                                                                                                                 
                                                                                                                                                                                                                                      
To see why this extension failed to compile, please check the mkmf.log which can be found here:                                                                                                                                       
                                                                                                                                                                                                                                      
  /home/peter/work/k8s/pgillich_kubeadm-vagrant/Ubuntu/.vagrant/plugins/gems/2.6.6/extensions/x86_64-linux/2.6.0/racc-1.5.2/mkmf.log                                                                                                  
                                                                                                                                                                                                                                      
extconf failed, exit code 1                                                                                                                                                                                                           
                                                                                                                                                                                                                                      
Gem files will remain installed in /home/peter/work/k8s/pgillich_kubeadm-vagrant/Ubuntu/.vagrant/plugins/gems/2.6.6/gems/racc-1.5.2 for inspection.                                                                                   
Results logged to /home/peter/work/k8s/pgillich_kubeadm-vagrant/Ubuntu/.vagrant/plugins/gems/2.6.6/extensions/x86_64-linux/2.6.0/racc-1.5.2/gem_make.out                                                                              

Suggested solution

2 images will be built:

  • developer, which contains the Ruby dev environment, size: 729 MB, example for image tag: 0.3.0-dev
  • small (current), which does not contain the Ruby dev environment, size: 404 MB, example for image tag: 0.3.0

The CI builds the developer image first, the small image is built from the developer image. Using the developer image, local plugins can be installed. Notice: there is a bug in the vagrant (?): the local images aren't listed by below command, but the vagrant up can use:

vagrant plugin list --local

Used alias:

alias vagrant='
  mkdir -p ~/.vagrant.d/{boxes,data,tmp}; \
  docker run -it --rm \
    -e LIBVIRT_DEFAULT_URI \
    -e VAGRANT_LOG \
    -e VAGRANT_LOCAL_PLUGINS_LOAD=1 \
    -v /var/run/libvirt/:/var/run/libvirt/ \
    -v ~/.vagrant.d:/.vagrant.d \
    -v $(pwd):$(pwd) \
    -w $(pwd) \
    --network host \
    vagrant-libvirt:0.3.0-dev \
    vagrant'

System configuration

OS/Distro version:: Lubuntu 20.04

Libvirt version: 0.3.0

Output of vagrant version; vagrant plugin list:

Starting with UID: 1000, GID: 1001
Installed Version: 2.2.10
Latest Version: 2.2.14
 
To upgrade to the latest version, visit the downloads page and
download and install the latest version of Vagrant from the URL
below:

  https://www.vagrantup.com/downloads.html

If you're curious what changed in the latest release, view the
CHANGELOG below:

  https://github.com/hashicorp/vagrant/blob/v2.2.14/CHANGELOG.md
Starting with UID: 1000, GID: 1001
vagrant-libvirt (0.3.1.pre.14, global)
  - Version Constraint: 0.3.1.pre.14

Attach Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt >vagrant.log 2>&1
Not relevant.

A Vagrantfile to reproduce the issue:
Any

Are you using upstream vagrant package or your distros package?
Upstream

@electrofelix
Copy link
Contributor

It seems I've made a rather large assumption with the docker image as to how it works for subsequent plugin installs. I thought subsequent plugins were cumulative, however instead it appears to attempt to reinstall the entire set of plugins and their dependencies every time a plugin is installed. This doesn't seem like the most efficient approach, so I'll probably want switch to publishing the full version as the default, as well as a slim version with an explanation of how to add plugins to the slim version and trim down again.

electrofelix added a commit that referenced this issue Apr 7, 2021
Switch to publishing the image containing all of the libraries and build
dependencies needed to support the plugin being reinstalled as that is
the default behaviour when vagrant installs a new plugin.

This should allow the default image to be extended with additional
plugins and if needed, the authors of the new image may follow and use
the slim version as a base to provide a reduced size docker image.

Fixes: #1198
electrofelix added a commit that referenced this issue Jun 25, 2021
Switch to publishing the image containing all of the libraries and build
dependencies needed to support the plugin being reinstalled as that is
the default behaviour when vagrant installs a new plugin.

This should allow the default image to be extended with additional
plugins and if needed, the authors of the new image may follow and use
the slim version as a base to provide a reduced size docker image.

Fixes: #1198
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