audiolize / vagrant-softlayer

This is a Vagrant plugin that adds a SoftLayer provider to Vagrant, allowing Vagrant to control and provision SoftLayer CCI instances.
MIT License
42 stars 15 forks source link

Vagrant Up fails #11

Closed poflynn closed 10 years ago

poflynn commented 10 years ago

After this runs I do have a running, unprovisioned box so I can ssh in, visudo and remove the 'requiretty' option, quit, 'vagrant provision' and then it runs. But as I have no control over the "box" image, how do I work around this?

Thx

[paul.oflynn@localhost vagrant]$ vagrant up
Bringing machine 'default' up with 'softlayer' provider...
==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead.
==> default: This is a bug with the provider. Please contact the creator
==> default: of the provider you use to fix this.
==> default: Creating a new SoftLayer instance...
==> default: Waiting for instance provisioning. This may take a few minutes...
==> default: SoftLayer instance successfully provisioned!
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: xx.xx.xx.xx:22
    default: SSH username: root
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Rsyncing folder: /home/paul.oflynn/vagrant/ => /vagrant
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p '/vagrant'

Stdout from the command:

Stderr from the command:

sudo: sorry, you must have a tty to run sudo

[paul.oflynn@localhost vagrant]$
poflynn commented 10 years ago

Don't know if this is in the control of a plug-in vs vagrant proper but there are some solutions noted here http://www.cyberciti.biz/faq/linux-unix-bsd-sudo-sorry-you-must-haveattytorun/

ju2wheels commented 10 years ago

Thats expected behavior, have you tried config.ssh.pty ? https://github.com/mitchellh/vagrant/issues/1482

Please open this as separate bug and cc @emyl

==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead.
==> default: This is a bug with the provider. Please contact the creator
==> default: of the provider you use to fix this.

Did you end up fixing your install issue/figure out what it was?

poflynn commented 10 years ago

Fixed by adding config.ssh.pty = true to the Vagrantfile (I had looked through the vagrant doc and this parm isn't mentioned there)-:. However I'm not closing this issue just yet as I'm hoping this will be added to the ReadMe.. Thx.

P.S. No, I did not get past my install issues yet, I'm doing all this work in a linux VM I built on my Windows machine to work around that issue.

ju2wheels commented 10 years ago

This would be better to doc upstream in vagrant as its not vagrant-softlayer specific but rather a vagrant setting. Im sure theyll take changes to https://github.com/mitchellh/vagrant/blob/master/website/docs/source/v2/vagrantfile/ssh_settings.html.md though if you do a pull request for changes from your own fork.

emyl commented 10 years ago

Please refer to https://github.com/mitchellh/vagrant/pull/4205

poflynn commented 10 years ago

Thx for the update to the vagrant docs, but I was thinking this should be mentioned in the README here as it seems it is a required setting for the OOTB VM images provided by SL which is what everyone is going to start with when using this plug in - why force them to google for a solution when we know they're going to hit this?

Just a suggestion, thx.

ju2wheels commented 10 years ago

https://github.com/mitchellh/vagrant/pull/4211

Based on the above statement by Mitchell and searching the vagrant issues related to using the setting, given that its not recommended to use (which is what Ive read in everything prior to this issue as well), can cause various other issues with vagrant/plugins, and that I think its only required for certain distros (I dont think all of them have requiretty set by default but cant recall) if we add it then we should also add a warning.

Ill add it this weekend as im also going to look into how feasible it is to change the vlan id's to allow both the number id or the long form name to make that easier.

emyl commented 10 years ago

Thx for your effort @ju2wheels :wink:

poflynn commented 9 years ago

Any ideas why I'm getting (almost) the same error while doing a 'vagrant up' on an SL machine? Meaning, I've installed vagrant etc on an SL machine, cloned my vagrant src repo there and doing a vagrant up from there.

It works great on my linux desktop with the same Git repo. I do have config.ssh.pty = true.

[vagrant@vagrantcentral conf1]$ vagrant -v
Vagrant 1.6.5
[vagrant@vagrantcentral conf1]$ vagrant up
Bringing machine 'default' up with 'softlayer' provider...
==> default: The SoftLayer instance is already running.
[vagrant@vagrantcentral conf1]$ vagrant halt
==> default: Stopping the SoftLayer instance gracefully...
[vagrant@vagrantcentral conf1]$ vagrant up
Bringing machine 'default' up with 'softlayer' provider...
==> default: Starting the SoftLayer instance...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 198.XX.XX.XX:22
    default: SSH username: root
    default: SSH auth method: private key
    default: Warning: Host unreachable. Retrying...
    default: Warning: Connection refused. Retrying...
==> default: Machine booted and ready!
==> default: Rsyncing folder: /home/vagrant/conf1/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /home/vagrant/conf1/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i '/home/vagrant/.ssh/id_dsa' --exclude .vagrant/ /home/vagrant/conf1/ root@198.XX.XX.XX:/vagrant
Error: Warning: Permanently added '198.XX.XX.XX' (RSA) to the list of known hosts.
sudo: sorry, you must have a tty to run sudo
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

[vagrant@vagrantcentral conf1]$
emyl commented 9 years ago

Which version of vagrant-softlayer do you have? If < 0.3.3, please update and retry.

poflynn commented 9 years ago

0.3.3. BTW this is a brand new, CentOS 5 minimal install (the standard SL one). I have installed nothing on it but Git, Vagrant, this plug in and the pre-reqs I needed for the above.

[vagrant@vagrantcentral ~]$ vagrant plugin list
vagrant-login (1.0.1, system)
vagrant-share (1.1.1, system)
vagrant-softlayer (0.3.3)
[vagrant@vagrantcentral ~]$
david-feldsine commented 9 years ago

I am seeing the same thing on my Mac vagrant plugin list vagrant-login (1.0.1, system) vagrant-omnibus (1.4.1) vagrant-share (1.1.1, system) vagrant-softlayer (0.3.3)

There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info.

Host path: /Users/davidfeldsine/Documents/workspace/vagrant2/ Guest path: /vagrant Command: rsync --verbose --archive --delete -z --copy-links --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i '/Users/davidfeldsine/.ssh/id_dsa' --exclude .vagrant/ /Users/davidfeldsine/Documents/workspace/vagrant2/ root@198.11.247.15:/vagrant Error: Warning: Permanently added '198.11.247.15' (RSA) to the list of known hosts. sudo: sorry, you must have a tty to run sudo rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]

