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
Make it work on Windows #6
Comments
First breaking point appears to be when building the basebox, specifically when trying to create the VM using command line calls to VirtualBox as opposed to ruby-virtualbox. Error dump:
What's required in the virtualbox gem to make this work without calls through a pty? |
Ah, yes the pty command does not work on windows...Popen should Could you activate swap self.execute2 with self.excute ? https://github.com/jedi4ever/veewee/blob/master/lib/veewee/shell.rb |
@adurity any update on this? Would be interested in hearing your experiences |
Haven't yet had a chance to revisit this issue. I should be able to investigate in the next few days. |
I did the suggested change (altered the body of execute to just call execute2) but then it fails when it doesn't find VBoxManage in the PATH. I guess having it in PATH is a hard requirement then? Oh, and I'm using jRuby 1.6.2 on W7. |
Sadly even with VBox in PATH (and after giving JRuby enough heap) it doesn't work:
It's not totally clear from the output but the download does finish before that error message. |
I figured out the problem above, that was due to the block passed to IO.popen in Veewee::Shell.execute2 just printing its end of the pipe. I changed execute2 to do print IO.popen(command).readlines instead, and got a bit further. The next problem is that Session.create_disk expects to be able to run grep, cut and sed. |
I can't quite figure out what execute() is supposed to return? Transaction.list_snapshots wants to call "stdout" on the result? |
The result of the exec is an object that contains the stderr and stdout of the command just executed. List Snapshots use it as this is the only way to find the snapshots through the VBoxManage command. I agree that the grep and piping could be done in ruby instead of using the shell commands. That will probably make it work on windows too. |
I made some small modifications on my fork at https://github.com/pshields/veewee so I could build a VM on Windows. Mainly I removed things that got in the way. I have Cygwin installed, so there might be more steps to be taken if you don't. Summary of changes:
That was basically it in order to build the VM. I'm still working on some things, so check my repo for specific changes. Incidentally, I'm not even using Vagrant at the moment (except as a Veewee dependency.) I just want a nice way to turn a standard Ubuntu .iso, a preseed.cfg and a postinstall.sh script into a custom VirtualBox VM. If anyone has any better ideas, please let me know. |
A few more notes on what I did to get Veewee 0.2.0 basebox building working in Windows with JRuby 1.6.4:
After that, |
I successfully built a box from windows today by patching using commits in https://github.com/pshields/veewee |
I'm glad it worked for you! I'll try to create a more complete, functionality-preserving Windows compatibility patch in the next few days if @jedi4ever is interested. |
I'm definitely interested, but there is a complete rewrite in the making, need to check if this will work on windows as well. |
Where did you place the veewee folder ? |
In a |
Veewee v0.3 will be completely different, I solved :
It will be interesting if you guys try to do the same work for the new version (0.3 branch) and try it out |
Installing the libxml-ruby gem dependency fails when I try to install veewee 0.3.0-alpha4. libxml-ruby doesn't seem compatible with Windows. I haven't found any easy workarounds yet. |
@pshields thanks for trying! Could you give me any output you get while installing? There seem to be several docs on installing it, but without the actual error it's hard to help. |
Ha I see now, the libxml-ruby gem is only needed for reading the property files for the vmfusion part. |
Here's my output. The first time it ran it also showed the gems it was retrieving.
|
libxml-ruby + jruby seems to be a common pain point. Could veewee use libxml-jruby instead, when on jruby? ...hurr durr, it's further down the dependency chain than that, nevermind. It's actually CFPropertyList. |
Actually, could the vmfusion provider be disabled for windows + jruby combos? Seems like it wouldn't even serve a purpose there, and that seems to be the only place where CFPropertyList is used. |
I built and installed a version of CFPropertyList that depends on libxml-jruby instead (don't even know if it works but no matter) and added the VirtualBox directory to PATH, and after this box building fails on the "VBoxManage createvm" invocation. The reason is the single quotes around the --ostype value: they are not interpreted by the shell but are instead passed to the command, which barfs because it doesn't recognize the os type. Using double quotes would fix this I guess. ...I guess all the vbox commands would need to be changed to use double quotes. |
As I was hacking away on this (on the veewee03 branch) I noticed something odd: why, in create_disk() in lib/veewee/provider/virtualbox/box/create.rb, is there a |
Damn, got pretty far but then when veewee says that it's waiting 100 s for an SSH connection, I can't connect to the port it gives (although Windows' netstat shows it as listening). |
My ongoing effort is now here: https://github.com/ilkka/veewee/commits/veewee03 In addition to this I have installed a version of CFPropertyList that's changed to depend on libxml-jruby. Even with that installed however, you seem have to install veewee with --ignore-dependencies lest it try to build the unpatched one. With this setup "vbox build" gets as far as waiting for an SSH connection, but connections to the given port are immediately refused. |
I have made a fork from the master and successfully define/build/export/add/init/up a box on windows 7 x64.
|
I'm not actually using Ruby and it took me several hours to figure out all this, but I can confirm that I was able to successfully run @whren's (thanks!) version of veewee on Ruby 1.9.3p125 with DevKit for building native extensions (both packages from the RubyInstaller project). Some minor issues that I have encountered were:
Apart from that and some beginner's issues with ruby and gems it went all smooth. |
Glad to hear you have successfully build a box on windows !
|
@whren great work? any chance of a pull request? I love to get this integrated soon. |
I have tested the fixes and it now works great on 1.9.3. There's only a small issue in the checksum computation code (text vs binary mode) that I have referenced above. I also gave it a try on a recent JRuby but it seems there are some platform-related bits missing from this particular ruby implementation (see http://pastebin.com/pscj4iM0). I guess that's out of scope for this project but it might be noted in the documentation. |
Alright, all changes by @whren are now merged into master. Awesome work you guys! Let me know if I can close this issue or not. |
you're welcome i was waiting for feedback before pulling this ! |
hey guys, would it be ok to close the issue? Could you confirm all works? thanks for all the feedback! |
It works fine for me using the current master version on Windows 7 x64 and Ruby 1.9.3 with DevKit. Great work, thanks! |
It's working great for me on my home Windows PC, but on my work box we're behind an ISA proxy and I get the following:
[snipped] I've got the HTTP_PROXY env var set along with a username and password. Is there something else I can do, or is this a bug? I thought Vagrant already handled proxies? |
I'm not sure on windows. could you try lowercase http_proxy ? The download is managed by veewee, not by vagrant (as it works independent of vagrant if needed) |
I've just done a bit of digging and the following on StackOverflow shed some light: If I specify the proxy, username and password as illustrated there, I can get through the proxy. Where is the proxy handling code? I'll take a look at it. |
We could probably detect ourself if the environment variables are set. And add them to the download code. I think it's part of the iso.rb file. Mind you this will only download the iso through the proxy. The box itself will need a proxy during the postinstall too. |
It was @whren that submitted the pre_postinstall patch. I can't quite see how it's used - I was hoping there would be a demo file as there is with the others, but there doesn't appear to be. It should go in the definitions directory, right? Hopefully @whren will see this and enlighten us. :) I can report that hacking the iso.rb to the following got it downloading. So if there were some code to parse the HTTP_PROXY var, that would work.
|
Look here on how to use pre_postinstall hook : https://github.com/whren/veewee/wiki/Use-of-pre_postinstall_file-in-definition.rb |
Thanks @whren that's really helpful. I've come across another problem now when doing
|
I am getting a similar error
|
Hmm. I recently introduced some UTF-8 setting in the Gemfile. https://github.com/jedi4ever/veewee/blob/master/Gemfile Could you try to remove that section, and see if this improves things? |
That worked for me removing it |
I am on Mac OSX 10.6 using ruby 1.9.3 with rvm |
Yes, removing it worked for me too on ruby 1.9.3p0 (2011-10-30) [i386-mingw32].
|
@charlesroper @tlpinney I reverted the changes on UTF-8 and need to find a better workaround for the problem I had with it. Thanks for the feedback. |
I just learned about veewee & vagrant recently. My host OS is Windows 7, and I want to run Windows Server 2008R2 guests. I wrote about my experiences trying to get veewee running on my blog at http://joannaandjohn.blogspot.com.au/2012/05/windows-development-vms-long-adventure.html The main problems I found were to do with paths under Cygwin. For example, I saw this error: The real path should have been c:\Users\John\repos\veewee\iso\en_windows_server_2008_r2_standard_enterprise_datacenter_web_x64_dvd_x15-50365.iso I made changes to a couple of files to fix this: I saw errors like this:
It seemed that Java was devouring an extra backslash. So I added another method escape to floppy.rb.
Things I'd like to do next:
My repo is at https://github.com/johnyesberg/veewee. |
@johnyesberg Could you create a pull request with the changes you've made? |
|
For info, ffi 1.0.11 does not build on my machine (Windows 7 with local ruby 1.8.7) using: gem install -v 1.0.11 ffi The current version of veewee seems to require that specific version of ffi. Hence gem install veewee fails I can build latest versions (1.1.4 or 1.1.5) of ffi without problem. |
@PierreR can try adding the ffi version to the gemspec file and see if this works? |
@PierreR any news? |
Not tested yet, but need to have access to a windows box for doing that
The text was updated successfully, but these errors were encountered: