Posts

Showing posts with the label Grub

Recovering or restoring grub in CentOS or RHEL 7

Image
What if GRUB is corrupted on your RHEL or CentOS 7 ? GRUB corruption is a common problem in RHEL or CentOS, which could occur due these reasons: If any file is missing or deleted from "/boot/grub2/" folder e.g. "grub.cfg" Mistakenly ran "dd" utility to clear boot sector Due to bad sector or corrupted disk Bad or incompatible firmware/driver installation  e.t.c. In case GRUB is corrupted, usually after powering on your server you see below kind of shell, also known as GRUB shell: Once you get to this prompt there is a way to restore or recover GRUB so that your system can boot up properly. To recover GRUB we need to have RHEL or CentOS 7 ISO image, which we usually use for OS installation. Make sure you mount same OS version iso image which is already installed on system. Below procedure will work only on BIOS based X86 servers and virtual machines. Follow these steps to recover GRUB: Step 1 : Mount RHEL or CentOS 7 ISO image ...

How to install Grub natively on your HDD ?

Installing GRUB natively : Caution : Installing GRUB's stage1 in this manner will erase the normal boot-sector used by an OS. GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD directly, so using it on a boot sector should be okay. But generally, it would be a good idea to back up the first sector of the partition on which you are installing GRUB's stage1. This isn't as important if you are installing GRUB on the first sector of a hard disk, since it's easy to reinitialize it (e.g. by running `FDISK /MBR' from DOS). If you decide to install GRUB in the native environment, which is definitely desirable, you'll need to create the GRUB boot disk, and reboot your computer with it. Once started, GRUB will show the command-line interface. First, set the GRUB's root device, to the boot directory, like this: grub> root (hd0,0) If you are not sure which partition actually holds these files, use the command like this; grub> fi...

"grub-install" How to.

1. How to create GRUB boot floppy with a filesystem ? # mke2fs /dev/fd0 # mount -t ext2 /dev/fd0 /mnt # grub-install --root-directory=/mnt fd0 # umount /mnt 2. How to install GRUB in USB pendrive ? Some BIOSes have a bug of exposing the first partition of a USB drive as a floppy instead of exposing the USB drive as a hard disk (they call it “USB-FDD” boot). In such cases, you need to install like this: # losetup /dev/loop0 /dev/sdb1 # mount /dev/loop0 /mnt/usb # grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0 3. How to install GRUB if you have saparate /boot partition on any Hard disk ? # grub-install --root-directory=/boot /dev/hda OR, in grub menu to install GRU on available hardisk, root (hd0,0) setup (hd0) grub-install accepts the following options: ‘--help’ Print a summary of the command-line options and exit. ‘--version’ :Print the version number of GRUB and exit. ‘--root-directory=dir’ :Install GRUB i...

What is GRUB ?

What is GRUB ? GRUB (GRand Unified Bootloader) : A boot loader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to an operating system kernel software. The kernel, in turn, initializes the rest of the operating system. GRUB is a very powerful boot loader, which can load a wide variety of free operating systems, as well as proprietary operating systems with chain-loading (chain-load is the mechanism for loading unsupported operating systems by loading another boot loader. It is typically used for loading DOS or Windows). One of the important features in GRUB is flexibility; GRUB understands filesystems and kernel executable formats, so you can load an arbitrary operating system the way you like, without recording the physical position of your kernel on the disk. Features: 1. Support multiple filesystem types like, ext2/3/4, DOS, FAT12/16/32, NTFS, ReiserFS and many more. 2. Suppoerts automatic & transpar...

How to set password in GRUB and make it more secure.

Image
Now a days in every IT Company security is the main & serious issue. Use the following steps to set Password in grub, so that only authenticated users have full access of it. Steps : Make a MD5 encrypted password hash by "grub-md5-crypt" command, Make a note of password hash. Now edit GRUB configuration file "/boot/grub/grub.conf" with any text editor, and add a line in to it as below; Save file & Reboot your system to check. Next, when system reboots go to grub by interrupting boot process (Keep Pressing any key after bios loads), Now once you see grub screen press "P" as instructed there on the GRUB screen, it'll ask you for password.   Now after entering password, it'll go to unlocked grub screen. To remove this password, again edit /boot/grub/grub.conf & remove "password --md5 <MD5 Hash>" . -Enjoy ;)