Skip to content
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

Box image cannot used under windows #58

Open
mmergenthaler opened this issue Aug 10, 2016 · 9 comments
Open

Box image cannot used under windows #58

mmergenthaler opened this issue Aug 10, 2016 · 9 comments

Comments

@mmergenthaler
Copy link

There is no need to create a default synced folder "/vagrant" as explained in pull request #34, because vagrant will do that automatically. As from https://www.vagrantup.com/docs/synced-folders/:

By default, Vagrant will share your project directory (the directory with the Vagrantfile) to /vagrant.

In addition, the box image cannot be used under windows because you set the synced folder type to "rsync" which is not available under windows.

You can simply test it on a existing vagrant vm, if you comment the following line in the box image Vagrantfile, which you can find at "C:\Users[USERNAME].vagrant.d\boxes\centos-VAGRANTSLASH-7\1607.01\virtualbox\Vagrantfile":
Change

config.vm.synced_folder ".", "/vagrant", type: "rsync"
to

config.vm.synced_folder ".", "/vagrant", type: "rsync"

and reboot the vagrant vm using
vagrant reload

After the vagrant vm is up again, just login to the vm via ssh and execute "df":

[vagrant@vagrant-box ~]$ df
Filesystem                                    1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00                38765936   1963532  34810112   6% /
devtmpfs                                         932080         0    932080   0% /dev
tmpfs                                            942020         0    942020   0% /dev/shm
tmpfs                                            942020      8520    933500   1% /run
tmpfs                                            942020         0    942020   0% /sys/fs/cgroup
/dev/sda2                                        487634    211140    246798  47% /boot
vagrant                                       961700860 471403940 490296920  50% /vagrant
tmpfs                                            188408         0    188408   0% /run/user/1000
@cwt137
Copy link

cwt137 commented Aug 11, 2016

I have the same issue. The line that defines the shared folder needs to be taken out of the Vagrantfile that comes with the base box

@lpancescu
Copy link
Contributor

@mmergenthaler I don't have access to a Windows host, but I've tested your proposed change on OS X, and it doesn't look good: both vagrant up (creating a new box) and vagrant reload return an error after a few minutes. When the line defining the default sync dir is commented out, Vagrant will try to mount /vagrant using VirtualBox shared folders (vboxsf). Since our images don't come with the VirtualBox Guest Additions, the necessary kernel modules are not found and mounting fails. Could you try to destroy your box with vagrant destroy, comment out the line you indicated above, and then run vagrant up again? If the Vagrant documentation is accurate, I think it should fail on Windows in the same fashion as on OS X.

My suggestion for Windows users would be to either install rsync via Cygwin or MSYS, or to explicitly disable the default sync directory by adding the following line to their Vagrantfile:

config.vm.synced_folder ".", "/vagrant", disabled: true

@mmergenthaler
Copy link
Author

@lpancescu I've forgot, that i had installed the vagrant plugin "vagrant-vbguest" before. This plugin automatically installs the host's VirtualBox Guest Additions on the guest system.
Without that plugin, when executing vagrant destroy and vagrant up i also get an error that Vagrant was unable to mount Virtualbox shared folders because the filesystem "vboxsf" is not available - OK.

But if you provide a base box for VirtualBox (see https://atlas.hashicorp.com/centos/boxes/7):

vagrant init centos/7; vagrant up --provider virtualbox

i think you have to provide your base box with Virtualbox Guest Additions installed like described under https://www.vagrantup.com/docs/virtualbox/boxes.html and https://www.vagrantup.com/docs/providers/basic_usage.html.

Or you can add a information for windows users to your box description, that the installation of the Virtualbox Guest Additions is required (e.g. simply by installing the plugin "vagrant-vbguest").

@cwt137
Copy link

cwt137 commented Aug 16, 2016

I also have the vbguest plugin installed so, I don't suffer from the not available error. That plugin is almost necessary for lots of VMs when the host is Windows, if you do not want to manually install the vb guest drivers.

Chris

On Aug 16, 2016, at 3:19 AM, mmergenthaler [email protected] wrote:

@lpancescu I've forgot, that i had installed the vagrant plugin "vagrant-vbguest" before. This plugin automatically installs the host's VirtualBox Guest Additions on the guest system.
Without that plugin, when executing vagrant destroy and vagrant up i also get an error that Vagrant was unable to mount Virtualbox shared folders because the filesystem "vboxsf" is not available - OK.

But if you provide a base box for VirtualBox (see https://atlas.hashicorp.com/centos/boxes/7):

vagrant init centos/7; vagrant up --provider virtualbox

i think you have to provide your base box with Virtualbox Guest Additions installed like described under https://www.vagrantup.com/docs/virtualbox/boxes.html and https://www.vagrantup.com/docs/providers/basic_usage.html.

Or you can add a information for windows users to your box description, that the installation of the Virtualbox Guest Additions is required (e.g. simply by installing the plugin "vagrant-vbguest").


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@lpancescu
Copy link
Contributor

lpancescu commented Aug 17, 2016

@mmergenthaler I had already updated the release notes for v1607, to mention the rsync issue for Windows users (the second item in "Known issues"). The Guest Additions are not part of the Vagrant images because there is no VirtualBox package in CentOS, and we cannot use any third-party repositories. We know this is a problem for VirtualBox users and are (still) looking for a suitable solution.

@mmergenthaler
Copy link
Author

Thanks, this is already an improvement. In addition, I would suggest not to specify the type to "rsync", because Vagrant will use the best synced folder option as described under https://www.vagrantup.com/docs/synced-folders/basic_usage.html at option "type":

... If this is not specified, Vagrant will automatically choose the best synced folder option for your environment. ...

So, if no synced folder type is specified when using VirtualBox as provider under windows, then only a warning message

...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Mounting shared folders...
default: /vagrant => D:/vagrant-centos-test
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available.
...

is shown, but the vagrant box will start and you can login via ssh.

But if the type is specified to "rsync", under windows the vagrant box will fail to start with message

"rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH.

lpancescu added a commit to lpancescu/sig-cloud-instance-build that referenced this issue Aug 22, 2016
@lpancescu
Copy link
Contributor

@mmergenthaler Sorry for taking that long to answer, it's been a busy week.

If we stop specifying the sync type in the default Vagrantfile, the existing setups of all our users which do have rsync installed on the host (i.e. Linux, BSD, and even Windows with Cygwin or MSYS) would completely stop synchronizing any files between the host and the box. Besides, that warning is not as harmless as it seems: it only appears after Vagrant's timeout (5 minutes by default), and the process will exit with an error code of 1; this may not matter when you call Vagrant from the command line, but it does matter in a shell script or Makefile. From my perspective, this would not be an acceptable solution.

If you don't need sync, my advice remains to disable syncing explicitly in your Vagrantfile.

@jdeathe
Copy link

jdeathe commented Sep 1, 2016

@lpancescu - If I was using Windows as my development environment and I wanted to upload files to a Virtual Machine I would use one of the many scp client's to upload the files into place and then use and IDE or editor that had an "upload on save" feature which used sftp to keep changes in sync and would disable Vagrant's synced_folder feature as advised.

@lpancescu
Copy link
Contributor

@jdeathe I think vagrant-sshfs might also work for Windows users, with the advantage of a simpler workflow when creating a new file. It seems to require Cygwin, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants