weixin_39781594 2020-11-29 20:27
浏览 0

Wrong permissions in /tmp/verifier/gems/[bin/cache/gems] (?) / broken caching with 1.4.0.beta.2

Up until test-kitchen 1.3.1 I could use vagrant-cachier to cache the whole /tmp/busser/gems directory by adding this to my global ~/.vagrant.d/Vagrantfile:

 ruby
# global Vagrant configuration
Vagrant.configure("2") do |config|

  # enable cachier globally
  if Vagrant.has_plugin?("vagrant-cachier")
    config.cache.scope = :box

    # cache bussers for test-kitchen
    config.cache.enable :generic, {
      "busser" => { cache_dir: "/tmp/busser/gems" }
    }
  end
end

This gave me a noteable speedup for running the kitchenci tests. Without caching, it would download and install the bussers for every kitchenci run again.

I have noticed that the path changed to /tmp/verifier/gems now, but once I try to cache this path with 1.4.0.beta.2 the kitchen run will fail with some write permission error.

I'm still investigating the exact cause for it as it worked without problems with 1.3.1. One thing that looks suspicious to me is the ownership of the files in /tmp/verifier/gems/[bin/cache/gems] directories:


vagrant-ubuntu-1204:~$ ll /tmp/verifier/gems/gems/
total 72
drwxrwxr-x 18 vagrant vagrant 4096 Mar 29 14:12 ./
drwxrwxr-x  9 vagrant vagrant 4096 Mar 29 14:12 ../
drwxr-xr-x  5 root    root    4096 Mar 29 14:12 bundler-1.9.1/
drwxrwxr-x  7 vagrant vagrant 4096 Mar 29 14:12 busser-0.7.0/
drwxr-xr-x  4 root    root    4096 Mar 29 14:12 busser-serverspec-0.5.3/
drwxr-xr-x  7 root    root    4096 Mar 29 14:12 diff-lcs-1.2.5/
drwxr-xr-x  3 root    root    4096 Mar 29 14:12 multi_json-1.11.0/
drwxr-xr-x  4 root    root    4096 Mar 29 14:12 net-scp-1.2.1/
drwxr-xr-x  5 root    root    4096 Mar 29 14:12 net-ssh-2.9.2/
drwxr-xr-x  3 root    root    4096 Mar 29 14:12 rspec-3.2.0/
drwxr-xr-x  4 root    root    4096 Mar 29 14:12 rspec-core-3.2.2/
drwxr-xr-x  3 root    root    4096 Mar 29 14:12 rspec-expectations-3.2.0/
drwxr-xr-x  6 root    root    4096 Mar 29 14:12 rspec-its-1.2.0/
drwxr-xr-x  3 root    root    4096 Mar 29 14:12 rspec-mocks-3.2.1/
drwxr-xr-x  3 root    root    4096 Mar 29 14:12 rspec-support-3.2.2/
drwxr-xr-x  5 root    root    4096 Mar 29 14:12 serverspec-2.13.0/
drwxr-xr-x  5 root    root    4096 Mar 29 14:12 specinfra-2.27.0/
drwxrwxr-x  5 vagrant vagrant 4096 Mar 29 14:12 thor-0.19.0/

Except for the busser gem itself they are all root owned. Is this as expected?

该提问来源于开源项目:test-kitchen/test-kitchen

  • 写回答

