Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 31737  / 1 Year ago, sat, january 28, 2023, 11:54:22

I have a desktop with two SATA hard drives installed. On one I have Windows, on the other I have Ubuntu 12.04. Everything works fine. Now, I want to install one more hard drive. This is an IDE drive. After installing the IDE drive, Grub no longer points to the correct hard drive and doesn't find the boot directory, so I end up in grub rescue. In my grub.cfg the Ubuntu installation is on hd1. It seems that the new IDE drive becomes hd0. Does that mean that my Ubuntu (and the boot directory) now is on hd2 (and Windows on hd1)? If so, how can I change this in Grub so that it points to the correct hard drive? Can it be done from the grub rescue prompt? Can I boot without the IDE drive installed, edit grub.cfg, torn off the computer, connect the IDE drive and boot? If I go wrong here, can I edit grub.cfg from a live CD? Or is there a better way to do this?


More From » boot

 Answers
3

Grub command line have some commands that will help you to debug this issue. Check for the list of them here: http://www.gnu.org/software/grub/manual/html_node/Command_002dline-and-menu-entry-commands.html

In your case you must identify the drive and the partition where your Grub files are located. Try ls command. Bear in mind that partition naming convention is different in Grub. For example, 2nd partition of the 1st drive will be called (hd0,1) (drives and partitions are counted starting from zero). Check "Device syntax" section in the help for ls command using the mentioned link.

As soon as you'll know exactly where /boot/grub folder is located, you can try to boot your system using the next commands (I'm using the previous example with Drive 1, Partition 2 - change them appropriately):



grub> set root=(hd0,1)
grub> set prefix=(hd0,1)/boot/grub
grub> insmod normal
grub> normal


Now your system should boot normally. Log in and restore your boot loader from the terminal:



sudo update-grub
sudo grub-install /dev/sda


(use appropriate /dev/sdX name for the drive, where your GNU/Linux installation is located).


[#30273] Sunday, January 29, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
otatorm

Total Points: 218
Total Questions: 113
Total Answers: 124

Location: British Indian Ocean Territory
Member since Tue, Feb 22, 2022
2 Years ago
otatorm questions
;