1. Boot the live disk
It doesn't matter which one, and it does not need some fancy UI or whatever. An initrd shell is enough, you only need two commands: chroot and mount. If you have a graphical user interface, open up a shell and become root; many live disks use something like "root" for the root password, and many others don't ask you for a password when using sudo, so you can try either "su" or "sudo bash" to get a root shell.2. Change the root directory
Now you need to switch over to your installed linux system (the one you can't boot because your grub is broken, remember?). To do that, you first need to find and mount that system's root partition. For me, this went something likemkdir newroot mount /dev/hda1 newrootIf you don't know which number your root partition has, you can try something like "fdisk -l" to list all partitions, then guess; or you can just trial-and-error mount every partiton and look at its contents.
Once you got this, change the file system root:
chroot newrootchroot should then start a new shell in your new file system, so you should see your familiar shell prompt, and the "pwd" command should tell you something like "/".
3. Re-install grub2
Now just go ahead and rungrub2-install /dev/hda(without a number after /dev/hda to install it into the master boot record of that disk). Depending on your hard drive setup and the live disk used, this could also be something like /dev/sda, /dev/sdb or similar.
4. Reboot
Now just reboot your system, you're done! Make sure your bios boots from the hard drive you just installed grub2 to, in case you have more than one (like me). Once back in your old system, you can change the default entry usinggrub2-set-default 2(this would automatically boot the 3rd entry in the list).
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.