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

Knife ec2 bug #370

Closed
deiserOP opened this issue Oct 29, 2015 · 9 comments
Closed

Knife ec2 bug #370

deiserOP opened this issue Oct 29, 2015 · 9 comments
Assignees

Comments

@deiserOP
Copy link

Good afternoon,

I'm new to using chef and was trying to use the knife ec2 plugin from my workstation (within the VPC) to create and bootstrap a instance in AWS. The instance creates fine, but the bootstrap component fails. Not being a complete expert with ruby, I'm not sure how to go about troubleshooting how or why it's failing. I did create a ticket with chef support, but haven't heard back. I did execute the command with DEBUG options and it doesn't offer much more than without the options. Could someone please offer my some insight or suggestions on how to move forward. If this isn't the appropriate area to pose such a question, please let me know where I should ask...

Here's the error I'm getting:

ERROR: knife encountered an unexpected error
This may be a bug in the 'ec2 server create' knife command or plugin
Please collect the output of this command with the -VV option before filing a bug report.
Exception: NoMethodError: undefined method `empty?' for nil:NilClass

As well as my command:

knife ec2 server create -I ami-e3106686 -f t2.medium -S knife -i .chef/knife.pem --subnet subnet-XXXXXX --ssh-user ec2-user --node-name test -VV

@deiserOP
Copy link
Author

deiserOP commented Nov 3, 2015

I ssh'd to the server that does get created in ec2 and checked out /var/log/secure. I see the following message from the chef workstation that is executing the bootstrap commands:
Did not receive identification string from "server IP"
I can confirm that the bootstrap process works fine if I execute it from the same chef workstation.
Any ideas?

@siddheshwar-more
Copy link

Hello @deiserOP

Could you please try below options with knife ec2 server create command-

--security-group-ids <VPC_security_group_id> --associate-public-ip --server-connect-attribute public_ip_address -VV

Note- for details of all options try command with --help option.
Let us know your result. Thanks.

@deiserOP
Copy link
Author

deiserOP commented Nov 4, 2015

We don't need any public IP's attached to the instances. These instances will reside inside of the VPC with only private IP's.

@ToasterTheBrave
Copy link

I'm seeing this as well. It still exists when using a public IP. Running

knife ec2 server create...

will bring up the server, but dies with that error just after connecting via ssh. I checked the message log, and it is able to connect over ssh, and the last message is a su to root.

Now, when I run

knife bootstrap [public ip]...

chef-client installs and runs successfully, adding the node to chef server

I hope that's helpful. Outside of this post, I wasn't able to find any confirmation that the error was occurring for anyone else.

@infinite-tape
Copy link

We're also seeing this issue bootstrapping inside of VPC deployment to private subnet IPs. Here is our creation command:

knife ec2 server create -I ami-df3549b5 --region us-east-1 -f t2.small -S qa -g sg-d657cbb2 -T CHEF_ENVIRONMENT=qa,LAYER=qa -i ~/.ssh/qa.pem -x ubuntu -E qa --node-name us-east-1c-qa-web01 --subnet subnet-04d16973 --bootstrap-version 12.4 -VV

Debugging output (superfluous and sensitive output redacted):

INFO: Using configuration from /Users/jesselegg/.chef/knife.rb
# ... <snip> ...
Instance ID: i-7e6be6c9
Flavor: t2.small
Image: ami-df3549b5
Region: us-east-1
Availability Zone: us-east-1b
Security Group Ids: sg-d657cbb2
Tags: CHEF_ENVIRONMENT: qa, LAYER: qa, Name: us-east-1c-qa-web01
SSH Key: qa

Waiting for EC2 to create the instance
DEBUG: Looking for key aws_connection_timeout and found value 600
......

Subnet ID: subnet-04d16973
Tenancy: default
Private IP Address: 10.34.1.209

# ... <snip> ...

Waiting for sshd access to become available
DEBUG: No ssh gateway found, making a direct connection
DEBUG: sshd accepting connections on 10.34.1.209, banner is SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3

DEBUG: Looking for key subnet_id and found value subnet-04d16973
done

DEBUG: Looking for key ssh_user and found value root
DEBUG: Looking for key winrm_user and found value ubuntu
DEBUG: Looking for key winrm_user and found value ubuntu
DEBUG: Looking for key ssh_port and found value 22
DEBUG: Looking for key winrm_port and found value 5985
DEBUG: Looking for key ssh_password and found value
DEBUG: Looking for key winrm_password and found value
DEBUG: Looking for key identity_file and found value /Users/jesselegg/.ssh/qa.pem
DEBUG: Looking for key distro and found value
DEBUG: Looking for key region and found value us-east-1
DEBUG: Looking for key use_iam_profile and found value false
DEBUG: Looking for key aws_session_token and found value
DEBUG: Looking for key template_file and found value
DEBUG: Looking for key bootstrap_template and found value
DEBUG: Looking for key environment and found value qa
DEBUG: Looking for key json_attributes and found value
DEBUG: Looking for key encrypted_data_bag_secret and found value false
DEBUG: Looking for key encrypted_data_bag_secret_file and found value
DEBUG: Looking for key s3_secret and found value
DEBUG: Looking for key secret and found value
DEBUG: Looking for key secret_file and found value
DEBUG: Looking for key node_ssl_verify_mode and found value
DEBUG: Looking for key node_verify_api_cert and found value
DEBUG: Looking for key bootstrap_no_proxy and found value
DEBUG: Looking for key bootstrap_url and found value
DEBUG: Looking for key bootstrap_install_command and found value
DEBUG: Looking for key bootstrap_wget_options and found value
DEBUG: Looking for key bootstrap_curl_options and found value
DEBUG: Looking for key bootstrap_vault_file and found value
DEBUG: Looking for key bootstrap_vault_json and found value
DEBUG: Looking for key bootstrap_vault_item and found value
DEBUG: Looking for key use_sudo_password and found value
ERROR: knife encountered an unexpected error
This may be a bug in the 'ec2 server create' knife command or plugin
Please collect the output of this command with the `-VV` option before filing a bug report.
Exception: NoMethodError: undefined method `empty?' for nil:NilClass

@btm
Copy link
Contributor

btm commented Nov 5, 2015

I was hitting this too, but I was focusing on the lack of debug output first and working on chef/chef#4137.

I'll work up a fix. In the interim the bug you're seeing is chef/chef#4131 and you need to pass a run list to work around it.

@btm btm self-assigned this Nov 5, 2015
@btm
Copy link
Contributor

btm commented Nov 6, 2015

Fixed by #374 and chef/chef#4149 (When merged and released)

@btm btm closed this as completed Nov 6, 2015
@ShadySQL
Copy link

I am having the same problem. How do I resolve this? I am running:
knife --version
Chef: 12.5.1

@btm
Copy link
Contributor

btm commented Aug 10, 2016

@ShadySQL You'll want to use the latest knife-ec2, 0.13.0, which was released on 8/8/16.

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

6 participants