Grub Error 21 after full install to USB hard drive

Help, I'm getting a GRUB Error 21 after a Ubuntu USB Hard Drive Install. We recently received an inquiry from someone who experienced a GRUB Error 21 after attempting to install Ubuntu on an external USB hard drive.

The user already had Debian Linux installed on their internal hard drive. During the installation process, GRUB was accidentally moved from the internal hard drive to the external USB drive. As a result, the original Debian system became unbootable without the external drive connected. When trying to boot from the internal drive, the system encountered a GRUB Error 21 during the GRUB 1.5 boot process.

grub error

Understanding GRUB Error 21

GRUB Error 21 typically indicates that the selected disk does not exist. This error occurs because GRUB is attempting to access a disk that is either not connected or incorrectly identified. In this case, it was likely trying to boot from the external drive, which was no longer connected.

Fixing GRUB After Error 21

The good news is that this issue can be resolved relatively easily by reinstalling GRUB on the original internal drive. Here's how:

Steps to Reinstall or Fix GRUB:

  1. Boot into the original Linux system (Debian in this case) with the external USB drive still connected. Alternatively, you can boot from a Live Ubuntu CD or USB stick.
  2. Open a terminal and gain superuser privileges by typing:
    sudo su
  3. Identify your Linux boot partition by running the following command:
    fdisk -l

    Look for the partition that is marked as the Linux boot partition, usually something like /dev/sda1 or /dev/hda1.

  4. Reinstall GRUB on the correct drive by typing:
    grub-install /dev/sdx

    Replace sdx with the correct drive identifier, such as sda for your internal drive.

  5. Update GRUB Configuration (optional but recommended):
    update-grub
  6. Reboot your system and test to ensure that it now boots correctly from the internal hard drive.

Important Notes:

  • x in sdx or hdx represents the drive letter (e.g., a, b, c, etc.). Make sure to replace it with the correct letter corresponding to your internal drive.
  • sdx refers to SATA, SCSI, or USB devices, while hdx refers to IDE devices.

Additional Tips:

  • If you are using UEFI instead of BIOS, you might need to use grub-install with additional options, such as --target=x86_64-efi.
  • Ensure that your internal drive is set as the first boot device in the BIOS or UEFI settings if you still encounter boot issues.

By following these steps, you should be able to restore the boot process to your original Debian system, allowing it to boot independently of the external USB drive.