How to Access the GRUB Menu in Virtual Machine

Need to access Grub while using Linux in a VM? Here's how to do that.

Most modern VMs are configured to skip the GRUB bootloader for a seamless experience.

However, you might need to access the GRUB menu at times. For example, if you want to switch back to the older kernel or get into recovery mode for resetting the password.

πŸ’‘

Reboot your VM and keep the Shift key pressed when it is booting up again. This should give you the GRUB menu.

In this quick article, I will be showing you two ways to access the GRUB menu in Linux running in a virtual machine:

  • A temporary solution (when you have to access GRUB once or twice)
  • A permanent solution (will show GRUB at every boot)

As most of the users are not going to interact with the grub on a daily basis, I will start with a temporary solution in which you can access the grub without any tweaks.

πŸ“‹

I have used Ubuntu in the tutorial here but the steps should be valid for other Linux distributions as well.

Access the GRUB bootloader in VM (Quick way)

If you want to access the GRUB occasionally, this is supposed to be the best way as it does not require any configuration.

Just reboot your system and keep the shift key pressed.

That's it!

You will have your grub menu without any time limit:

Accessing grub menu in VM using shift key
Keep the Shift key pressed while booting to access Grub in VM

Pretty simple way. Isn't it?

But it will work for that specific boot only. So what if you want to have the grub on every boot? Refer to the given method.

Enable Grub menu in virtual machines permanently (if you want to)

🚧

This method requires changing Grub config file in the command line. Please ensure that you are comfortable doing the edits in the terminal.

If you have to deal with the grub menu to access the other operating systems or change boot from the older kernels often, this method is just for you.

To make the grub accessible at every boot, you must make changes in the configuration file.

First, open the grub config file using the following command:

sudo nano /etc/default/grub

Here, change the GRUB_TIMEOUT_STYLE=hidden to the GRUB_TIMEOUT_STYLE=menu:

change grub timeout style

Next, in the same config file, specify for how many seconds you want the grub to be displayed.

I would recommend 5 seconds as it seems to balance between not too long and short (yep, quite relatable):

GRUB_TIMEOUT=5
configure grub timeout in ubuntu

And finally, you can save the changes and exit from the nano text editor.

To activate the changes you made to the config file, update the grub using the following command:

sudo update-grub

That's it. Reboot your system and the grub should be there for 5 seconds.

How about theming GRUB?

You will get the grub bootloader in most of the Linux distros as it is quite simple to configure and gets the job done.

But by default, it's nothing apart from the black background and plain text. So we made a guide on how you can make it look dope:

Customize Grub to Get a Better Experience With Linux
Couple of Grub configuration tweaks to get better experience with multi-boot Linux system using Grub Customizer GUI tool.

I hope you will find this guide helpful and if you have any queries, let me know in the comments.

About the author
Sagar Sharma

Sagar Sharma

A software engineer who loves to write about his experience with Linux. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.