Chef: knife bootstrap with --sudo --use-sudo-password doesn't work properly

Created on 10 Feb 2015  路  4Comments  路  Source: chef/chef

When using both --sudo and --use-sudo-password arguments to knife bootstrap, it does not seem to work properly. I am prompted to enter my SSH password, I enter it, and then I never get an actually-interactive chance to type the sudo password.

# knife --version
Chef: 11.18.0
# knife bootstrap noodle.our.org --sudo --use-sudo-password --ssh-user admin --run-list 'role[base-rhel]' -E production
Connecting to noodle.our.org
[email protected]'s password: MYSECRETPASSWORD
noodle.our.org [sudo] password for admin: Sorry, try again.
noodle.our.org [sudo] password for admin:
noodle.our.org sudo: pam_authenticate: Conversation error
Medium Sustaining Backlog Bug

Most helpful comment

Any update yet?
I'm having the exac same issue.

# knife --version
Chef: 13.2.20

# knife bootstrap 10.0.65.103 -x lukman -P -N mongo-rs3 --sudo --use-sudo-password
Doing old-style registration with the validation key at /data/dev01/chef/chef-repo/.chef/dev01-validator.pem...
Delete your validation key in order to use your user credentials instead

Connecting to 10.0.65.103
[email protected]'s password:
10.0.65.103 [sudo] password for lukman: Sorry, try again.
10.0.65.103 [sudo] password for lukman:
10.0.65.103 sudo: 1 incorrect password attempt

It works just fine when I include the password while running the knife command but I really don't want to do that.

All 4 comments

Still happening in

knife --version
Chef: 12.12.15

Any update yet?
I'm having the exac same issue.

# knife --version
Chef: 13.2.20

# knife bootstrap 10.0.65.103 -x lukman -P -N mongo-rs3 --sudo --use-sudo-password
Doing old-style registration with the validation key at /data/dev01/chef/chef-repo/.chef/dev01-validator.pem...
Delete your validation key in order to use your user credentials instead

Connecting to 10.0.65.103
[email protected]'s password:
10.0.65.103 [sudo] password for lukman: Sorry, try again.
10.0.65.103 [sudo] password for lukman:
10.0.65.103 sudo: 1 incorrect password attempt

It works just fine when I include the password while running the knife command but I really don't want to do that.

Having similar issues
Chef Infra Client version: 15.5.17

If i dont include the password in the command it doesn't even let me enter a password, just instantly fails with ERROR: Train::UserError: Sudo failed: Wrong sudo password.

# knife bootstrap 10.10.44.158 --ssh-identity-file ~/.ssh/id_rsa -U mradmin -P <password> -N master --use-sudo-password --sudo -V
INFO: Using configuration from /Users/admin/.chef/config.rb
Connecting to 10.10.44.158
The authenticity of host '10.10.44.158 ()' can't be established.
fingerprint is SHA256:UpgwYU9P5d8E6/l8xOWDjXOkLydyEqW2mvR7HIfdmVk.

Are you sure you want to continue connecting
? (Y/N) y
Connecting to 10.10.44.158
Performing legacy client registration with the validation key at /Users/admin/.chef/managedracks-validator.pem...
                                                                                                          Delete your validation key in order to use your user credentials for client registration instead.
Bootstrapping 10.10.44.158
 [10.10.44.158] [sudo] password for mradmin:
 [10.10.44.158] -----> Existing Chef Infra Client installation detected
 [10.10.44.158] Starting the first Chef Infra Client Client run...
 [10.10.44.158] Starting Chef Infra Client, version 15.7.32
 [10.10.44.158]
 [10.10.44.158] resolving cookbooks for run list: []
 [10.10.44.158]
 [10.10.44.158] Synchronizing Cookbooks:
 [10.10.44.158]
 [10.10.44.158] Installing Cookbook Gems:
Compiling Cookbooks...
[2020-02-20T15:40:36+00:00] WARN: Node master has an empty run list.
 [10.10.44.158] Converging 0 resources
 [10.10.44.158]
 [10.10.44.158]
 [10.10.44.158]
 [10.10.44.158] Running handlers:
 [10.10.44.158]
 [10.10.44.158] [2020-02-20T15:40:37+00:00] ERROR: Running exception handlers
 [10.10.44.158] Running handlers complete

 [10.10.44.158] [2020-02-20T15:40:37+00:00] ERROR: Exception handlers complete
 [10.10.44.158] Chef Infra Client failed. 0 resources updated in 04 seconds
 [10.10.44.158]
 [10.10.44.158] [2020-02-20T15:40:37+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
 [10.10.44.158] [2020-02-20T15:40:37+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
 [10.10.44.158] [2020-02-20T15:40:37+00:00] FATAL: Net::HTTPServerException: 403 "Forbidden"
ERROR: The following error occurred on 10.10.44.158:
ERROR: [sudo] password for mradmin:

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings