Today I upgraded my Vagrant and VirtualBox to the latest version (1.8.1 & 5.0.12-104815) and did the vagrant up.
I got this from Vagrant:
==> default: Waiting for machine to boot. This may take a few minutes...
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.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.

When I tried to start this box from VirtualBox I got this error message:
'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2' (VERR_INTNET_FLT_IF_NOT_FOUND).

Solution was to remove VirtualBox and install it again with the following parameter:
-msiparams NETWORKTYPE=NDIS5

, , , , ,

The guide below will help you to install latest version of JIRA (at the time of writing this article – version 7) in the VirtualBox VM, using Vagrant and Chef.
We won’t be creating any Chef cookbooks, we’ll just re-use the existing jira cookbook from the Chef supermarket.
We will also be using Berkshelf to handle the cookbook dependencies for us and Vagrant bento/centos-6.7 box that is available on hashicorp site, but you should be able to use any other Vagrant box as long as the jira cookbook supports it.

1. Install VirtualBox

  • I recommend using version 4.3 as version 5 still seems bit unstable to me.
  • You can disable VirtualBox updates to stay on 4.3. Use GUI or this:
    1
    
    VBoxManage setextradata global GUI/UpdateDate never

2. Install Vagrant

  • I recommend installation of the vagrant-vbguest plugin to recompile guest additions:
    1
    
    vagrant plugin install vagrant-vbguest
  • If you’re behind proxy, install also vagrant-proxyconf plugin:
    1
    
    vagrant plugin install vagrant-proxyconf

3. Install ChefDK (Berkshelf)
4. Install vagrant-berkshelf plugin:

1
vagrant plugin install vagrant-berkshelf

5. Create some directory and go to that directory:

1
2
mkdir jira
cd jira

6. Create Berksfile – jira/Berksfile:

1
2
source "https://supermarket.chef.io"
cookbook 'jira', '~> 2.7.0'

7. Create Vagrantfile – jira/Vagrantfile:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Vagrant.configure(2) do |config|
  # I am using centos-6.7 box, but others should work too...
  config.vm.box = "bento/centos-6.7" 
  config.vm.network "forwarded_port", guest: 8080, host: 8080
  config.vm.network "forwarded_port", guest: 443, host: 443
  config.vm.network "private_network", type: "dhcp"
  config.vm.provider "virtualbox" do |vb|
  # I am using 2GB of ram and 4 cpus as JIRA is resource hungry, adjust as needed
  # natdnshostresolver1 means that VirtualBox will use your host DNS to resolve hostnames
  vb.memory = 2048
     vb.cpus = 4
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end
  # enable Berkshelf, the Chef dependency management
  config.berkshelf.enabled = true
  # use jira cookbook to provision this box
  # jira cookbook will also create mysql database by default
  # mysql server password is mandatory for jira cookbook, otherwise the provisioning will fail, change it if you need to or leave it as it is
  config.vm.provision "chef_solo" do |chef|
    chef.add_recipe "jira"
    chef.json = {
    "mysql" => {
      "server_root_password" => "mysql"
    }
  }
  end
  # if you're using proxy and you installed vagrant-proxyconf plugin, set it up here
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://someproxy:8080"
    config.proxy.https    = "http://someproxy:8080"
    config.proxy.no_proxy = "localhost,127.0.0.1"
  end
  # optional - ssh agent forwarding
  config.ssh.forward_agent = true
end

8. You should now have the following structure:

1
2
3
+ jira/
++ Berksfile
++ Vagrantfile

9. Run Vagrant and let the provisioning finish:

1
vagrant up

10. Open browser and navigate to http://localhost:8080 or https://localhost

Note:
If there a is problem with JIRA startup because of some plugin timeout, increase the plugin startup timeout in /opt/atlassian/jira/bin/setenv.sh:

1
JVM_SUPPORT_RECOMMENDED_ARGS="-Datlassian.plugins.enable.wait=300"

Enjoy!

, , , , , , , ,

If you’ve created your VirtualBox VM with VDI that dynamically allocates space, you should know that the VDI size is not the same as the size of your VM guest filesystem. VDI size equals to the max. size your guest filesystem ever had and VirtualBox is not shrinking it back automatically. To shrink it back to the guest filesystem size, do the following:

Boot into your VM from Linux live CD/DVD
This step is not required if you you’re not going to shrink root filesystem.

I’ve used Oracle Enterprise Linux 6 iso with rescue mode.
You can use any Linux live CD/DVD that has dd and vgchange (for LVM) utilities. Most of them do.

Fill the empty space on each volume
If you’re using LVM, first do the following:

1
2
3
4
# to see the volumes in /dev/mappper
vgchange -a y       
# list the volumes
ls /dev/mapper

Following applies to any volume that can be mounted by your Linux live CD/DVD.
Create mount point for volume:

1
mkdir /mnt/root

Mount volume:

1
2
3
mount /dev/mapper/your_lvm_lv /mnt/root
# e.g. /dev/mapper/vg_oel-lv_root /mnt/root
# or for non LVM, e.g. mount /dev/sda1 /mnt/root

Change directory to the mounted volume:

1
cd /mnt/root

Fill empty space with zeroes:

1
2
# this may take some time
dd if=/dev/zero of=empty.file

Remove the file:

1
rm empty.file

Sync filesystem:

1
sync

Change the directory:

1
cd

Unmount the volume:

1
umount /mnt/root

Do the same for other volumes…
Shutdown the VM:

1
shutdown -h now  # or halt if you're missing shutdown command

Shrink/Compact the VDI

1
VBoxManage modifyhd --compact your.vdi

VBoxManage can be found in VirtualBox installation directory. I’ve put it to the PATH so that I can run VBoxManage from everywhere.

Enjoy!

, , , , ,