Configure GRUB2 Boot Loader Settings In Ubuntu 16.04
来源:互联网 发布:手机数据可以恢复吗 编辑:程序博客网 时间:2024/06/05 19:26
As you probably know, GRUB2 is default boot loader for most Linux operating systems. GRUB stands for GRand Unified Bootloader. GRUB boot loader is the first program that runs when the computer starts. It is responsible for loading and transferring control to the operating system Kernel. Then, the Kernel takes charge, and initializes the rest of the operating system.
In this tutorial, we will be discussing about configuring some important GRUB2 Boot Loader’s settings in Ubuntu 16.04 LTS desktop. I tested this guide in Ubuntu 16.04 LTS desktop, however these instructions might work on all Linux operating systems that uses GRUB2 boot loader.
Configure GRUB2 Boot Loader settings.
Warning: The default configuration file for GRUB2 is /boot/grub/grub.cfg. You shouldn’t edit or modify this file, unless you are much familiar with GRUB2. This is the main file to boot into the Linux OS. If you do anything wrong with this file, then you will be surely end up with broken system. So, Don’t touch this file!
All settings related to the GRUB2 will be stored in /etc/default/grub file. Whatever the changes you made in this file will be reflected to the GRUB2.
Make a backup of /etc/default/grub file before making any changes.
sudo cp /etc/default/grub /etc/default/grub.bak
Let us see the main options in the GRUB boot loader.
The typical grub will look like below.
cat /etc/default/grub
Sample output:
# If you change this file, run 'update-grub' afterwards to update# /boot/grub/grub.cfg.# For full documentation of the options in this file, see:# info -f grub -n 'Simple configuration'GRUB_DEFAULT=0GRUB_HIDDEN_TIMEOUT=0GRUB_HIDDEN_TIMEOUT_QUIET=trueGRUB_TIMEOUT=10GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"GRUB_CMDLINE_LINUX=""# Uncomment to enable BadRAM filtering, modify to suit your needs# This works with Linux (no patch required) and with any kernel that obtains# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"# Uncomment to disable graphical terminal (grub-pc only)#GRUB_TERMINAL=console# The resolution used on graphical terminal# note that you can use only modes which your graphic card supports via VBE# you can see them in real GRUB with the command `vbeinfo'#GRUB_GFXMODE=640x480# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux#GRUB_DISABLE_LINUX_UUID=true# Uncomment to disable generation of recovery mode menu entries#GRUB_DISABLE_RECOVERY="true"# Uncomment to get a beep at grub start#GRUB_INIT_TUNE="480 440 1"
Whenever you made a change in this file, you must run the following command to apply the changes to the GRUB2.
sudo update-grub
Let us do three important tweaks in the GRUB2 boot loader.
1. Select default OS (GRUB_DEFAULT)
We can select the default OS to boot using this option. If you set the value as “0”, the first operating system in the GRUB boot menu entry will boot. If you set it as “1”, the second OS will boot, and so on.
Also, if you have more than one OS in your system, you can boot the last operating system using the value GRUB_DEFAULT=saved. Whenever you reboot the system, the last operating system will start boot. Please note that you should add a line GRUB_SAVEDEFAULT=true to make this trick work.
2. Set OS timeout (GRUB_TIMEOUT)
By default, the selected entry from the boot menu will start to boot in 10 seconds.
You can increase or decrease this timeout setting. If the value is “0”, the default OS will immediately start to boot. If the value is “5” , the boot menu will appear for 5 seconds, so that you can select which OS you want to load when the system starts.
3. Change GRUB background image
To change the GRUB background image, you need to copy your preferred image to /boot/grub/ location.
sudo cp my-own-background.png /boot/grub/
Replace the image path with your own. You can use JPG/JPEG format images as well. But GRUB supports only 256 color JPG/JPEG image formats only. So, it is better to use PNG format images.
Once you made the necessary changes in the GRUB file, Save and close it.
To apply the changes, you must run the following command:
sudo update-grub
You should see the following output:
Generating grub configuration file ...Found background image: ostechnix.pngFound linux image: /boot/vmlinuz-4.4.0-15-genericFound initrd image: /boot/initrd.img-4.4.0-15-genericFound linux image: /boot/vmlinuz-4.2.0-34-genericFound initrd image: /boot/initrd.img-4.2.0-34-genericFound memtest86+ image: /boot/memtest86+.elfFound memtest86+ image: /boot/memtest86+.bindone
Reboot and check whether the changes are working or not.
Please be mindful that you shouldn’t edit or modify GRUB2 settings in mission critical or production systems. I recommend you to test these settings in any virtual machine first, and then apply to the production systems.
That’s all folks. I will be here soon with another Interesting article. If you find this guide helpful, please share it on your social and professional networks.
Cheers!
- Configure GRUB2 Boot Loader Settings In Ubuntu 16.04
- Ubuntu中如何修复GRUB2 Boot Loader
- Ubuntu中如何修复GRUB2 Boot Loader
- How do I configure my DNS settings in Ubuntu server?
- configure apache in ubuntu
- how to edit grub2 menu in ubuntu
- boot fedora 21 manually in grub2 shell prompt
- [Hack][grub2] 单boot分区,Feodra和Ubuntu启动共存
- Grub2 Configuration (boot menu)
- /boot/grub2/grub.cfg
- grub2 efi boot cdrom
- grub2 boot kernel
- grub2 中的boot命令
- configure emacs+python environment in ubuntu
- [MySQL]Install and Configure MySQL in Ubuntu
- Configure my unity & compiz in ubuntu/raring
- The procedure to configure MySQL in Ubuntu
- Configure Sublime Text 2 in Ubuntu
- 3_使用C语言控制LED灯实验
- hdu5934(tarjan算法+缩点)bomb
- 一行代码搞定Parcelable 告别Parcelable繁琐代码!
- 条件变量
- 43. Multiply Strings
- Configure GRUB2 Boot Loader Settings In Ubuntu 16.04
- 【自考总结】在摸索中找方法--2017.10.22
- java中的swing组件、主要三大布局管理器的应用
- NoSQL概述(已迁移)
- LU三角分解(matlab程序)
- 关于微机原理个人的一些总结(1)
- jquery-easyui-datagrid,弹框
- Rust: 逆序输出&str
- FAST角点检测原理及其C/C++实现