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

Chef installer permissions issue when using test-kitchen vagrant/virtualbox 16.04 #1406

Closed
AlexClineBB opened this issue Apr 23, 2018 · 4 comments

Comments

@AlexClineBB
Copy link

Description

Chef install fails on Ubuntu16.04 in vagrant/virtualbox test kitchen.

Kitchen Version

$ kitchen --version
Test Kitchen version 1.21.1

ChefDK Version

chef --version
Chef Development Kit Version: 2.1.11
chef-client version: 13.2.20
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.0
kitchen version: 1.20.0
inspec version: 1.33.1

Ruby Version

ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

Platform Version

$cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.10
DISTRIB_CODENAME=artful
DISTRIB_DESCRIPTION="Ubuntu 17.10"
$ uname -a
Linux aec-linux 4.15.16-041516-generic #201804080932 SMP Sun Apr 8 13:36:35 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Replication Case

kitchen.yml:

---
driver:
  name: vagrant

provisioner:
  name: chef_zero
  always_update_cookbooks: true

verifier:
  name: inspec

platforms:
  - name: ubuntu-16.04

suites:
  - name: default
    run_list:
      - recipe[bb_kerberosio::default]
    verifier:
      inspec_tests:
        - test/smoke/default
    attributes:

Running kitchen test results in the failed chef download you can see in the output below. I've tried downgrading to test-kitchen version 1.20 with the same error. I was able to run my tests using the docker driver, but vagrant will not work.

It's not clear to me if this is a problem with the permissions configured in the chef install.sh file, or the bento image. If there's something I'm missing, please let me know.

Here's the /tmp directory on the VM:

vagrant@default-ubuntu-1604:/tmp$ ls -l
total 36
-rw-r--r-- 1 root root 23425 Apr 23 02:41 install.sh
drwx------ 2 root root  4096 Apr 23 02:41 install.sh.1489
drwxr-xr-x 3 root root  4096 Apr 23 02:41 omnibus
-rw-r--r-- 1 root root   527 Apr 23 02:41 stderr

Kitchen Output

$ kitchen test                                                                                                                                          
-----> Starting Kitchen (v1.21.1)                                                                                                                                                                                           
-----> Cleaning up any prior instances of <default-ubuntu-1604>                                                                                                                                                             
-----> Destroying <default-ubuntu-1604>...                                                                                                                                                                                  
       ==> default: Forcing shutdown of VM...                                                                                                                                                                               
       ==> default: Destroying VM and associated drives...                                                                                                                                                                  
       Vagrant instance <default-ubuntu-1604> destroyed.                                                                                                                                                                    
       Finished destroying <default-ubuntu-1604> (0m4.15s).                                                                                                                                                                 
-----> Testing <default-ubuntu-1604>                                                                                                                                                                                        
-----> Creating <default-ubuntu-1604>...                                                                                                                                                                                    
       Bringing machine 'default' up with 'virtualbox' provider...                                                                                                                                                          
       ==> default: Importing base box 'bento/ubuntu-16.04'...                                                                                                                                                              
==> default: Matching MAC address for NAT networking...                                                                                                                                                                     
       ==> default: Checking if box 'bento/ubuntu-16.04' is up to date...                                                                                                                                                   
       ==> default: Setting the name of the VM: default-ubuntu-1604_default_1524451250864_29912                                                                                                                             
       ==> default: Clearing any previously set network interfaces...                                                                                                                                                       
       ==> default: Preparing network interfaces based on configuration...                                                                                                                                                  
           default: Adapter 1: nat                                                                                                                                                                                          
       ==> default: Forwarding ports...                                                                                                                                                                                     
           default: 22 (guest) => 2222 (host) (adapter 1)                                                                                                                                                                   
       ==> default: Booting VM...                                                                                                                                                                                           
       ==> default: Waiting for machine to boot. This may take a few minutes...                                                                                                                                             
           default: SSH address: 127.0.0.1:2222                                                                                                                                                                             
           default: SSH username: vagrant                                                                                                                                                                                   
           default: SSH auth method: private key                                                                                                                                                                            
           default:                                                                                                                                                                                                         
           default: Vagrant insecure key detected. Vagrant will automatically replace                                                                                                                                       
           default: this with a newly generated keypair for better security.                                                                                                                                                
           default:                                                                                                                                                                                                         
           default: Inserting generated public key within guest...                                                                                                                                                          
           default: Removing insecure key from the guest if it's present...                                                                                                                                                 
           default: Key inserted! Disconnecting and reconnecting using new SSH key...                                                                                                                                       
       ==> default: Machine booted and ready!                                                                                                                                                                               
       ==> default: Checking for guest additions in VM...                                                                                                                                                                   
       ==> default: Setting hostname...                                                                                                                                                                                     
       ==> default: Mounting shared folders...                                                                                                                                                                              
           default: /tmp/omnibus/cache => /home/alex.cline/.kitchen/cache                                                                                                                                                   
       ==> default: Machine not provisioned because `--no-provision` is specified.                                                                                                                                          
       [SSH] Established                                                                                                                                                                                                    
       Vagrant instance <default-ubuntu-1604> created.                                                                                                                                                                      
       Finished creating <default-ubuntu-1604> (0m38.98s).                                                                                                                                                                  
