Displaying Our Vagrant VMs User Interface

Displaying the GUI

By default when Vagrant boots a VM it do so in a mode know as “headless mode”. Headless mode just means that no UI from the underlying provider is displayed. There are going to situations where we’re testing changes to our VM and we’ll be unable to access the VM using vagrant ssh (such as when we make a mistake altering the firewall rules). In order to display the UI we can add vb.gui = true to our virtualbox configuration.

Vagrant.configure("2") do |config|
  config.vm.box = "generic/ubuntu2004"

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
  end
end

The next time we perform a vagrant up or vagrant reload VirtualBox will open and we’ll see the virtualbox displayed.

Virtual Box

Then we can login using vagrant as the username and password and preform any actions we need to troubleshoot the problem.