ju2wheels commented 9 years ago

Lets rule out the actual sudoers as the source of the problem. Can you run a post install script if you arent already using one and use it to disable requiretty and see if you still get the error?

Can use this sudoers_disable_requiretty.sh GIST URL as post_install.

poflynn commented 9 years ago

Thx for the script ju, it worked. Makes total sense but I'm confused as to how this works from my Linux (CentOS) desktop?! Oh well.

ju2wheels commented 9 years ago

If it happens from one vagrant hosts type but not another against the same build box type then Im as confused as to why thats happening as you are. Its a server side not vagrant client side setting so you should technically get the same result always when building the same box type (the only other explanation would be if using CentOS vs something newer such as Ubuntu/Mac where the packages are newer and may contain different defaults in terms of how rsync behaves with pty).

One other option would be to try disabling the automatic rsync (lonniev had a post somewhere in one of the issues) and do a manual rsync of the vagrant dir with -t option set in rsync__args as explained in doc and see if that works without having to use the post_install (described in https://github.com/mitchellh/vagrant/issues/3063 but no reference as to whether it worked or not).

ju2wheels commented 9 years ago

Scratch my second suggestion above, I just reviewed it a little more and its not an rsync option, he was passing it to ssh so it wont work.

Looking at the code, you could try manually adding this -t at this line https://github.com/mitchellh/vagrant/blob/efd1d5e11bfc5a72c7a1d1eae294b4751d841544/plugins/synced_folders/rsync/helper.rb#L65 in your vagrant install (/opt/vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/synced_folders/rsync/helper.rb) and try without the post_install script and see if it works. If it does then it should be opened as a ticket upstream to make this acknowledge the pty but im not sure if they will take it or not.

lonniev commented 9 years ago

And I @lonniev regret that I don’t recall the particular rsync issues that I had—other than the lack of an rsync client in the Softlayer Windows boxes. I have had to work other non-vagrant issues and have been away from the vagrant softlayer issues for too long.

—Lonnie VanZandt

303-900-3048 Sent from Dropbox's Mailbox on Mac

On Sun, Oct 5, 2014 at 4:29 PM, Julio Lajara notifications@github.com wrote:

Scratch my second suggestion above, I just reviewed it a little more and its not an rsync option, he was passing it to ssh so it wont work.

Looking at the code, you could try manually adding this -t at this line https://github.com/mitchellh/vagrant/blob/efd1d5e11bfc5a72c7a1d1eae294b4751d841544/plugins/synced_folders/rsync/helper.rb#L65 in your vagrant install and try without the post_install script and see if it works. If does then it should be opened as a ticket upstream to make this acknowledge the pty but im not sure if they will take it or not.

Reply to this email directly or view it on GitHub: https://github.com/audiolize/vagrant-softlayer/issues/11#issuecomment-57954978