HOWTO: Restore GRUB with Knoppix

Knoppix Logo

Re-installing Windows for the umpteenth time? If you also have Linux installed on your system, you probably just lost GRUB again for the umpteenth time as well. Windows will never be considerate of the other operating systems it shares space with. You’ll have to come up with another plan. The best way is to beat Windows at it own game. Windows installs code to the MBR that simply seeks out the partition marked as active/boot and passes control to the boot loader located there. To cope with Windows, install GRUB to a partition, not the Master Boot Record.

  • Download Knoppix and burn it to a CD
  • Boot Knoppix
  • When you get to the KDE desktop, open a terminal (command line)
  • Type sudo grub to get into the grub terminal
  • Type find /boot/grub/stage1 to get a list of locations where your grub files reside
  • Pick a location and type root (hdx,y), where x and y should match one of the options given to you by the previous command
  • Type setup (hdx,y)
  • Launch the GParted Partition editor with sudo gparted
  • Right-click on the partition where /boot is located and select Manage Flags
  • Click on boot and close all windows to back out (the change is immediate)

When you reboot from the hard drive, your GRUB setup should be back.

Notes:

  • If you’re prepping for a Windows install and are using a live Ubuntu install to do this, you’ll have to issue the command twice — it’s a known bug
  • If you want to re-install Windows’ MBR boot code, use fdisk /mbr in Windows under an Administrative Console (use Shift + Ctrl)
  • In Windows, you can use FDISK under and Administrative Console to change the partition that’s marked as Active.