Linux Tutorial

Linux File/Directory Management

Linux Packaging And Compression

Vim Text Editor

Linux Text Processing

Linux Software Installation

Linux User/User Group Management

Linux Permission Management

Linux Filesystem Management

Linux Advanced Filesystem Management

Linux System Management

Linux Backup and Recovery

Linux System Service Management

Linux System Log Management

Linux Boot Management

LAMP/LNMP Environment

SELinux Management

Linux /boot/grub/grub.conf (GRUB Configuration File)

In some Linux distributions, especially those based on Red Hat or Fedora, the GRUB bootloader configuration file is located at /boot/grub/grub.conf instead of /boot/grub/grub.cfg. The process of editing and updating the configuration file remains similar. This tutorial will guide you through the process of modifying the /boot/grub/grub.conf file in these systems.

  1. Exploring grub.conf file:

    The grub.conf file contains the bootloader settings, such as menu entries for different operating systems or kernel versions, timeout values, and default boot entry. Here's a sample grub.conf file structure:

    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    
    title Linux Distro
        root (hd0,0)
        kernel /vmlinuz-linux root=/dev/sda1 ro quiet
        initrd /initramfs-linux.img
    
    title Another Linux Distro
        root (hd0,1)
        kernel /vmlinuz-linux root=/dev/sda2 ro quiet
        initrd /initramfs-linux.img
    
  2. Modifying grub.conf file:

    To modify the grub.conf file, open it with a text editor, such as nano or vim, with administrative privileges:

    sudo nano /boot/grub/grub.conf
    

    Some common settings you might want to modify are:

    • default: Set the default boot entry (use a numeric value starting from 0).
    • timeout: Set the number of seconds the GRUB menu is displayed before the default entry is booted.
    • title: Specifies a menu entry. Follow this line with the root, kernel, and initrd lines to configure the boot options for the entry.

    After making changes, save and exit the text editor.

  3. Updating the grub.conf file:

    Unlike /boot/grub/grub.cfg in some distributions, you generally do not need to run update-grub or grub-mkconfig when using /boot/grub/grub.conf. The changes made to the grub.conf file will take effect immediately upon the next system reboot.

    However, in some cases, a symlink (symbolic link) is used to point /boot/grub/grub.conf to another file (such as /boot/grub/grub.cfg). If this is the case on your system, you may still need to run update-grub or grub-mkconfig to update the actual configuration file.

  4. Backup before modifying:

    Before making any changes to your grub.conf file, it's always a good idea to make a backup. This allows you to restore the original configuration in case of any errors. To create a backup, run the following command:

    sudo cp /boot/grub/grub.conf /boot/grub/grub.conf.bak
    

With this tutorial, you can now modify the GRUB settings on Linux systems that use /boot/grub/grub.conf as the GRUB configuration file. This enables you to fine-tune your bootloader and manage multiple operating systems or kernel versions more effectively.

  1. Editing grub.conf in Linux:

    • Use a text editor to modify the grub.conf file.
    sudo nano /boot/grub/grub.conf
    
  2. Location of grub.conf in /boot/grub/:

    • Locate the grub.conf file in the /boot/grub/ directory.
    ls /boot/grub/grub.conf
    
  3. Adding kernel parameters in grub.conf:

    • Include additional kernel parameters in grub.conf to customize kernel behavior.
    kernel /vmlinuz-5.4.0-91-generic root=/dev/sda1 ro quiet splash
    
  4. GRUB menu customization in grub.conf:

    • Customize GRUB menu entries for different operating systems or kernel versions.
    title Ubuntu 20.04
    root (hd0,1)
    kernel /vmlinuz-5.4.0-91-generic root=/dev/sda1 ro quiet splash
    
  5. Backup and restore grub.conf in Linux:

    • Create a backup of grub.conf before making changes and restore if needed.
    cp /boot/grub/grub.conf /boot/grub/grub.conf.bak
    
  6. Default entries in grub.conf:

    • Set the default boot entry in grub.conf for the GRUB menu.
    default 0
    
  7. GRUB timeout settings in grub.conf:

    • Adjust the timeout for the GRUB menu in grub.conf.
    timeout 5
    
  8. Troubleshooting errors in grub.conf:

    • Troubleshoot common errors in grub.conf, such as syntax issues or incorrect configurations.
    grub2-mkconfig -o /boot/grub/grub.cfg