LOGO

Reinstall Grub Bootloader Ubuntu - Fix After Windows

March 22, 2007
Reinstall Grub Bootloader Ubuntu - Fix After Windows

Recovering the Grub Bootloader After a Windows Reinstallation

For users operating a dual-boot system featuring both Linux and Windows, encountering bootloader issues after a Windows reinstallation is a common experience. Following a fresh Windows install, the Linux bootloader, such as Grub, may disappear, preventing access to your preferred Linux distribution like Ubuntu.

Here's a streamlined method to restore Grub functionality. The process involves booting from a LiveCD and executing a series of commands within the Grub prompt.

Steps to Re-enable Grub

1) Boot from the LiveCD.

2) Launch a Terminal and input the following commands sequentially. The initial command will access the Grub prompt, and the subsequent three will be executed within that environment.

sudo grub

Once in the Grub prompt, execute these commands:

root (hd0,0)

setup (hd0)

exit

It's important to understand that 'hd0,0' typically designates the first hard drive and its first partition, which is the usual location for Grub installation. Adjust these values if your Grub installation resides on a different partition.

Reboot your system, ensuring the LiveCD is removed. Your boot menu should now be restored.

Addressing Missing Windows Entries in the Boot Menu

This section applies if Windows is no longer listed in the boot menu after restoring Grub. If Ubuntu was installed prior to Windows, the Grub configuration may not automatically recognize the Windows installation.

Manual editing of the Grub boot menu file is required in this scenario. Open the file located at /boot/grub/menu.lst using the following command:

sudo gedit /boot/grub/menu.lst

Within this file, you'll find a commented-out section dedicated to Windows. Uncomment this section by removing the '#' characters at the beginning of each line, and position it within the boot menu list as desired.

# title   Windows 95/98/NT/2000

# root   (hd0,0)

# makeactive

# chainloader   +1

Verify that 'hd0,0' accurately reflects the partition where Windows is installed. If Windows was installed on the fourth partition of the drive, modify the value to (hd0,3) accordingly.

#ubuntu#grub#bootloader#reinstall#windows#dual boot