Home > Enterprise Linux Tips > > Fixing Linux boot problems with GRUB
Enterprise Linux Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 


Fixing Linux boot problems with GRUB


Sander van Vugt, Contributor
07.08.2009
Rating: -4.50- (out of 5)


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


In the previous two parts of this series (Recovering Linux using Knoppix and Troubleshooting Linux boot problems), you have acquired some background knowledge that will help you fix Linux boot problems. Here, you'll read what you can do when your computer doesn't boot because of an error in the bootloader GRUB.

To start Linux, you need GRUB. But you may encounter a problem with GRUB that prevents your computer from booting properly. You will know this has occured because one of the following symptoms will be present:

  • GRUB is completely wiped and you see nothing but a blinking cursor when your server boots.
  • GRUB generates a generic GRUB error message
  • GRUB indicates that it cannot find a file it needs.

If you are having GRUB problems, there are two approaches to fix them. You can re-install GRUB and you can try to start your computer by manually entering GRUB in the command line. Let's start by looking how you can re-install GRUB. After that, you'll read how to manually load GRUB if you encounter a GRUB error.

Reinstalling GRUB
If you have a serious problem with the MBR on your computer, it can happen that you only see a blinking cursor at the moment your computer boots. If you have a serious problem with the MBR it is unlikely you have GRUB, therefore, you don't see a GRUB error message. Basically, in that situation it is impossible to boot your computer, so you need a rescue-CD to start it. You can use Knoppix to boot your computer.

Make sure that everything on your hard disk is mounted as described in the article mentioned before, enter a chroot environment and next use the command to install GRUB again. In case you want to instal...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Linux monitoring and troubleshooting
Recovering a lost administration password on Ubuntu Server
Access and repair an ext3 file system with the superblock
Solving Linux server hangs stemming from kernel issues
How to solve logical volume management issues
Troubleshooting Logical Volume Manager boot problems
How to fix master boot record partition table problems
Five Linux commands you have (probably) never heard of
Backing up the Linux master boot record
How well do you know Linux commands and tools?
Installing Nagios on Linux and unravelling software code names

Linux administration and management
Recovering a lost administration password on Ubuntu Server
How to fix master boot record partition table problems
Learning the craft of Linux administration with "Pro Linux System Administration"
Troubleshooting Linux boot problems
The Ext4 file system: A real improvement in Linux file storage?
A look at real-world exploits of Linux security vulnerabilities
Using virtualization to reinvent high-performance computing on Linux
Five common Linux security vulnerabilities you may be overlooking
Building a Linux infrastructure with maximum automation
Linux regular expression tutorial

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Heartbeat  (SearchEnterpriseLinux.com)
tty command  (SearchEnterpriseLinux.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


l GRUB in the MBR and the hard disk is addressed by the device file /dev/sda, you would use the command . This command reads the GRUB configuration file (/boot/grub/menu.lst on most distributions) and based on that, writes the new GRUB bootloader to the MBR. Here is what you will see when using to re-install GRUB

Booting manually with GRUB
It's not always necessary to re-install GRUB. If the GRUB code still exists, but due to an issue in the GRUB configuration file you are unable to boot anymore, you can try to reboot manually. This is the best approach if GRUB gives an error message and stops. By entering all GRUB commands manually, you can see exactly where the problem occurs and that helps you in fixing the problem. In the next procedure, you can read how to manually load the GRUB configuration.

  1. To enter the GRUB boot menu, watch carefully what your computer is doing when it boots. In most cases, it shows you have to press the Escape key at the moment GRUB is processed. This brings you to the GRUB command line. Alternatively, you can boot from a rescue CD and enter the command grub to open the GRUB command line interface. Here is an example of this interface.

    [IMAGE]
    Click on image for larger version
    From the GRUB command line interface, it's easy to troubleshoot GRUB.

  2. Fortunately, the GRUB shell offers you help, so that it's not strictly necessary to remember all the right commands. To get an overview of all commands that are available, just type the help command.

    [IMAGE]
    Click on image for larger version
    Type "help" to get an overview of all available commands.

  3. Loading GRUB manually requires entering all of the commands from the /boot/grub/menu.lst file manually. The best approach to do this is to look at the current contents of the menu.lst. You can do that from the GRUB shell by entering the command . Somewhere in this file (which may contain lots of comments) you will read what your computer needs to boot.

    [IMAGE]
    Click on image for larger version
    Make sure that you enter the correct commands, display the contents of the menu.lst file to get a good example.

  4. With the example on your computer's monitor, you can manually enter all the GRUB lines. That means that you have to enter the root, kernel and initrd lines. The following three lines give an example of what this could look like:
  5. After entering these commands, your computer awaits further instructions. Basically, that means you have to enter the boot command now. By entering this command, the boot process starts. Monitor it carefully to make sure that there are no errors when booting. As your server refused to boot normally, there are chances that it will give you an error as well if you manually enter the lines from the menu.lst. If it does, make sure to find the error and try booting again, until it works out well.

At the very first stage in the boot procedure, GRUB is loaded. Things can go wrong at that stage, especially if there is an error in the MBR, in the GRUB configuration file itself, or in one of the files that is loaded by GRUB. If that happens, you can enter all the GRUB commands manually to find out what's wrong. If that doesn't work, you can also choose to reinstall GRUB.

ABOUT THE AUTHOR: Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability (HA) clustering and performance optimization, as well as an expert on SLED 10 administration.

Rate this Tip
To rate tips, you must be a member of SearchEnterpriseLinux.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Enterprise Linux Web Server & Application Server
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts