chef / omnitruck

Web service to automate the release of Omnibus artifacts
Apache License 2.0
25 stars 34 forks source link

test-kitchen kitchen-converge: Errors were encountered while processing /tmp/omnibus/cache/chef_16.3.45-1_amd64.deb #476

Open xmichelleyang opened 4 years ago

xmichelleyang commented 4 years ago

:ghost: Brief Description

Currently going through the following walkthrough and hitting an error when I run kitchen-converge. https://kitchen.ci/docs/getting-started/creating-cookbook/

Version

Not sure what this means but all the versions of what tutorial told me to download are listed below:

Environment

Running on Windows 10 via PowerShell.

$ chef --version
Chef Workstation version: 20.8.111
Chef Infra Client version: 16.3.45
Chef InSpec version: 4.22.1
Chef CLI version: 3.0.16
Chef Habitat version: 1.6.56
Test Kitchen version: 2.5.4
Cookstyle version: 6.14.7

$ VBoxManage --version
6.1.12r139181

$ vagrant --version
Vagrant 2.2.9

$PSversionTable

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Scenario

I can't successfully run kitchen-converge

Steps to Reproduce

  1. chef generate cookbook git_cookbook
  2. Edit kitchen.yml like so
    
    ---
    driver:
    name: vagrant

provisioner: name: chef_zero

verifier: name: inspec

platforms:

suites:

  1. kitchen create default-ubuntu-2004
  2. Add package 'git' to recipes/default.rb
  3. kitchen converge

Expected Result

Excepted output like the one posted on tutorial: https://kitchen.ci/docs/getting-started/running-converge/

Actual Result

Got this result

-----> Converging <default-ubuntu-2004>...
       Preparing files for transfer
       Installing cookbooks for Policyfile C:/Users/micy/Documents/Kitchen/git_cookbook/Policyfile.rb using `chef install`
       Installing cookbooks from lock
       Installing git_cookbook 0.1.0
       Preparing dna.json
       Exporting cookbook dependencies from Policyfile C:/Users/micy/AppData/Local/Temp/default-ubuntu-2004-sandbox-20200812-25616-1uz9tul...
       Exported policy 'git_cookbook' to C:/Users/micy/AppData/Local/Temp/default-ubuntu-2004-sandbox-20200812-25616-1uz9tul

       To converge this system with the exported policy, run:
         cd C:/Users/micy/AppData/Local/Temp/default-ubuntu-2004-sandbox-20200812-25616-1uz9tul
         chef-client -z
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Installing Chef install only if missing package
       Downloading https://omnitruck.chef.io/install.sh to file /tmp/install.sh
       Trying wget...
       Download complete.
       ubuntu 20.04 x86_64
       Getting information for chef stable  for ubuntu...
       downloading https://omnitruck.chef.io/stable/chef/metadata?v=&p=ubuntu&pv=20.04&m=x86_64
         to file /tmp/install.sh.14896/metadata.txt
       trying wget...
       sha1     9f4ca8a682e53678899391ae08af026c8c455de1
       sha256   00b18c6060de4b93171ebf08cc5e465258a69ca24aaf7c35b280f272978c131f
       url      https://packages.chef.io/files/stable/chef/16.3.45/ubuntu/20.04/chef_16.3.45-1_amd64.deb
       version  16.3.45
       downloaded metadata file looks valid...
       downloading https://packages.chef.io/files/stable/chef/16.3.45/ubuntu/20.04/chef_16.3.45-1_amd64.deb
         to file /tmp/omnibus/cache/chef_16.3.45-1_amd64.deb
       trying wget...
       Comparing checksum with sha256sum...

       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

       You are installing a package without a version pin.  If you are installing
       on production servers via an automated process this is DANGEROUS and you will
       be upgraded without warning on new releases, even to new major releases.
       Letting the version float is only appropriate in desktop, test, development or
       CI/CD environments.

       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

       Installing chef
       installing with dpkg...
(Reading database ... 44445 files and directories currently installed.)
       Preparing to unpack .../cache/chef_16.3.45-1_amd64.deb ...
       Unpacking chef (16.3.45-1) ...
       dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
       dpkg-deb: error: <decompress> subprocess returned error exit status 2
       dpkg: error processing archive /tmp/omnibus/cache/chef_16.3.45-1_amd64.deb (--install):
        cannot copy extracted data for './opt/chef/embedded/lib/libcrypto.a' to '/opt/chef/embedded/lib/libcrypto.a.dpkg-new': unexpected end of file or stream
       Errors were encountered while processing:
        /tmp/omnibus/cache/chef_16.3.45-1_amd64.deb
       Installation failed
       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.

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-ubuntu-2004>.  Please see .kitchen/logs/default-ubuntu-2004.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration`
ssherman commented 4 years ago

I am running into this exact same problem

Vincenzo-Fox commented 4 years ago

Maybe I was the first one to have this problem on windows 10 using powershell and it happened over 4 months ago and no one could figure out why. I was able to fix it by starting work on Ubuntu 18.04.

jburns24 commented 4 years ago

I ran into this exact same. All on windows 10 in a powershell environment. I tested with the following versions Chef Workstation 20.6.62
Chef Workstation 20.9.158

and ChefDK 4.2.0

Each time I would chef generate cookbook and then try to converge the default ubuntu suite. Each time running into the same issue of downloading a corrupt deb file. I tried specifying other versions of chef omnibus and had the same issue with 16.5, 16.6 and 14.5.1. Each failure was the same but failed extracting a different part of the file from the deb.

This got me looking closer at the deb in my .kitchen\cache file and found that when sha1 of the file in my cache directory did not match the sha1 in the kitchen converge output. So there seems to be an issue in the kitchen converge where when the sha's of the files don't match it continues on. I tried deleting and redownloading this file 10's of times and always had the same issue. I tested in other shells (cmd, powershell, and git bash) in case it was in issue with wget being an alias for Invoke-Webrequest. All shells had the same problem.

TL'DR

Workaround was to manually download the deb

wget https://packages.chef.io/files/stable/chef/16.6.14/ubuntu/20.04/chef_16.6.14-1_amd64.deb -OutFile chef_16.6.14-1_amd64.deb

and put that file in my local users .kitchen\cache folder. Then my kitchen converge worked.