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

packer vm hangs in opsworks_berkshelf recipe #20

Closed
apanagiotou opened this issue Apr 21, 2016 · 6 comments
Closed

packer vm hangs in opsworks_berkshelf recipe #20

apanagiotou opened this issue Apr 21, 2016 · 6 comments

Comments

@apanagiotou
Copy link

apanagiotou commented Apr 21, 2016

Hello guys, thanks for this tool, seems great.

I have an issue installing it though. I run rake build it does everything and it hangs in executing the opsworks_berkshelf::intall recipe till is timed out.

virtualbox-iso: [2016-04-21T10:05:04+00:00] INFO: Processing package[opsworks-berkshelf] action remove (opsworks_berkshelf::purge line 1)
    virtualbox-iso: [2016-04-21T10:05:04+00:00] INFO: Processing gem_package[berkshelf] action purge (opsworks_berkshelf::purge line 6)
    virtualbox-iso: [2016-04-21T10:05:05+00:00] INFO: Processing log[delete repo] action nothing (opsworks_berkshelf::purge line 16)
    virtualbox-iso: [2016-04-21T10:05:05+00:00] INFO: Processing directory[/opt/aws/opsworks/current/berkshelf-cookbooks] action delete (opsworks_berkshelf::purge line 21)
    virtualbox-iso: [2016-04-21T10:05:05+00:00] INFO: Processing log[downloading] action nothing (opsworks_berkshelf::install line 8)
    virtualbox-iso: [2016-04-21T10:05:05+00:00] INFO: Processing package[git-core] action install (opsworks_berkshelf::install line 9)
    virtualbox-iso: [2016-04-21T10:05:05+00:00] INFO: Processing opsworks_commons_assets_installer[Try to install berkshelf prebuilt package] action install (opsworks_berkshelf::install line 18)
    virtualbox-iso: [Thu, 21 Apr 2016 10:05:05 +0000] downloader: Successfully created temporary download directory. (/var/lib/aws/opsworks/cache.stage1/opsworks_assets/opsworks-berkshelf.69wtBR4N)
    virtualbox-iso: [Thu, 21 Apr 2016 10:05:28 +0000] downloader: File size test passed.
    virtualbox-iso: [Thu, 21 Apr 2016 10:05:28 +0000] downloader: Checksum proof skipped.
    virtualbox-iso: [Thu, 21 Apr 2016 10:05:28 +0000] downloader: Successfully downloaded https://opsworks-instance-assets-us-east-1.s3.amazonaws.com/packages/ubuntu/14.04/opsworks-berkshelf_3.2.0-1_amd64.deb
    virtualbox-iso: [2016-04-21T10:05:28+00:00] WARN: Cloning resource attributes for package[opsworks-berkshelf] from prior resource (CHEF-3694)
    virtualbox-iso: [2016-04-21T10:05:28+00:00] WARN: Previous package[opsworks-berkshelf]: /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/recipes/purge.rb:1:in `from_file'
    virtualbox-iso: [2016-04-21T10:05:28+00:00] WARN: Current  package[opsworks-berkshelf]: /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_commons/providers/assets_installer.rb:6:in `block (2 levels) in class_from_file'
    virtualbox-iso: [2016-04-21T10:05:28+00:00] INFO: Processing package[opsworks-berkshelf] action install (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_commons/providers/assets_installer.rb line 6)
    virtualbox-iso: rm -rf /var/lib/aws/opsworks/cache.stage1/opsworks_assets/opsworks-berkshelf.69wtBR4N
    virtualbox-iso: [2016-04-21T10:05:32+00:00] INFO: Processing package[opsworks-berkshelf] action nothing (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_commons/providers/assets_installer.rb line 6)
    virtualbox-iso: [2016-04-21T10:05:32+00:00] INFO: Processing log[installing gem] action nothing (opsworks_berkshelf::install line 32)
    virtualbox-iso: [2016-04-21T10:05:32+00:00] INFO: Processing gem_package[berkshelf] action install (opsworks_berkshelf::install line 39)
    virtualbox-iso: [2016-04-21T10:05:32+00:00] INFO: Processing opsworks_berkshelf_runner[Install berkshelf cookbooks] action berks_install (opsworks_berkshelf::install line 54)
    virtualbox-iso: [2016-04-21T10:05:32+00:00] WARN: Cloning resource attributes for directory[/opt/aws/opsworks/current/berkshelf-cookbooks] from prior resource (CHEF-3694)
    virtualbox-iso: [2016-04-21T10:05:32+00:00] WARN: Previous directory[/opt/aws/opsworks/current/berkshelf-cookbooks]: /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/recipes/purge.rb:21:in `from_file'
    virtualbox-iso: [2016-04-21T10:05:32+00:00] WARN: Current  directory[/opt/aws/opsworks/current/berkshelf-cookbooks]: /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb:2:in `block in class_from_file'
    virtualbox-iso: [2016-04-21T10:05:32+00:00] INFO: Processing directory[/opt/aws/opsworks/current/berkshelf-cookbooks] action delete (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb line 2)
    virtualbox-iso: [2016-04-21T10:05:32+00:00] INFO: Processing ruby_block[Install the cookbooks specified in the Berksfile and their dependencies] action run (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb line 11)
