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

ec2 server create command is failing while bootstrap #650

Closed
dheerajd-msys opened this issue Jun 23, 2020 · 1 comment
Closed

ec2 server create command is failing while bootstrap #650

dheerajd-msys opened this issue Jun 23, 2020 · 1 comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@dheerajd-msys
Copy link
Contributor

Version:

master branch of knife-ec2

Environment:

ubuntu 18.04

Scenario:

ec2 server create command

Steps to Reproduce:

Run knife ec2 server create command

Expected Result:

It should create the server as well as finish bootstrap successfully

Actual Result:

Bootstrap fails with *Net::HTTPServerException: 401 "Unauthorized**"

bundle exec knife ec2 server create -I ami-xxxxxxx -U ubuntu -N ddubey-ubu-msys --sudo -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb --region us-east-1 --use-sudo-password --yes -VV
INFO: Using configuration from /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 16
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at /etc/chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at /etc/chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region us-east-1
DEBUG: Setting up AWS connection using aws_access_key_id: ASIAXXXXXXXXXXXXXXXX aws_secret_access_key: HTc+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token: FwoGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Generated keypair file: /home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-cbcf83cd1aff1bc53740.pem

Waiting for EC2 to create the instance
Instance ID: i-050d5b895da2df946
Flavor: m1.small
Image: ami-xxxxxxxxx
Region: us-east-1
Availability Zone: us-east-1a
AWS Tags: Name: ddubey-ubu-msys
SSH Key: ubuntu-cbcf83cd1aff1bc53740
T2/T3 Unlimited: Disabled

Public DNS Name: ec2-xxxxxxx.compute-1.amazonaws.com
Public IP Address: xxxxxxx
Private DNS Name: ip-172-31-11-103.ec2.internal
Private IP Address: 172.31.11.103

Waiting for sshd access to become available
SSH Target Address: ec2-xxxxxxx.compute-1.amazonaws.com(public_dns_name)
DEBUG: No ssh gateway found, making a direct connection
DEBUG: sshd accepting connections on ec2-xxxxx.compute-1.amazonaws.com, banner is SSH-2.0-OpenSSH_8.2p1 Ubuntu-4

done

SSH Target Address: ec2-xxxxx.compute-1.amazonaws.com(public_dns_name)
Connecting to ec2-xxxxx.compute-1.amazonaws.com
DEBUG: [SSH] opening connection to [email protected]
DEBUG: [SSH] using options {:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "publickey"], :keys_only=>true, :keys=>["/home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-cbcf83cd1aff1bc53740.pem"], :password=>"<hidden>", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:always}
Connecting to ec2-xxxxxx.compute-1.amazonaws.com
DEBUG: [SSH] opening connection to [email protected]
DEBUG: [SSH] using options {:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "publickey"], :keys_only=>true, :keys=>["/home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-cbcf83cd1aff1bc53740.pem"], :password=>"<hidden>", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}
DEBUG: [SSH] [email protected] cmd = cmd.exe /c ver
DEBUG: [SSH] [email protected] cmd = Get-WmiObject Win32_OperatingSystem | Select Caption,Version | ConvertTo-Json
DEBUG: [SSH] [email protected] cmd = uname -s
DEBUG: [SSH] [email protected] cmd = uname -m
DEBUG: [SSH] [email protected] cmd = test -f /etc/debian_version
DEBUG: [SSH] [email protected] cmd = test -f /etc/lsb-release && cat /etc/lsb-release
DEBUG: [SSH] [email protected] cmd = sh -c '(sudo echo) < /dev/null'
DEBUG: [SSH] [email protected] cmd = sudo echo '[SSH] Established'
**bundler: failed to load command: knife (/home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/bin/knife)**
**Net::HTTPServerException: 401 "Unauthorized**"
  /opt/chef-workstation/embedded/lib/ruby/2.7.0/net/http/response.rb:124:in `error!'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/http.rb:152:in `request'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/http.rb:115:in `get'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap/client_builder.rb:191:in `resource_exists?'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap/client_builder.rb:176:in `sanity_check'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap/client_builder.rb:55:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap.rb:578:in `register_client'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap.rb:557:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife.rb:490:in `block in run_with_pretty_exceptions'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/local_mode.rb:42:in `with_server_connectivity'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife.rb:489:in `run_with_pretty_exceptions'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife.rb:229:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/application/knife.rb:163:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/bin/knife:24:in `<top (required)>'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/bin/knife:23:in `load'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/bin/knife:23:in `<top (required)>'
dheerajdubey@PUN-LAP-DHEERAJ:~/Chef_Repo/knife-ec2$
@dheerajd-msys
Copy link
Contributor Author

It is working as expected with current code :

bundle exec knife ec2 server create -I ami-0bcc094591f354be2 -U ubuntu -N ddubey-ubu-msys-testnow --sudo -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb --region us-east-1 --use-sudo-password --yes

Generated keypair file: /home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-45d4d22beeeb53c54c07.pem

Waiting for EC2 to create the instance
Instance ID: i-0ecab8ae55662f779
Flavor: m1.small
Image: ami-0bcc094591f354be2
Region: us-east-1
Availability Zone: us-east-1a
AWS Tags: Name: ddubey-ubu-msys-testnow
SSH Key: ubuntu-45d4d22beeeb53c54c07
T2/T3 Unlimited: Disabled

Public DNS Name: ec2-3-222-113-99.compute-1.amazonaws.com
Public IP Address: 3.222.113.99
Private DNS Name: ip-172-31-3-21.ec2.internal
Private IP Address: 172.31.3.21

Waiting for sshd access to become available
SSH Target Address: ec2-3-222-113-99.compute-1.amazonaws.com(public_dns_name)
done

