include_recipe "lxc::default"
lxc_container 'precise1' do
action :create
chef_enabled false
initialize_commands ['apt-get update', 'apt-get install openssh-server']
static_ip '10.0.3.6'
static_netmask '255.255.255.0'
static_gateway '10.0.3.1'
end
lxc_service 'precise1' do
action :start
end
I can't seem to fire up an LXC guest with this cookbook. I get the following errors:
- execute the ruby block lxc start[precise1]
* ruby_block[lxc initialize_commands[precise1]] action run[2014-12-09T08:52:18+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:21+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:25+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:28+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:31+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:35+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:38+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:39+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:42+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:46+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:49+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:52+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:56+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:52:59+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:00+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:04+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:07+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:10+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:13+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:17+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:20+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:21+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:25+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:28+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:31+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:34+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:38+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:41+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:42+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:46+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:49+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:52+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:56+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:53:59+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:02+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:03+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:07+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:10+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:13+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:17+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:20+00:00] WARN: LXC IP discovery: Failed to detect live IP
[2014-12-09T08:54:23+00:00] WARN: LXC IP discovery: Failed to detect live IP
================================================================================
Error executing action `run` on resource 'ruby_block[lxc initialize_commands[precise1]]'
================================================================================
Lxc::CommandFailed
------------------
Expected process to exit with [0], but received '255'
---- Begin output of ssh root@ -i /opt/hw-lxc-config/id_rsa -oStrictHostKeyChecking=no 'apt-get update' ----
STDOUT:
STDERR: ssh: Could not resolve hostname : Name or service not known
---- End output of ssh root@ -i /opt/hw-lxc-config/id_rsa -oStrictHostKeyChecking=no 'apt-get update' ----
Ran ssh root@ -i /opt/hw-lxc-config/id_rsa -oStrictHostKeyChecking=no 'apt-get update' returned 255
Cookbook Trace:
---------------
/home/ubuntu/.chef/local-mode-cache/cache/cookbooks/lxc/providers/container.rb:228:in `block (4 levels) in class_from_file'
/home/ubuntu/.chef/local-mode-cache/cache/cookbooks/lxc/providers/container.rb:226:in `each'
/home/ubuntu/.chef/local-mode-cache/cache/cookbooks/lxc/providers/container.rb:226:in `block (3 levels) in class_from_file'
Resource Declaration:
---------------------
# In /home/ubuntu/.chef/local-mode-cache/cache/cookbooks/lxc/providers/container.rb
224: ruby_block "lxc initialize_commands[#{new_resource.name}]" do
225: block do
226: new_resource.initialize_commands.each do |cmd|
227: Chef::Log.info "Running command on #{new_resource.name}: #{cmd}"
228: _lxc.container_command(cmd, 5)
229: end
230: end
231: only_if do
232: node.run_state[:lxc][:meta][new_resource.name][:new_container] &&
233: !new_resource.initialize_commands.empty?
234: end
235: end
236:
Compiled Resource:
------------------
# Declared in /home/ubuntu/.chef/local-mode-cache/cache/cookbooks/lxc/providers/container.rb:224:in `block in class_from_file'
ruby_block("lxc initialize_commands[precise1]") do
action "run"
retries 0
retry_delay 2
guard_interpreter :default
block_name "lxc initialize_commands[precise1]"
cookbook_name "myapp"
block #<Proc:0x00000003c1cef8@/home/ubuntu/.chef/local-mode-cache/cache/cookbooks/lxc/providers/container.rb:225>
only_if { #code block }
end
Running handlers:
[2014-12-09T08:54:23+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-12-09T08:54:23+00:00] ERROR: Exception handlers complete
[2014-12-09T08:54:23+00:00] FATAL: Stacktrace dumped to /home/ubuntu/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 8 resources updated in 133.547317597 seconds
[2014-12-09T08:54:23+00:00] ERROR: ruby_block[lxc initialize_commands[precise1]] (/home/ubuntu/.chef/local-mode-cache/cache/cookbooks/lxc/providers/container.rb line 224) had an error: Lxc::CommandFailed: Expected process to exit with [0], but received '255'
---- Begin output of ssh root@ -i /opt/hw-lxc-config/id_rsa -oStrictHostKeyChecking=no 'apt-get update' ----
STDOUT:
STDERR: ssh: Could not resolve hostname : Name or service not known
---- End output of ssh root@ -i /opt/hw-lxc-config/id_rsa -oStrictHostKeyChecking=no 'apt-get update' ----
Ran ssh root@ -i /opt/hw-lxc-config/id_rsa -oStrictHostKeyChecking=no 'apt-get update' returned 255
[2014-12-09T08:54:23+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
I've tried to see if it's something I'm doing wrong, but I can't figure that out.
If i use this:
I can't seem to fire up an LXC guest with this cookbook. I get the following errors:
I've tried to see if it's something I'm doing wrong, but I can't figure that out.