Tuesday, April 29, 2014

Installing JDK on Oracle Linux got this error error: Failed dependencies: bin/basename is needed by jdk-2000:1.6.0_38-fcs.x86_64

Problem

I was trying to setup my Oracle Enterprise Linux docker container with JDK and ran into this problem when I tried to execute the rpm.bin file, couldnt figure out the reason after tons of searches on internet and eventually solved it as mentioned in the Solution.

bash-4.1# cp /Software/linux/java/jdk-6u38-linux-x64-rpm.bin .
bash-4.1# chmod 755 jdk-6u38-linux-x64-rpm.bin
bash-4.1# ./jdk-6u38-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u38-linux-amd64.rpm 
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm 
error: Failed dependencies:
    /bin/basename is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/cat is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/cp is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/gawk is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/grep is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/ln is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/ls is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/mkdir is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/mv is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/pwd is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/rm is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/sed is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/sort is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/touch is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /usr/bin/cut is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /usr/bin/dirname is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /usr/bin/expr is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /usr/bin/find is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /usr/bin/tail is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /usr/bin/tr is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /usr/bin/wc is needed by jdk-2000:1.6.0_38-fcs.x86_64
    /bin/sh is needed by jdk-2000:1.6.0_38-fcs.x86_64
Installing JavaDB
error: Failed dependencies:
    /bin/sh is needed by sun-javadb-core-10.6.2-1.1.i386

Done.
bash-4.1# 



Solution

Download the .bin file which doesnt say .rpm.bin and follow the same installation process and it just works :)

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u38-oth-JPR


 Linux x6465.66 MB   jdk-6u38-linux-x64-rpm.bin
 Linux x6468.72 MB   jdk-6u38-linux-x64.bin
 

Tuesday, April 22, 2014

Vagrant + Docker :: Could not find repository on any of the indexed registries

ahoProblem

I was trying my hands on Docker provisioning with Vagrant and came across this error when I tried to provision a VM with a docker container that I uploaded to the docker registry earlier.

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "oel631"
  config.vm.network :forwarded_port, guest: 9090, host: 9090, auto_correct: true
  config.vm.synced_folder "/Users/Naga/Downloads/Software", "/Software"
  config.vm.provider :virtualbox do |vb|
     vb.customize ["modifyvm", :id, "--memory", 4096]
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
     vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  end
  config.vm.provision "docker" do |d|
    d.run "asnagaraj/java7u55tomcat7053ubuntu", 

      daemonize: true, 
      cmd: "echo hello world",
      args: "-v '/Software:/Software'"
   end
end


Could not find repository on any of the indexed registries

Solution

Add dns="8.8.8.8" argument to the run command to make sure the docker container has access to internet to resolve hosts and access and download the images

Updated Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "oel631"
  config.vm.network :forwarded_port, guest: 9090, host: 9090, auto_correct: true
  config.vm.synced_folder "/Users/Naga/Downloads/Software", "/Software"
  config.vm.provider :virtualbox do |vb|
     vb.customize ["modifyvm", :id, "--memory", 4096]
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
     vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  end
  config.vm.provision "docker" do |d|
    d.run "asnagaraj/java7u55tomcat7053ubuntu",
      daemonize: true,
      cmd: "echo hello world",
      args: "--dns='8.8.8.8'  -v '/Software:/Software'"
  end
end


[vagrant@localhost ~]$ sudo docker images
REPOSITORY                           TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
asnagaraj/java7u55tomcat7053ubuntu   latest              7e10245f1e4c        4 days ago          737.3 MB

Issues using Docker provisioning on Vagrant

Problem

I wanted to try my hands with Docker provisioning on Vagrant this weekend and came across tons of issues and the main issue was around docker provisioner...

* The 'docker' provisioner could not be found.  (was using super old Vagrant version 1.3.5 so upgraded to 1.5.3)

Vagrantfile Sample 1

Vagrant.configure("2") do |config|
  config.vm.box = "oel631"
  config.vm.provision "docker",
    images: ["ubuntu"]
end



Error while trying to bring up my VM / provision it when it was already running

Docker is not running on the guest VM.


Vagrantfile Sample 2 

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"

  config.vm.provision "docker" do |d|
    d.pull_images "ubuntu"
  end
end


Vagrant assumes that this means the command failed!
service docker start
Stdout from the command:
Stderr from the command:
stdin: is not a tty
start: Job is already running: docker


Vagrantfile Sample 3

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"

  config.vm.provision "docker" do |d|
    d.run "ubuntu",
      cmd: "bash -l",
      args: "-v '/vagrant:/var/www'"
    end
end


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

service docker start

Stdout from the command:



Stderr from the command:

stdin: is not a tty
start: Job is already running: docker


Solution

Got a resolution to upgrade to Vagrant 1.5.4 from the issue below after spending so much time on Google reading 1000's of post where people have used Docker provisioning on Vagrant. Seems to me like Vagrant 1.5.3 was the killer. I personally think Vagrant 1.5.3 doesnt really work well with Docker provisioning.

https://github.com/mitchellh/vagrant/issues/3487

Thursday, April 17, 2014

Vagrant shows startup warnings about Vagrantfile using earlier version syntax

Problem

My vagrant shows the following message when I try to bring up my vagrant 

There were warnings and/or errors while loading your Vagrantfile
for the machine 'default'.

Your Vagrantfile was written for an earlier version of Vagrant,
and while Vagrant does the best it can to remain backwards
compatible, there are some cases where things have changed
significantly enough to warrant a message. These messages are
shown below.

Warnings:
* `config.vm.customize` calls are VirtualBox-specific. If you're
using any other provider, you'll have to use config.vm.provider in a
v2 configuration block.


The issue seem to be because I was using vagrant 1.3.5 and was using some older syntax
Vagrant::Config.run do |config|
  config.vm.box = "precise64"
  config.vm.forward_port 8080, 8080
  config.vm.share_folder("vagrant-root", "/vagrant", ".")
  config.vm.customize ["modifyvm", :id, "--memory", 4096]
end


Solution

I changed my Vagrantfile as follows as my error/warning is gone now..During the transition I got the following error

There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The following settings shouldn't exist: forward_port, share_folder

as I was using configure("2") and using older syntax for forwarding ports and sharing folders, which also got fixed with the following updates


Vagrant.configure("2") do |config|
  config.vm.box = "precise64"
  config.vm.network :forwarded_port, guest: 8080, host: 9090, auto_correct: true
  config.vm.synced_folder "/Users/Naga/Downloads/Software/AHold", "/Software"
  config.vm.provider :virtualbox do |vb|
     vb.customize ["modifyvm", :id, "--memory", 4096]
  end

end