1 year ago

#379169

test-img

user5820327

The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed

There is this issue when running this vagrant file to spin up 2 VMs from a centos base image created by vagrant. NOTE : I used my minimal centos installation from virtualbox to spin up the Vms using this.

vagrant package --base 09e62df1-5454-xxxxxxxxxxx --output base_vagrant_ansible

vagrant box add vagrant_image_ansible base_vagrant_ansible

The error is

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

sed -i '/#VAGRANT-BEGIN/,/#VAGRANT-END/d' /etc/fstab

The Vagrantfile script is :

    # Global declaration
if Vagrant.has_plugin?("vagrant-vbguest") then
config.vbguest.auto_update = false
    end
Vagrant.configure("2") do |config|

  config.vm.define "sandbox" do |sandbox|
     sandbox.ssh.username = "vagrant"
     sandbox.ssh.password = "vagrant"
     sandbox.vm.box = "vagrant_image_ansible"
     sandbox.ssh.insert_key = true
     sandbox.vm.synced_folder ".", "/vagrant", disabled: true 
     sandbox.vm.network "public_network", ip: "192.168.1.21", auto_config: false
     sandbox.vm.provider :virtualbox do |v|
        v.memory = 1780
        v.name = "sandbox"
        v.gui = true
     end
   
  end
  
 config.vm.define "dev" do |dev|
     dev.ssh.username = "vagrant"
     dev.ssh.password = "vagrant"
     dev.vm.box = "vagrant_image_ansible"
    
     dev.ssh.insert_key = true
     dev.vm.synced_folder ".", "/vagrant", disabled: true 
     dev.vm.network "public_network", ip: "192.168.1.5", auto_config: false
     dev.vm.provider :virtualbox do |vb|
        vb.memory = 1780
        vb.name = "dev"
        vb.gui = true
     end
   
 
  end
end

I have tried other method but still the same issue. Though the VM is working when I logged in vagrant ssh sandbox, but the Vagrantfile should be able to spin up the 2 Vms without interupting and spin up both VMs. Any reason why?

The log :

Bringing machine 'sandbox' up with 'virtualbox' provider...
Bringing machine 'dev' up with 'virtualbox' provider...
==> sandbox: Importing base box 'vagrant_image_ansible'...
==> sandbox: Matching MAC address for NAT networking...
==> sandbox: Setting the name of the VM: sandbox
==> sandbox: Clearing any previously set network interfaces...
==> sandbox: Available bridged network interfaces:
1) Intel(R) Wi-Fi 6 AX201 160MHz
2) TAP-Windows Adapter V9
3) Hyper-V Virtual Ethernet Adapter
4) Cisco AnyConnect Secure Mobility Client Virtual Miniport Adapter for Windows x64
==> sandbox: When choosing an interface, it is usually the one that is
==> sandbox: being used to connect to the internet.
==> sandbox:
    sandbox: Which interface should the network bridge to? 2
==> sandbox: Preparing network interfaces based on configuration...
    sandbox: Adapter 1: nat
    sandbox: Adapter 2: bridged
==> sandbox: Forwarding ports...
    sandbox: 22 (guest) => 2222 (host) (adapter 1)
==> sandbox: Running 'pre-boot' VM customizations...
==> sandbox: Booting VM...
==> sandbox: Waiting for machine to boot. This may take a few minutes...
    sandbox: SSH address: 127.0.0.1:2222
    sandbox: SSH username: vagrant
    sandbox: SSH auth method: password
    sandbox: Warning: Connection reset. Retrying...
    sandbox: Warning: Connection aborted. Retrying...
    sandbox: Warning: Connection reset. Retrying...
    sandbox: Warning: Connection aborted. Retrying...
    sandbox: Warning: Connection reset. Retrying...
    sandbox: Warning: Connection reset. Retrying...
    sandbox:
    sandbox: Inserting generated public key within guest...
    sandbox: Removing insecure key from the guest if it's present...
    sandbox: Key inserted! Disconnecting and reconnecting using new SSH key...
==> sandbox: Machine booted and ready!
==> sandbox: Checking for guest additions in VM...
    sandbox: No guest additions were detected on the base box for this VM! Guest
    sandbox: additions are required for forwarded ports, shared folders, host only
    sandbox: networking, and more. If SSH fails on this machine, please install
    sandbox: the guest additions and repackage the box to continue.
    sandbox:
    sandbox: This is not an error message; everything may continue to work properly,
    sandbox: in which case you may ignore this message.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

sed -i '/#VAGRANT-BEGIN/,/#VAGRANT-END/d' /etc/fstab

Stdout from the command:



Stderr from the command:

bash

vagrant

virtualbox

centos7

0 Answers

Your Answer

Accepted video resources