mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
110 lines
4.2 KiB
Markdown
110 lines
4.2 KiB
Markdown
[#]: subject: "How to Access the GRUB Menu in Virtual Machine"
|
|
[#]: via: "https://itsfoss.com/access-grub-virtual-machine/"
|
|
[#]: author: "Sagar Sharma https://itsfoss.com/author/sagar/"
|
|
[#]: collector: "lkxed"
|
|
[#]: translator: " "
|
|
[#]: reviewer: " "
|
|
[#]: publisher: " "
|
|
[#]: url: " "
|
|
|
|
How to Access the GRUB Menu in Virtual Machine
|
|
======
|
|
|
|
Most modern VMs are configured to skip the [GRUB bootloader][1] 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][2].
|
|
|
|
> 💡 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][3]
|
|
|
|
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][4] 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][5]
|
|
|
|
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][6]
|
|
|
|
And finally, you can [save the changes and exit from the nano][7] 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:
|
|
|
|
I hope you will find this guide helpful and if you have any queries, let me know in the comments.
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
via: https://itsfoss.com/access-grub-virtual-machine/
|
|
|
|
作者:[Sagar Sharma][a]
|
|
选题:[lkxed][b]
|
|
译者:[译者ID](https://github.com/译者ID)
|
|
校对:[校对者ID](https://github.com/校对者ID)
|
|
|
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
|
|
[a]: https://itsfoss.com/author/sagar/
|
|
[b]: https://github.com/lkxed/
|
|
[1]: https://itsfoss.com/what-is-grub/
|
|
[2]: https://itsfoss.com/how-to-hack-ubuntu-password/
|
|
[3]: https://itsfoss.com/content/images/2023/07/access-GRUB-in-Ubuntu-VM.gif
|
|
[4]: https://itsfoss.com/boot-older-kernel-default/
|
|
[5]: https://itsfoss.com/content/images/2023/07/change-grub-style.webp
|
|
[6]: https://itsfoss.com/content/images/2023/07/configure-grub-timeout-in-ubuntu.webp
|
|
[7]: https://linuxhandbook.com/nano-save-exit/
|