cat     virtualbox-iso:
    virtualbox-iso: ================================================================================
    virtualbox-iso: Error executing action `run` on resource 'ruby_block[Install the cookbooks specified in the Berksfile and their dependencies]'
    virtualbox-iso: ================================================================================
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: Mixlib::ShellOut::CommandTimeout
    virtualbox-iso: --------------------------------
    virtualbox-iso: Command timed out after 1200s:
    virtualbox-iso: Command execeded allowed execution time, process terminated
    virtualbox-iso: ---- Begin output of /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks ----
    virtualbox-iso: STDOUT: Resolving cookbook dependencies...
    virtualbox-iso: Fetching cookbook index from https://supermarket.getchef.com...
    virtualbox-iso: STDERR:
    virtualbox-iso: ---- End output of /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks ----
    virtualbox-iso: Ran /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks returned
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: Cookbook Trace:
    virtualbox-iso: ---------------
    virtualbox-iso: /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_commons/libraries/shellout.rb:8:in `shellout'
    virtualbox-iso: /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb:13:in `block (3 levels) in class_from_file'
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: Resource Declaration:
    virtualbox-iso: ---------------------
    virtualbox-iso: # In /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb
    virtualbox-iso:
    virtualbox-iso: 11:   ruby_block 'Install the cookbooks specified in the Berksfile and their dependencies' do
    virtualbox-iso: 12:     block do
    virtualbox-iso: 13:       Chef::Log.info OpsWorks::ShellOut.shellout(
    virtualbox-iso: 14:         berks_install_command,
    virtualbox-iso: 15:         :cwd => ::File.dirname(OpsWorks::Berkshelf.berksfile),
    virtualbox-iso: 16:         :environment  => {
    virtualbox-iso: 17:           "BERKSHELF_PATH" => Opsworks::InstanceAgent::Environment.berkshelf_cache_path,
    virtualbox-iso: 18:           "LC_ALL" => "en_US.UTF-8"
    virtualbox-iso: 19:         }
    virtualbox-iso: 20:       )
    virtualbox-iso: 21:
    virtualbox-iso: 22:       ::FileUtils.rm_rf Opsworks::InstanceAgent::Environment.berkshelf_cache_path
    virtualbox-iso: 23:     end
    virtualbox-iso: 24:
    virtualbox-iso: 25:     only_if do
    virtualbox-iso: 26:       OpsWorks::Berkshelf.berkshelf_installed? && OpsWorks::Berkshelf.berksfile_available?
    virtualbox-iso: 27:     end
    virtualbox-iso: 28:   end
    virtualbox-iso: 29: end
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: Compiled Resource:
    virtualbox-iso: ------------------
    virtualbox-iso: # Declared in /var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb:11:in `block in class_from_file'
    virtualbox-iso:
    virtualbox-iso: ruby_block("Install the cookbooks specified in the Berksfile and their dependencies") do
    virtualbox-iso: action "run"
    virtualbox-iso: retries 0
    virtualbox-iso: retry_delay 2
    virtualbox-iso: block_name "Install the cookbooks specified in the Berksfile and their dependencies"
    virtualbox-iso: cookbook_name "opsworks_berkshelf"
    virtualbox-iso: block #<Proc:0x00564d457f1fc8@/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb:12>
    virtualbox-iso: only_if { #code block }
    virtualbox-iso: end
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso:
    virtualbox-iso: [2016-04-21T10:28:43+00:00] INFO: Running queued delayed notifications before re-raising exception
    virtualbox-iso: [2016-04-21T10:28:43+00:00] ERROR: Running exception handlers
    virtualbox-iso: [2016-04-21T10:28:43+00:00] ERROR: Exception handlers complete
    virtualbox-iso: [2016-04-21T10:28:43+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage1/chef-stacktrace.out
    virtualbox-iso: [2016-04-21T10:28:43+00:00] ERROR: ruby_block[Install the cookbooks specified in the Berksfile and their dependencies] (/var/lib/aws/opsworks/cache.stage1/cookbooks/opsworks_berkshelf/providers/runner.rb line 11) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 1200s:
    virtualbox-iso: Command execeded allowed execution time, process terminated
    virtualbox-iso: ---- Begin output of /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks ----
    virtualbox-iso: STDOUT: Resolving cookbook dependencies...
    virtualbox-iso: Fetching cookbook index from https://supermarket.chef.io...
    virtualbox-iso: STDERR:
    virtualbox-iso: ---- End output of /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks ----
    virtualbox-iso: Ran /opt/aws/opsworks/local/bin/berks vendor /opt/aws/opsworks/current/berkshelf-cookbooks returned
    virtualbox-iso: [2016-04-21T10:28:43+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
    virtualbox-iso: Waiting for process 10333
    virtualbox-iso: pid 10333 exited with status 256, exit code: 1 (time=1439 sec)
    virtualbox-iso: [2016-04-21 10:28:43] ERROR [opsworks-agent(10326)]: Chef run failed with exitcode 1
    virtualbox-iso: error: Chef run failed with exitcode 1
@eyemyth
Copy link

eyemyth commented May 11, 2016

Try adding this to the builders section of the template JSON:

"vboxmanage": [ ["modifyvm", "{{.Name}}", "--nictype1", "virtio"] ]

You can add other lines if you'd like to further modify the VM:

"vboxmanage": [ ["modifyvm", "{{.Name}}", "--memory", "1024"], ["modifyvm", "{{.Name}}", "--cpus", "2"], ["modifyvm", "{{.Name}}", "--nictype1", "virtio"] ]

@karlsvec
Copy link
Contributor

karlsvec commented Aug 2, 2016

I also ran into this issue, and was able to work around it by commenting out most of the cookbooks in the Berksfile that's created in provision/opsworks.sh.

@thomask
Copy link

thomask commented Jan 24, 2017

Having the same issue. Tried cloning @karlsvec feature branch, and doing rake build install from there, but no luck unfortunately.

@eyemyth Which template JSON are you referring to?

@karlsvec
Copy link
Contributor

@thomask Looks like my branch is out of date. There are more cookbooks that have moved to Chef 12 since then.

I think the following additional cookbooks need to be pinned for Chef 11 compatibility:

cookbook 'aws', '< 4.0.0'
cookbook 'postgresql', '< 6.0.0'

These are just a couple cookbooks from my own Chef repo's Berksfile that I noticed aren't in my modified provision/opsworks.sh from that branch. There may be more that need pinning -- you can double-check on https://supermarket.chef.io to see if there are any more cookbooks that have moved to requiring Chef 12+.

Let me know if you were able to get things running with these changes and I'll update my branch accordingly.

@karlsvec
Copy link
Contributor

looks like cron needs to be pinned also:

cookbook 'cron', '< 3.0.0'

@mikegreiling
Copy link
Member

This should be fixed with 6a6a97a. I locked what dependencies I could to versions I know were working for me. However, I may just remove this Berkshelf pre-fetch step altogether since the odds of downloading and caching the cookbooks at the exact locked version the user would find useful are slim. You may as well fork and supply your own Berksfile and Berksfile.lock if you want this to be helpful.

Either way, this should run now and no longer hang due to Chef 12 incompatibility. Thank you for the issue and the discussion!

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

No branches or pull requests

5 participants