lavabit / robox

The tools needed to robotically create/configure/provision a large number of operating systems, for a variety of hypervisors, using packer.
620 stars 139 forks source link

How to use Vagrant VMWARE Custom Box to lifecycle of virtual machines #214

Closed prolayc closed 2 years ago

prolayc commented 2 years ago

I want to use VMWARE custom Vagrant box of openSUSE leap VMware workstation pro. I was talking to John Pugh of the SUSE Rancher community during my foundational course. But due to the time constraint, I could not able to create the Vagrant VMWARE Box to maintain the lifecycle of virtual machines.

The good news is that we were pretty close to the finish line. Johan has created a box of openSUSE leap VMware workstation pro. The custom box can be found under johnpugh/leap15 in the Vagrant Cloud.

I started installing the box by using the Vagrant init and up command. But after the box was successfully created I am getting the SSH port error. Even the error can be eliminated if I open port number 2200 in my local machine.

The Vagrant box creation error I am getting as follows -

===============================================

D:\Cloud-Native-Architecture-Udacity\johnpughleap15-VMVARE>vagrant up --provider=vmware_desktopBringing machine 'default' up with 'vmware_desktop' provider...==> default: Box 'johnpugh/leap15' could not be found. Attempting to find and install... default: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation default: Box Version: >= 0==> default: Loading metadata for box 'johnpugh/leap15' default: URL: https://vagrantcloud.com/johnpugh/leap15==> default: Adding box 'johnpugh/leap15' (v0.2) for provider: vmware_desktop default: Downloading: https://vagrantcloud.com/johnpugh/boxes/leap15/versions/0... default:==> default: Successfully added box 'johnpugh/leap15' (v0.2) for 'vmware_desktop'!==> default: Cloning VMware VM: 'johnpugh/leap15'. This can take some time...==> default: Checking if box 'johnpugh/leap15' version '0.2' is up to date...==> default: Verifying vmnet devices are healthy...==> default: Preparing network adapters...WARNING: The VMX file for this box contains a setting that is automatically overwritten by VagrantWARNING: when started. Vagrant will stop overwriting this setting in an upcoming release which mayWARNING: prevent proper networking setup. Below is the detected VMX setting:WARNING:WARNING: ethernet0.pcislotnumber = "33"WARNING:WARNING: If networking fails to properly configure, it may require this VMX setting. It can be manuallyWARNING: applied via the Vagrantfile:WARNING:WARNING: Vagrant.configure(2) do |config|WARNING: config.vm.provider :vmware_desktop do |vmware|WARNING: vmware.vmx["ethernet0.pcislotnumber"] = "33"WARNING: endWARNING: endWARNING:WARNING: For more information: https://www.vagrantup.com/docs/vmware/boxes.html#vmx-allo...==> default: Fixed port collision for 22 => 2222. Now on port 2200.==> default: Starting the VMware VM...==> default: Waiting for the VM to receive an address...==> default: Forwarding ports... default: -- 22 => 2200==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2200 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key...==> default: Machine booted and ready!==> default: Configuring network adapters within the VM...The following SSH command responded with a non-zero exit status.Vagrant assumes that this means the command failed!/sbin/ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://'Stdout from the command:Stderr from the command:D:\Cloud-Native-Architecture-Udacity\johnpughleap15-VMVARE>

I am using the following command to spin the Vagrant boxvagrant up --provider=vmware_desktop

The Vagrant Box URL is

The issue I am facing is the following -

The issue I am facing at this moment is the SSH port issue. The error is The following SSH command responded with a non-zero exit status.Vagrant assumes that this means the command failed!/sbin/ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://'Stdout from the command:Stderr from the command I tried this solution ‌ but did not work.

According to Jhon, the SSH issue may be caused by A few things first...ensure it is listening on port 2200. The image I created is supposed to by default, but it depends on your setup. Remember that connection refused can mean a lot of things, but that port is not open for the communication you want (over ssh). So ensure it didn't automatically use something like 2201 or a firewall rule is not blocking it or some other reason for the connection refusal

I am using Windows 10 Home edition and I have the VMWARE Pro version installed.

As a part of Vagrant installation, you need to install VMWARE Plugin.

ladar commented 2 years ago

@prolayc your issue is confusing. Why did you open up an issue about someone else's box on this repo? As far as I can tell, the Robox OpenSUSE 15.3 box works perfectly on VMWare workstation. See my test below...

[ladar@walter vagrant]$ ./connect.sh generic opensuse15 vmware
==> box: Loading metadata for box 'generic/opensuse15'
    box: URL: https://vagrantcloud.com/generic/opensuse15
==> box: Adding box 'generic/opensuse15' (v3.4.2) for provider: vmware_desktop
    box: Downloading: https://vagrantcloud.com/generic/boxes/opensuse15/versions/3.4.2/providers/vmware_desktop.box
    box: Calculating and comparing box checksum...
==> box: Successfully added box 'generic/opensuse15' (v3.4.2) for 'vmware_desktop'!
Bringing machine 'default' up with 'vmware_desktop' provider...
==> default: Cloning VMware VM: 'generic/opensuse15'. This can take some time...
==> default: Checking if box 'generic/opensuse15' version '3.4.2' is up to date...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for the VM to receive an address...
==> default: Forwarding ports...
    default: -- 22 => 2222
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Configuring network adapters within the VM...
vagrant@opensuse15:~> cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.3"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.3"
PRETTY_NAME="openSUSE Leap 15.3"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.3"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
vagrant@opensuse15:~> exit
logout
Connection to 127.0.0.1 closed.
[ladar@walter vagrant]$ vmware --version
VMware Workstation 15.5.7 build-17171714