Reinstalling GRUB from a Netboot

From EN Ikoula wiki
Revision as of 10:11, 25 November 2022 by Acordemy6bd86 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

fr:Reinstallation de GRUB depuis un Netboot


This documentation explains the procedure for reinstalling GRUB from a Netboot

/!\ Mounting partitions may result in data loss. Be aware of the danger of your manipulations. /!\

Launching the netboot

The netboot is a network boot mode on a Linux light image that allows, among other things, to perform operations on a system that no longer boots in normal mode.

From your extranet interface, you have the possibility to launch it on your machine.

You can also use this documentation: What is that the netboot and how to launch?

Orders to be carried out

Once your netboot is effective on your server, you will have to follow the following commands:

   fdisk -l                                # to help you find the partition where your ubuntu is
   mount /dev/sdaX /mnt                    # mount it by replacing the X with the correct partition number
   mount --bind /dev /mnt/dev              # symbolic link from the current /dev folder to the mounted disk
   mount --bind /dev/pts /mnt/dev /pts     # symbolic link from the current /dev/pts folder to the mounted disk
   mount --bind /sys /mnt/sys              # symbolic link from the current /sys folder to the mounted disk
   mount -t proc /proc /mnt/proc           # For Grub2 to find /proc/mounts
   chroot /mnt /bin/bash                   # root the mounted disk
   mount -a                                # mount partitions in chroot
   apt-get install grub-pc                 # install Grub2 software (on the now-rooted disk)
   update-grub                             # create a new configuration file: grub.cfg
   grub-install --force /dev/sda           # install grub on MBR

Now you just have to unmount the partitions mounted in the chroot:

   umount -a

From here, you can exit the mounted disk by pressing ctrl+D. Then, unmount this disk:

   sudo umount /mnt/{dev/pts,dev,sys,proc}
   sudo umount /mnt

All you have to do is reboot your machine.

Source : How do I reinstall GRUB?