Skip to content

Instantly share code, notes, and snippets.

@EsauPR
Created June 21, 2017 23:42
Show Gist options
  • Select an option

  • Save EsauPR/8e7c07f5fa8f0f5dbffd9c5931496ee0 to your computer and use it in GitHub Desktop.

Select an option

Save EsauPR/8e7c07f5fa8f0f5dbffd9c5931496ee0 to your computer and use it in GitHub Desktop.
Ways to restore grub

Grub Recovery

From system [1]

$ mount /dev/sdaX /mnt
$ mount --bind /dev /mnt/dev
$ mount --bind /dev/pts /mnt/dev/pts
$ mount --bind /proc /mnt/proc
$ mount --bind /sys /mnt/sys
$ chroot /mnt
$ grub-install --boot-directory=/boot/ --recheck /dev/sda

From system [2]

$ mount /dev/sdaX
$ grub2-install --boot-directory=/mnt/boot/ --recheck /dev/sda
$ grub2-mkconfig -o /mnt/boot/grub2/grub.cfg

From Grub cli

  1. Inside grub cli

    $ set root=(hdX,XxXxXx)
    $ linux /vmlinux_XXXXX root=/dev/sdaX
    $ initrd /initrd_XXXXXX
    $ boot
  2. On system

    $ grub-install /dev/sdaX
    $ update-grub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment