Get a botched grub2.04 install back with chroot

To avoid wasting 5 hours of my life again...

Boot from a live USB...

then in a terminal :

# use su
sudo su

# mount the drive's partition on your live system
mount /dev/yourdeviceRootpartition /mnt
mount /dev/yourdeviceBootpartition /mnt/boot
mount /dev/yourdeviceEFIpartition  /mnt/boot/efi

# mount the needed stuff
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /dev /mnt/dev

# change root
chroot /mnt

# If not network access, check /etc/resolv.conf is populated
# Reinstall grub - E.g on arch/manjaro :

pacman -Syu grub

# generate the initrd images
mkinitpcio -P linux

# update grub config file


# leave chroot env


# dont forget to umount those to avoid data corruption

umount /mnt/sys
umount /mnt/proc
umount /mnt/dev

umount /mnt/boot/efi
umount /mnt/boot
umount /mnt

# reboot

Thanks for nothing, broken manjaro update script !