-----> Converging <default-ubuntu-1604>...                                                                                                                                                                                  
       Preparing files for transfer                                                                                                                                                                                         
       Preparing dna.json                                                                                                                                                                                                   
       Resolving cookbook dependencies with Berkshelf 6.3.2...                                                                                                                                                              
       Removing non-cookbook files before transfer                                                                                                                                                                          
       Preparing validation.pem                                                                                                                                                                                             
       Preparing client.rb
-----> Installing Chef Omnibus (install only if missing)
       Downloading https://omnitruck.chef.io/install.sh to file /tmp/install.sh
       Trying wget...
       Download complete.
       ubuntu 16.04 x86_64
       Getting information for chef stable  for ubuntu...
       downloading https://omnitruck.chef.io/stable/chef/metadata?v=&p=ubuntu&pv=16.04&m=x86_64
         to file /tmp/install.sh.1489/metadata.txt
       trying wget...
       sha1     350c16f0e2ec2ef85a882f917b4c5754661768dd
       sha256   469d2fc75501d2c1150210042351adacc8972398145d014add337315593b5920
       url      https://packages.chef.io/files/stable/chef/14.0.202/ubuntu/16.04/chef_14.0.202-1_amd64.deb
       version  14.0.202
       downloaded metadata file looks valid...
       downloading https://packages.chef.io/files/stable/chef/14.0.202/ubuntu/16.04/chef_14.0.202-1_amd64.deb
         to file /tmp/omnibus/cache/chef_14.0.202-1_amd64.deb
       trying wget...
       trying curl...
       /tmp/install.sh: 139: /tmp/install.sh: cannot create /tmp/omnibus/cache/chef_14.0.202-1_amd64.deb: Protocol error
       grep: /tmp/install.sh.1489/stderr: No such file or directory
       trying perl...
       /tmp/install.sh: 169: /tmp/install.sh: cannot create /tmp/omnibus/cache/chef_14.0.202-1_amd64.deb: Protocol error
       grep: /tmp/install.sh.1489/stderr: No such file or directory
       trying python...
       /tmp/install.sh: 190: /tmp/install.sh: cannot create /tmp/omnibus/cache/chef_14.0.202-1_amd64.deb: Protocol error
       grep: /tmp/install.sh.1489/stderr: No such file or directory
       Unable to retrieve a valid package!
       Version: 
       
       Please file a Bug Report at https://github.com/chef/omnitruck/issues/new
       Alternatively, feel free to open a Support Ticket at https://www.chef.io/support/tickets
       More Chef support resources can be found at https://www.chef.io/support
       
       Please include as many details about the problem as possible i.e., how to reproduce
       the problem (if possible), type of the Operating System and its version, etc.,
       and any other relevant details that might help us with troubleshooting.
       
       Metadata URL: https://omnitruck.chef.io/stable/chef/metadata?v=&p=ubuntu&pv=16.04&m=x86_64
       Download URL: https://packages.chef.io/files/stable/chef/14.0.202/ubuntu/16.04/chef_14.0.202-1_amd64.deb
       
       DEBUG OUTPUT FOLLOWS:
       
       STDERR from wget:
       
       /tmp/omnibus/cache/chef_14.0.202-1_amd64.deb: Protocol error
>>>>>> ------Exception-------                          
>>>>>> Class: Kitchen::ActionFailed                    
>>>>>> Message: 1 actions failed.                      
>>>>>>     Converge failed on instance <default-ubuntu-1604>.  Please see .kitchen/logs/default-ubuntu-1604.log for more details                                                                                            
>>>>>> ----------------------                          
>>>>>> Please see .kitchen/logs/kitchen.log for more details                                                  
>>>>>> Also try running `kitchen diagnose --all` for configuration   

Kitchen Diagnose

https://gist.github.com/AlexClineBB/3c54006d1c7cbe42b68d696d08b5a4dc

@cheeseplus
Copy link

I am unable to replicate this issue which at least tells me a few things about what is likely the cause. This means it's unlikely to be the box itself and more likely something related to the Host OS and shared folders. First thing I'd try is:

---
driver:
  name: vagrant
  cache_directory: false

kitchen-vagrant, unlike most other drivers, allows for caching of the downloaded binary and serves it up over a shared folder. That said, shared folders are regularly a source of all manner of bizarre issues (symlinks break, permission weirdness, distro specific issues) so disabling them from the mix can be helpful. We only automatically enable this with bento boxes and only a subset of them that we are confident to be working in most scenarios.

Try that and let us know how it goes!

@AlexClineBB
Copy link
Author

Thank you @cheeseplus. Your suggestion resolved the problem. I'm closing this as resolve.

@cheeseplus
Copy link

This also could be related to the Vagrant and VirtualBox versions being used so if you want to add those for posterity we can keep an eye out as this is the first time I've seen this kind of behaviour.

@lock
Copy link

lock bot commented Aug 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants