HostOnNet Blog

Grub

Looking for Linux Server Admin or WordPress Expert? We can help.

If your system do not show grub menu, hold down SHIFT key on system start to show grub menu.

To press c to enter grub command line.

Show grub command prompt results paginated, run

set pager=1

ls command shows all available partitions. To see files in a partition, use ls (hd0,1)/

cat command can be used to display content of a file. Example: cat (hd0,1)/etc/issue

set command is used to set settings. If you don’t specify any value, it print out existing settings.

Setting kernel and booting up

grub> set root=(hd0,1)
grub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1
grub> initrd /boot/initrd.img-3.13.0-29-generic
grub> boot

To generate grub.cfg on CentOS 7, run

grub2-mkconfig -o /boot/grub2/grub.cfg

Rebuild/Update grub.cfg

On Debian

root@hon-vpn:~# update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
done
root@hon-vpn:~#

View All Menu entry

CentOS/RHEL

grep menuentry /boot/grub2/grub.cfg

Debian/Ubuntu

grep menuentry /boot/grub/grub.cfg

Posted in CentOS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.