Tuesday, August 22, 2017

Solved: Cannot connect Postgre in VM from host

Be The First To Comment
Used vagrant for setting up the VM, so set private network and port forward in vagrant file as below -
               
                 migration.vm.network "private_network", ip: "192.168.33.10"
                 migration.vm.network "forwarded_port",guest:5432 , host:15432 


1. Use telnet localhost 15432 to see if the port is open (Host)


Still can not connect to PostgresSql running in VM  :(

Then

2. Edit postgresql.conf (Guest)
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

           listen_addresses = '*'


3.  Add following in pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all              all            0.0.0.0/0               md5


4. Finally, able to connect to Postgres via localhost:15432

Thursday, March 16, 2017

Good compatibility of latest vagrant and virtual box

Be The First To Comment
Continuing from my older post  on Vagrant 1.7.2 / 1.9.2 and Virtualbox 4.3.12  / 5.1.14. I upgraded into Vagrant 1.9.2 and 5.0.x and 5.1.x , because of security vulnerabilities on those Virtualbox versions, but my shell provisions and puppet provision that used to work on old setting suddenly stopped working and tried various workaround to make them working but failed until Virtualbox 5.1.18. I use chocolaty, to upgrade/install vagrant and virtual box in Windows 7 host and able to fire 'vagrant up' to provision my new guest.

Step 1

Install chocolaty in host machine using cmd.exe (Run elevated)
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
      choco -v (Just to make sure chocolaty installed correctly)
      
      0.10.3 (as of 3/16/2017)

    Step 2
    Open Windows' power shell (Run elevated) 
    1. Install or upgrade oracle virtual box

    choco install virtualbox -version 5.1.18
                                                                                                             5.1.18 r114002
    choco upgrade virtualbox

    2. Install or upgrade vagrant

    choco install vagrant -version 1.9.2

    choco upgrade vagrant

    3. Restart the machine
    4. Vagrant up ....Boom all old scripts starting work again!

    Thursday, September 8, 2016

    Solution: Vagrant stopped working - `open': Access is denied. (5) (ChildProcess::Error)

    Be The First To Comment
    ERROR from CMD with out running vagrant up as administrator

    There was an error while executing `VBoxManage`, a CLI used by Vagrant
    for controlling VirtualBox. The command and stderr is shown below.

    Command: ["showvminfo", "18021ea0-83ee-43c3-9adb-26ad7eb0c6ca"]

    Stderr: VBoxManage.exe: error: Failed to create the VirtualBox object!
    VBoxManage.exe: error: Code CO_E_SERVER_EXEC_FAILURE (0x80080005) - Server execu
    tion failed (extended info not available)
    VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or
    failed to start.

    Error on running vagrant up as administrator from CMD

    C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.5.9/lib/childprocess/wind
    ows/handle.rb:12:in `open': Access is denied. (5) (ChildProcess::Error)
            from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.5.9/lib/chil
    dprocess/windows/process.rb:70:in `launch_process'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.5.9/lib/chil
    dprocess/abstract_process.rb:82:in `start'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/subprocess.rb:122:in `block in execute'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/safe_chdir.rb:26:in `block (2 levels) in safe_chdir'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/safe_chdir.rb:25:in `chdir'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/safe_chdir.rb:25:in `block in safe_chdir'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/safe_chdir.rb:24:in `synchronize'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/safe_chdir.rb:24:in `safe_chdir'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/subprocess.rb:121:in `execute'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/subprocess.rb:22:in `execute'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/u
    til/platform.rb:129:in `cygwin_windows_path'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/provi
    ders/virtualbox/driver/base.rb:50:in `block in initialize'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/provi
    ders/virtualbox/driver/base.rb:42:in `each'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/provi
    ders/virtualbox/driver/base.rb:42:in `initialize'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/provi
    ders/virtualbox/driver/meta.rb:36:in `initialize'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/provi
    ders/virtualbox/provider.rb:20:in `new'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/provi
    ders/virtualbox/provider.rb:20:in `usable?'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/v
    agrantfile.rb:138:in `machine_config'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/v
    agrantfile.rb:45:in `machine'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/e
    nvironment.rb:663:in `machine'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/p
    lugin/v2/command.rb:177:in `block in with_target_vms'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/p
    lugin/v2/command.rb:201:in `call'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/p
    lugin/v2/command.rb:201:in `block in with_target_vms'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/p
    lugin/v2/command.rb:183:in `each'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/p
    lugin/v2/command.rb:183:in `with_target_vms'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/comma
    nds/up/command.rb:131:in `install_providers'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/comma
    nds/up/command.rb:85:in `execute'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/c
    li.rb:42:in `execute'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/e
    nvironment.rb:302:in `cli'
            from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/bin/vagrant:1
    74:in `<main>'

    Similar issue on Question from Stack Overflow

    Fix steps for my machine-

    1. Installed fresh - Vagrant (1.8.5)
    2. Installed fresh Virtual box VirtualBox 5.1.4 for Windows host x86/amd64 - Version 5.1.4 r110228 (Qt5.5.1) 
    3. Install Git bash version 2.8.2.windows.1 (64 bit)
    4. Running Git bash as admin and calling vagrant up through that elevated console

    Solution-
    https://laracasts.com/discuss/channels/servers/vagrant-up-failing-trying-to-add-to-hosts

    Monday, June 27, 2016

    [SOLUTION] Vagrant - Remote connection disconnect. Retrying ...

    Be The First To Comment
    Here is error from guest machine, complaining about remote connection

     ==> default: Attempting graceful shutdown of VM...  
     ==> default: Clearing any previously set forwarded ports...  
     ==> default: Clearing any previously set network interfaces...  
     ==> default: Preparing network interfaces based on configuration...  
       default: Adapter 1: nat  
       default: Adapter 2: hostonly  
     ==> default: Forwarding ports...  
       default: 80 (guest) => 8080 (host) (adapter 1)  
       default: 3000 (guest) => 3000 (host) (adapter 1)  
       default: 22 (guest) => 2222 (host) (adapter 1)  
     ==> default: Running 'pre-boot' VM customizations...  
     ==> default: Booting VM...  
     ==> 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: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
       default: Warning: Remote connection disconnect. Retrying...  
    

    [SOLUTION] Vagrant box authentication failure after packaging box

    2 Comments
    ERROR IN NEWLY PACKAGED BOX AFTER - vagrant up


     Bringing machine 'default' up with 'virtualbox' provider...  
       ==> default: Clearing any previously set forwarded ports...  
       ==> default: Clearing any previously set network interfaces...  
       ==> default: Preparing network interfaces based on configuration...  
         default: Adapter 1: nat  
         default: Adapter 2: hostonly  
       ==> default: Forwarding ports...  
         default: 22 => 2222 (adapter 1)  
       ==> default: Running 'pre-boot' VM customizations...  
       ==> default: Booting VM...  
       ==> 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 timeout. Retrying...  
         default: Warning: Authentication failure. Retrying...  
         default: Warning: Authentication failure. Retrying...  
         default: Warning: Authentication failure. Retrying...  
         default: Warning: Authentication failure. Retrying...  
         default: Warning: Authentication failure. Retrying...  
         default: Warning: Authentication failure. Retrying...  
         default: Warning: Authentication failure. Retrying...  
    

    SOLUTION

    1. Press CTRL + Z to break the 'default: Warning: Authentication failure. Retrying... or wait for few more minutes

    2. Login into your guest machine - vagrant ssh , which should prompt you for password, vagrant , the default password for vagrant

    3. Then go to - /home/vagrant/.ssh  and remote all the contents inside it, if the path not existed create the directory - mkdir -p /home/vagrant/.ssh

    Friday, May 29, 2015

    [SOLVED] Vagrant & Virtualbox - The guest machine entered an invalid state while waiting for it to boot....

    2 Comments
    Last couple of days I was running a Virtualbox issue "The guest machine entered an invalid state while waiting for it to boot. Valid states are 'starting, running'. The machine is in the 'poweroff' state. Please verify everything is configured properly and try again."

    I had not clue how to fixed that and I have tried several versions and several installation. Then, then installation of Virtualbox 4.3.12 is working fine so far. If you are running into similar issue get  rid of all new Virtualbox versions and try with version 4.3.12, VirtualBox-4.3.12-93733-Win.exe, that might helps you solve the problem.

    This version can be downloaded from:
                                                  http://dlc-cdn.sun.com/virtualbox/4.3.12/

    Similarly, if you are using vagrant I recommend to use Vagrant 1.7.2. Please note that not all versions of vagrant and virtual box are compatible with each other.

    Updated environment for Vagrant and Virtual box in Windows 7 -
    http://www.gisremotesensing.com/2016/09/solution-vagrant-stopped-working-open.html

    Update
    Working version as of 1/27/2017:
    OS: Windows 7 Enterprise
    Vagrant 1.9.1
    Oracle VM Virtualbox - Version 5.1.14 r112924 (Qt5.6.2)
     

    © 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

    About Me