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.
Then we can login using vagrant as the username and password and preform any actions we need to troubleshoot the problem.
Scott is the Director of Technology at WeCare Connect where he strives to provide solutions for his customers needs. He's the father of two and can be found most weekends working on projects around the house with his loving partner.
More In This Series
- What's a Virtual Machine?
- Why Use Vagrant?
- Initializing a Vagrant Development Environment
- Managing A Vagrant Environment's Power State
- How to Reset/Delete A Vagrant Development Environment
- Configuring Our Vagrant Development Environment's Network
- Remotely Accessing Our Vagrant Development Environment (Linux/Ubuntu)
- Syncing Files to Our Vagrant Development Environment
- Customizing the Amount Of RAM in Our Vagrant VMs
- Displaying Our Vagrant VMs User Interface