-
Notifications
You must be signed in to change notification settings - Fork 572
Failing with EC2 Amazon Linux Images? #72
Comments
Have the same problem with Centos 6.3 official ami (ami-a6e15bcf), which uses 'root' as the ssh user. Debug log shows the same problem with sudo. |
The README changes in this pull request seem to address a workaround for this very issue: |
Thanks for the semi-workaround. It seems to sort-of work for Amazon Linux (which supports cloud-init). It would be nice if there was a way to specify an inline shell command to run prior to the rsync step, that would allow us to perform an action similar to a cloud-init step, for amis that don't support it. |
+1 for support Amazon OS and its default setup using ec2-user |
Looks like I found a more reliable way to fix the problem. Use a boothook to perform the fix. I manually confirmed that a script passed as a Extra tip: And if you are relying on Usage sketch:
You can then pass the contents of 'combined.txt' to aws.user_data, for instance via:
|
Addendum: Bad news. It looks as if even a |
Is it really necessary to change the requiretty settings? I can script this without vagrant and without modifying sudoers by using the ssh "-t -t" option to force pseudo tty allocation (note that you do need to repeat the "-t" flag). Does/could the "env[:machine].communicate.sudo" method support passing such flags? I'm not sufficiently familiar with the Vagrant code base to find where that is implemented. |
I'd be interested in a solution more along the lines that @der is suggesting as well. Modifying |
Just a +1 from me after running into this today. |
For the time being, though: #!/bin/bash
# for debug if you want:
#set -x
# Remove old instance
vagrant destroy --force
# start up the new one, but don't bother to provision, it's going to fail
vagrant up --provider=aws --no-provision
# loop over the provision call until either it works or we've given up (10sec sleep, 12 tries = ~ 2-3 minutes)
count=0
while :
do
vagrant provision
code=$?
if [ $code -eq 0 ]; then
exit 0
fi
sleep 10
let count++
if [ $count -gt 12 ]; then
vagrant destroy --force
exit 1
fi
done |
+1 |
1 similar comment
+1 |
Are we sure that the above solution works on all AMIs? I found that after 15 tries, the retry still did not work. I think that retrying might not always fix this issue. |
I tried the official solution linked to above and while it does work on Log files from Vagrant
|
Hi miguno, (commented on Jul 2, 2013) - your boothook.sh approach worked beautifully for me on the Centos 7 AMI. Many thanks! I just used the .sh script without the complication of multipart-mime, as there is only one file to upload. |
I have no problems firing up Ubuntu instances on EC2 with vagrant-aws.
However, when I try to bring up Amazon Linux images, I get an error every time, which seems to be some problem related to sudo on the guest VM.
For example, based on this Vagrantfile:
Here is the failed output trying to bring up the instance:
If I try it again with debugging on, here is what I think is the relevant output:
Any thoughts?
Again, if I change only aws.ami to any Ubuntu flavored image (and override.ssh.username to 'ubuntu', too, of course) in the Vagrantfile pasted above, this works every time.
The text was updated successfully, but these errors were encountered: