vagrant ssh responded with with a non-zero - bash

I am using vagrant on windows 8.1 and when I am doing vagrant up I am getting this error
The error message states that it failed trying execute this command:
chown `id -u vagrant`:`id -g vagrant` /vagrant
So I accessed the host machine by ssh: and I tried to execute the same command and I get error
Here is some commands I tried to execute in /vagrant directory, I don't know if that will help.
Here is my vagrantFile that I am using.
Please any idea what I am doing wrong ?

/vagrant probably doesn't exist
Check for /home/projects
This line in your Vagrantfile sets that directory. ./projects is on the host, /home/projects is on the guest.
config.vm.synced_folder "./projects", "/home/projects", nfs: true

Related

Installing Virtual box for kong Vagrant set up

I am trying to set up vagrant for kong. I have installed VirtualBox and vagrant. But when i run 'vgrant up' i encounter the below issue:
Bringing machine 'default' up with 'virtualbox' provider...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["list", "hostonlyifs"]
Stderr: VBoxManage: error: Failed to create the VirtualBox object!
VBoxManage: error: Code NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154) - Class not registered (extended info not available)
I have searched for this error with no much luck.
I am using centos 7.4 and the kernel version is 3.10.0-693.21.1.el7.x86_64.
I have downloaded the relevant gcc, devel and dkms. In short followed the link https://tecadmin.net/install-oracle-virtualbox-on-centos-redhat-and-fedora/
Any tip is appreciated.
Thanks
Dinah
This is most likely a problem with your VirtualBox install, not Vagrant. To confirm this, you should receive the same error when running: VBoxManage list vms
A common reason for this error are when /tmp is full or has the incorrect permissions.
To check if /tmp is full try df -h
To fix permissions on /tmp if they're incorrect, try sudo chmod ug-s /tmp && sudo rm -rf /tmp/.vbox*
Apparently we were trying this on a VM. And Vagrant tries to spin up another VM. So having a VM spun within a VM is causing the issue.

Laravel vagrant unable to mount

Obviously after some updates, my whole dev environment broke. When running vagrant up I get the following error:
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attemped was:
set -e
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the command was:
: No such file or directory
I have tried with several options on StackOverflow, as well as googling, but no help. I've installed the vagrant-vbguest plugin, I've updated, destroyed and provisioned the box, I did a vagrant reload --provision.
I've also tried logging in to guest with SSH, and running sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
Does anyone have a solution?
EDIT:
I've tried downgrading Virtualbox to 5.1. and then I get the following:
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["modifyvm", "dc09e643-896d-4491-8a6a-659c13d2cf65", "--natpf1", "tcp8000,tcp,,8000,,80", "--natpf1", "tcp44300,tcp,,44300,,443", "--natpf1", "tcp33060,tcp,,33060,,3306", "--natpf1", "tcp54320,tcp,,54320,,5432", "--natpf1", "ssh,tcp,127.0.0.1,2222,,22"]
Stderr: VBoxManage.exe: error: A NAT rule of this name already exists
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component NATEngineWrap, interface INATEngine, callee IUnknown
VBoxManage.exe: error: Context: "AddRedirect(Bstr(strName).raw(), proto, Bstr(strHostIp).raw(), RTStrToUInt16(strHostPort), Bstr(strGuestIp).raw(), RTStrToUInt16(strGuestPort))" at line 1820 of file VBoxManageModifyVM.cpp
i had the exact same problem as you and my virtual box version was 5.1.16 all i had to do was downgrade to 5.1.14 and problem fixed.
Hope it works for you

vagrant - constantly syncing folder setup

I am trying build a centos7 vm at my windows10 using virtualbox. I am using cento/7 box.
it by default using rsync for syncing folder and I don't really like it as I would have to open an extra cmd just to run vagrant rsync-auto for constant syncing.
I tried to use nfs but not successful.
Here is my vagrantfile.
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
config.vm.synced_folder ".", "/home/vagrant/sync", type: "nfs"
end
and when I tried to run it. It gave me this.
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` home_vagrant_sync /home/vagrant/sync
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` home_vagrant_sync /home/vagrant/sync
The error output from the last command was:
mount: unknown filesystem type 'vboxsf'
I noticed that changes made by host will be synced to guest but not the other way round. I want to make the folder like a shared folder both guest and host can apply changes to it. Any best approaches to do it?
Thanks.
The reply you got is telling you to install Virtual Box guest additions. This is a separate installation action you have to perform on top of installing Virtual Box. Did you install Virtual Box Guest Additions?

vagrant ash: sudo: not found

When starting my vagrant box with a small 15MB Busybox image, the first time I get an error during the phase
Mounting shared folders...
It seems vagrant is trying something with sudo, which isn't istalled. I get this error:
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:
ash: sudo: not found
It works so far, I can login as root with the password vagrant, but I guess this is not perfect?
This is my setup: https://github.com/rubo77/ffnord-example/blob/pyddhcpd/Vagrantfile
config.ssh.username = 'root'
config.ssh.password = 'vagrant'
config.ssh.insert_key = 'true'
config.ssh.shell = 'ash'
(0..9).each do |i|
config.vm.define "gc-node0#{i}" do |node|
end
end
By default vagrant share/sync the directory /vagrant (guest) with the current project directory, the one containing the Vagrantfile (host), more directories can be shared using config.vm.synced_folder, I don't know if the default /vagrant can be disabled.
If you aren't using the shared directories feature then the missing sudo isn't a problem.
If your filesystem is writeable you can create the /vagrant directory once, so on next up vagrant shouldn't try to sudo mkdir again;
but assuming you're using VirtualBox (I don't know about others emulator behavior/architecture) you'll face another problem, shared directories require the kernel modules vboxsf and vboxguest (from VirtualBox Guest Additions) to be built (against the running kernel sources) and loaded (insmod), and the command mount.vboxsf to be built and installed in /sbin, plus your busybox require the option mount helpers enabled because vagrant use mount -t vboxsf and not mount.vboxsf directly, when vagrant try to mount the shared directories and those requirements aren't matched there is a long timeout before failing with error (a minute/two or more).
Notice that busybox (current stable) support sudo, is just disabled by default.
If you're building the buildroot yourself from sources I can tell that the shared feature works (I managed to get an image with busybox to work as vagrant expect), if you're using some pre-built kernel/busybox... may be a problem, you have to find matching binaries for vboxsf, vboxguest, mount.vboxsf and if the mount helpers option is disabled in your busybox you need to find a workaround (perhaps modifying vagrant to use mount.vboxsf).

Vaprobash: Create new VM failed

I'm trying to install a new VM with VAPROBASH (https://github.com/fideloper/Vaprobash)
but the installation fails when mounting NFS shared folders
I'm using Mac OsX 10.9.2, Vagrant 1.6.2, VirtualBox 4.2.20
=> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o 'nolock,vers=3,udp,noatime' 192.168.22.1:'/Users/user/Sites/myfolder' /vagrant
Stdout from the command:
Stderr from the command:
stdin: is not a tty
mount.nfs: requested NFS version or transport protocol is not supported
Any help would be appreciated! Thanks! I need to start a project!
I´ve found the solution:
adding the line 127.0.0.1 localhost to the /etc/hosts file worked for me as well
I'm with vagrant 1.6.2 and vbox 4.3.10
https://github.com/mitchellh/vagrant/issues/1941#issuecomment-43098597

Resources