SSH Target Address: ec2-3-222-113-99.compute-1.amazonaws.com(public_dns_name)
Connecting to ec2-3-222-113-99.compute-1.amazonaws.com using ssh
Connecting to ec2-3-222-113-99.compute-1.amazonaws.com using ssh
Creating new client for ddubey-ubu-msys-testnow
Creating new node for ddubey-ubu-msys-testnow
Bootstrapping ec2-3-222-113-99.compute-1.amazonaws.com
 [ec2-3-222-113-99.compute-1.amazonaws.com] -----> Installing Chef Omnibus (stable/16)
downloading https://omnitruck.chef.io/chef/install.sh
  to file /tmp/install.sh.1516/install.sh
 [ec2-3-222-113-99.compute-1.amazonaws.com] trying wget...
 [ec2-3-222-113-99.compute-1.amazonaws.com] ubuntu 18.04 x86_64
Getting information for chef stable 16 for ubuntu...
downloading https://omnitruck.chef.io/stable/chef/metadata?v=16&p=ubuntu&pv=18.04&m=x86_64
  to file /tmp/install.sh.1520/metadata.txt
 [ec2-3-222-113-99.compute-1.amazonaws.com] trying wget...
 [ec2-3-222-113-99.compute-1.amazonaws.com] sha1	9f4ca8a682e53678899391ae08af026c8c455de1
sha256	00b18c6060de4b93171ebf08cc5e465258a69ca24aaf7c35b280f272978c131f
url	https://packages.chef.io/files/stable/chef/16.3.45/ubuntu/18.04/chef_16.3.45-1_amd64.deb
version	16.3.45
 [ec2-3-222-113-99.compute-1.amazonaws.com] 
 [ec2-3-222-113-99.compute-1.amazonaws.com] downloaded metadata file looks valid...
 [ec2-3-222-113-99.compute-1.amazonaws.com] downloading https://packages.chef.io/files/stable/chef/16.3.45/ubuntu/18.04/chef_16.3.45-1_amd64.deb
  to file /tmp/install.sh.1520/chef_16.3.45-1_amd64.deb
 [ec2-3-222-113-99.compute-1.amazonaws.com] trying wget...
 [ec2-3-222-113-99.compute-1.amazonaws.com] Comparing checksum with sha256sum...
 [ec2-3-222-113-99.compute-1.amazonaws.com] Installing chef 16
installing with dpkg...
 [ec2-3-222-113-99.compute-1.amazonaws.com] Selecting previously unselected package chef.
 [ec2-3-222-113-99.compute-1.amazonaws.com] (Reading database ... 57084 files and directories currently installed.)
 [ec2-3-222-113-99.compute-1.amazonaws.com] Preparing to unpack .../chef_16.3.45-1_amd64.deb ...
 [ec2-3-222-113-99.compute-1.amazonaws.com] Unpacking chef (16.3.45-1) ...
 [ec2-3-222-113-99.compute-1.amazonaws.com] Setting up chef (16.3.45-1) ...
 [ec2-3-222-113-99.compute-1.amazonaws.com] Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io
 [ec2-3-222-113-99.compute-1.amazonaws.com] Starting the first Chef Infra Client Client run...
 [ec2-3-222-113-99.compute-1.amazonaws.com] +---------------------------------------------+
✔ 2 product licenses accepted.
+---------------------------------------------+
 [ec2-3-222-113-99.compute-1.amazonaws.com] Starting Chef Infra Client, version 16.3.45
 [ec2-3-222-113-99.compute-1.amazonaws.com] 
 [ec2-3-222-113-99.compute-1.amazonaws.com] resolving cookbooks for run list: []
 [ec2-3-222-113-99.compute-1.amazonaws.com] 
 [ec2-3-222-113-99.compute-1.amazonaws.com] Synchronizing Cookbooks:
 [ec2-3-222-113-99.compute-1.amazonaws.com] 
 [ec2-3-222-113-99.compute-1.amazonaws.com] Installing Cookbook Gems:
Compiling Cookbooks...
 [ec2-3-222-113-99.compute-1.amazonaws.com] [2020-08-11T12:27:04+00:00] WARN: Node ddubey-ubu-msys-testnow has an empty run list.
 [ec2-xxxxx.compute-1.amazonaws.com] Converging 0 resources
 [ec2-xxxxx.compute-1.amazonaws.com] 
 [ec2-xxxxx.compute-1.amazonaws.com] 
 [ec2-xxxxx.compute-1.amazonaws.com] Running handlers:
 [ec2-xxxxx.compute-1.amazonaws.com] 
 [ec2-xxxxx.compute-1.amazonaws.com] Running handlers complete
 [ec2-xxxxx.compute-1.amazonaws.com] Chef Infra Client finished, 0/0 resources updated in 03 seconds
 [ec2-xxxxx.compute-1.amazonaws.com] 

Instance ID: i-0ecab8ae55662f779
Flavor: m1.small
Image: ami-xxxx
Region: us-east-1
Availability Zone: us-east-1a
Security Group Ids: sg-166d9563
AWS Tags: Name: ddubey-ubu-msys-testnow
SSH Key: ubuntu-45d4d22beeeb53c54c07
Root Device Type: ebs
Root Device Name: /dev/sda1
Root Volume ID: vol-0dd033a81ede86893
Root Device Delete on Terminate: true

Block devices
===========================
Device Name: /dev/sda1
Volume ID: vol-0dd033a81ede86893
Delete on Terminate: true

===========================
Public DNS Name: ec2-xxxx.compute-1.amazonaws.com
Public IP Address: xxxxxx
Private DNS Name: ip-172-31-3-21.ec2.internal
Private IP Address: 172.31.3.21
Environment: _default
JSON Attributes: {"run_list"=>[]}

Closing the issue now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

1 participant