7条回答 默认 最新

  • weixin_39781594 2020-11-29 20:27
    关注

    This is the exact error I get when running kitchen verify with caching of the /tmp/verifier/gems directory enabled:

    
    -----> Verifying <default-ubuntu-1204>...
           Preparing files for transfer
    -----> Installing Busser (busser)
    Fetching: thor-0.19.0.gem (100%)
           Successfully installed thor-0.19.0
    Fetching: busser-0.7.0.gem (100%)
           Successfully installed busser-0.7.0
           2 gems installed
    -----> Setting up Busser
           Creating BUSSER_ROOT in /tmp/verifier
           Creating busser binstub
           /opt/chef/embedded/lib/ruby/2.1.0/fileutils.rb:250:in `mkdir': Permission denied @ dir_s_mkdir - /tmp/verifier/bin (Errno::EACCES)
            from /opt/chef/embedded/lib/ruby/2.1.0/fileutils.rb:250:in `fu_mkdir'
            from /opt/chef/embedded/lib/ruby/2.1.0/fileutils.rb:224:in `block (2 levels) in mkdir_p'
            from /opt/chef/embedded/lib/ruby/2.1.0/fileutils.rb:222:in `reverse_each'
            from /opt/chef/embedded/lib/ruby/2.1.0/fileutils.rb:222:in `block in mkdir_p'
            from /opt/chef/embedded/lib/ruby/2.1.0/fileutils.rb:208:in `each'
            from /opt/chef/embedded/lib/ruby/2.1.0/fileutils.rb:208:in `mkdir_p'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/actions/create_file.rb:61:in `block in invoke!'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/actions/empty_directory.rb:116:in `call'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/actions/create_file.rb:60:in `invoke!'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/actions.rb:94:in `action'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/actions/create_file.rb:25:in `create_file'
            from /tmp/verifier/gems/gems/busser-0.7.0/lib/busser/command/setup.rb:103:in `generate_busser_binstub_for_bourne'
            from /tmp/verifier/gems/gems/busser-0.7.0/lib/busser/command/setup.rb:55:in `generate_busser_binstub'
            from /tmp/verifier/gems/gems/busser-0.7.0/lib/busser/command/setup.rb:39:in `perform'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `block in invoke_all'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `each'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `map'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:133:in `invoke_all'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/group.rb:232:in `dispatch'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:115:in `invoke'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor.rb:40:in `block in register'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor.rb:359:in `dispatch'
            from /tmp/verifier/gems/gems/thor-0.19.0/lib/thor/base.rb:440:in `start'
            from /tmp/verifier/gems/gems/busser-0.7.0/bin/busser:8:in `<top>'
            from /tmp/verifier/gems/bin/busser:23:in `load'
            from /tmp/verifier/gems/bin/busser:23:in `<main>'
           Installing Busser plugins: busser-serverspec
           sudo: /tmp/verifier/bin/busser: command not found
    >>>>>> Verify failed on instance <default-ubuntu-1204>.
    >>>>>> Please see .kitchen/logs/default-ubuntu-1204.log for more details
    >>>>>> ------Exception-------
    >>>>>> Class: Kitchen::ActionFailed
    >>>>>> Message: SSH exited (1) for command: [sh -c '
    
    BUSSER_ROOT="/tmp/verifier"; export BUSSER_ROOT
    GEM_HOME="/tmp/verifier/gems"; export GEM_HOME
    GEM_PATH="/tmp/verifier/gems"; export GEM_PATH
    GEM_CACHE="/tmp/verifier/gems/cache"; export GEM_CACHE
    ruby="/opt/chef/embedded/bin/ruby"
    gem="/opt/chef/embedded/bin/gem"
    version="busser"
    gem_install_args="busser --no-rdoc --no-ri"
    busser="sudo -E /tmp/verifier/bin/busser"
    plugins="busser-serverspec"
    
    $gem list busser -i 2>&1 >/dev/null
    if test $? -ne 0; then
      echo "-----> Installing Busser ($version)"
      $gem install $gem_install_args
    else
      echo "-----> Busser installation detected ($version)"
    fi
    
    if test ! -f "$BUSSER_ROOT/bin/busser"; then
      gem_bindir=`$ruby -rrubygems -e "puts Gem.bindir"`
      $gem_bindir/busser setup
    fi
    
    echo "       Installing Busser plugins: $plugins"
    $busser plugin install $plugins
    ']
    >>>>>> ----------------------
    </default-ubuntu-1204></main></top></default-ubuntu-1204>
    评论

报告相同问题?