Getting "sudo: 3 incorrect password attempts" when building an Ubuntu box

1,488 views
Skip to first unread message

Behrang Saeedzadeh

unread,
Mar 30, 2014, 9:03:53 AM3/30/14
to packe...@googlegroups.com
I am trying to build an Ubuntu 12.04.4 box with Packer, but the installation halts with failed login attempts:

==> virtualbox-iso: Gracefully halting virtual machine...
    virtualbox-iso: [sudo] password for vagrant: Sorry, try again.
    virtualbox-iso: [sudo] password for vagrant:
    virtualbox-iso: Sorry, try again.
    virtualbox-iso: [sudo] password for vagrant:
    virtualbox-iso: Sorry, try again.
    virtualbox-iso: sudo: 3 incorrect password attempts

My packer.json and dbseed.cfg files can be viewed here: 


And here's the output of Packer while trying to build the box (it seems to me that halting prior to the sudo command is not successful and the sudo commands are executed before the machine boots back up):

$ packer build quasar-7.json
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying Guest additions checksums
    virtualbox-iso: Downloading or copying: http://download.virtualbox.org/virtualbox/4.3.8/SHA256SUMS
==> virtualbox-iso: Downloading or copying Guest additions
==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: http://releases.ubuntu.com/12.04/ubuntu-12.04.4-server-amd64.iso
==> virtualbox-iso: Starting HTTP server on port 8081
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for SSH (host port 3213)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso --memory 2048
    virtualbox-iso: Executing: modifyvm packer-virtualbox-iso --cpus 1
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 15s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for SSH to become available...
==> virtualbox-iso: Connected to SSH!
==> virtualbox-iso: Uploading VirtualBox version info (4.3.8)
==> virtualbox-iso: Uploading VirtualBox guest additions ISO...
==> virtualbox-iso: Provisioning with shell script: scripts/vagrant.sh
    virtualbox-iso: [sudo] password for vagrant: --2014-03-30 23:49:12--  https://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub
    virtualbox-iso: Resolving github.com (github.com)... 192.30.252.128
    virtualbox-iso: Connecting to github.com (github.com)|192.30.252.128|:443... connected.
    virtualbox-iso: HTTP request sent, awaiting response... 302 Found
    virtualbox-iso: Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133
    virtualbox-iso: Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected.
    virtualbox-iso: HTTP request sent, awaiting response... 200 OK
    virtualbox-iso: Length: 409 [text/plain]
    virtualbox-iso: Saving to: `authorized_keys'
    virtualbox-iso:
    virtualbox-iso: 100% 409         --.-K/s   in 0s
    virtualbox-iso:
    virtualbox-iso: 2014-03-30 23:49:15 (11.1 MB/s) - `authorized_keys' saved [409/409]
    virtualbox-iso:
==> virtualbox-iso: Provisioning with shell script: scripts/compact.sh
    virtualbox-iso: [sudo] password for vagrant: dd: writing `/junk': No space left on device
    virtualbox-iso: 35868+0 records in
    virtualbox-iso: 35867+0 records out
    virtualbox-iso: 37609484288 bytes (38 GB) copied, 87.1101 s, 432 MB/s
==> virtualbox-iso: Gracefully halting virtual machine...
    virtualbox-iso: [sudo] password for vagrant: Sorry, try again.
    virtualbox-iso: [sudo] password for vagrant:
    virtualbox-iso: Sorry, try again.
    virtualbox-iso: [sudo] password for vagrant:
    virtualbox-iso: Sorry, try again.
    virtualbox-iso: sudo: 3 incorrect password attempts

And ideas what am I missing here?

Thanks in advance,
Behrang 

Alvaro Miranda Aguilera

unread,
Mar 30, 2014, 6:11:00 PM3/30/14
to packe...@googlegroups.com

On Mon, Mar 31, 2014 at 2:03 AM, Behrang Saeedzadeh <behr...@gmail.com> wrote:
    virtualbox-iso: [sudo] password for vagrant: dd: writing `/junk': No space left on device

Hello,

From the log I can see the cycle is like this.

- connects over ssh
- disk run out of space (non related, I assume is to put zeroes, etc.)
- try to send shutdown command
 - sudo error..

that is what I see from the log you pasted here

Perhaps the error is here.

"shutdown_command":"echo 'packer' | sudo -S shutdown -P now",
"ssh_username":"vagrant",
"ssh_password":"vagrant",

If the password is vagrant, shouldn't be like:

"shutdown_command":"echo 'vagrant' | sudo -S shutdown -P now",
"ssh_username":"vagrant",
"ssh_password":"vagrant",
??

Alvaro

Mike Dillion

unread,
Mar 30, 2014, 3:26:50 PM3/30/14
to packe...@googlegroups.com
Behrang,

Check out Mitchell's packer-ubuntu-12.04-docker repo (http://github.com/mitchellh/packer-ubuntu-12.04-docker/blob/master/scripts/vagrant.sh). Especially the script that sets NOPASSWD sudo for the vagrant user (https://github.com/mitchellh/packer-ubuntu-12.04-docker/blob/master/scripts/vagrant.sh#L3). You could get around this by using the default ubuntu user with packer and vagrant itself (config.ssh.username).

But generally, checkout the scripts and their provisioner sections in that repo to get a better picture of what Packer is doing.

Cheers!
Mike Dillion


--
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages