Skip to content

Instantly share code, notes, and snippets.

@joseph
Created March 22, 2012 04:14

Revisions

  1. joseph created this gist Mar 22, 2012.
    79 changes: 79 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,79 @@
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    # Preventing kernel panics - VirtualBox 4.1 and Mac OS X Lion 10.7.
    #
    # This happens on my Macbook Air Mid-2011 Core i7. Every few hours, with
    # one or (particularly) more VMs running, you will get a kernel panic.
    #
    # Some reading:
    # https://www.virtualbox.org/ticket/9359
    # https://forums.virtualbox.org/viewtopic.php?f=8&t=45387
    # https://groups.google.com/forum/#!topic/vagrant-up/o3qv-ZMwrFQ
    #
    # The fix - downgrade to VirtualBox 4.0.14:
    #
    # OSX: http://download.virtualbox.org/virtualbox/4.0.14/VirtualBox-4.0.14-74382-OSX.dmg
    #
    # You should modify your base box to run the same version of
    # VirtualBox Guest Additions. Create a new vagrant project,
    # vagrant up, and ssh in. Run the following:
    #
    # $ sudo apt-get install linux-headers-`uname -r`
    # $ cd /opt
    # $ wget http://download.virtualbox.org/virtualbox/4.0.14/VBoxGuestAdditions_4.0.14.iso
    # $ sudo mount VBoxGuestAdditions_4.0.14.iso -o loop /mnt
    # $ cd /mnt
    # $ sudo sh VBoxLinuxAdditions.run --nox11
    # $ sudo rm /opt/VBoxGuestAdditions_4.0.14.iso
    #
    # Now logout and package up the box so you can reimport
    # it as your base box. (See Vagrant documentation for details on this.)
    #

    Vagrant::Config.run do |config|
    # This prevents disk corruption (deleted inodes) on Ext4
    # filesystems under VirtualBox. In newer versions of VirtualBox,
    # it may be on by default. If you are seeing 'read-only file system'
    # errors, or 'input/output errors', or constant fsck errors on reboot,
    # you need this.
    #
    # Some reading:
    #
    # http://joeshaw.org/2011/09/30/terrible-vagrant-virtualbox-performance-on-mac-os-x/
    # https://www.virtualbox.org/ticket/9749
    # https://bugs.launchpad.net/ubuntu/+source/linux/+bug/528981 (Comment #51)
    #
    config.vm.customize([
    'storagectl',
    :id,
    '--name',
    'SATA Controller',
    '--hostiocache',
    'on'
    ])

    # As of VirtualBox 4.1, you have to explicitly indicate that you will
    # allow symlinks to be created in your shared folders. This is for
    # security reasons. (I'm not using 4.1 yet, but I expect to.)
    #
    # Note that this config is PER-FOLDER, so if you create other shared
    # folders, replace 'v-root' in this statement with the shared folder id.
    #
    config.vm.customize([
    'setextradata',
    :id,
    'VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root',
    '1'
    ])

    # This is how you set memory (MB).
    #
    config.vm.customize([
    'modifyvm',
    :id,
    '--memory',
    512
    ])

    end