How to Reinstall GRUB (Alternate Method)
HTML-код
- Опубликовано: 21 апр 2024
- In this video, I show you another, better way to reinstall the GRUB bootloader on Linux.
Prerequisites:
1. A Linux install media (any GRUB-based distribution with a live ISO should do)
THAT'S IT!
Commands used in this video:
Mount root partition: sudo mount /dev/sdXY /mnt (example: sudo mount /dev/sda3 /mnt)
Mount boot partition (if applicable): sudo mount /dev/sdXY /mnt/boot (example: sudo mount /dev/sda2 /mnt/boot)
Mount EFI System partition (if applicable): sudo mount /dev/sdXY /mnt/boot/efi (example: sudo mount /dev/sda1 /mnt/boot/efi)
Setup "bind" mounts:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
Chroot into your Linux installation: sudo chroot /mnt
Reinstall GRUB (in chroot): grub-install /dev/sdX (example: grub-install /dev/sda)
Regenerate GRUB configuration file (in chroot): update-grub
Alternate "update-grub" command (for Arch Linux only): grub-mkconfig -o /boot/grub/grub.cfg
Exit chroot: exit
Join this channel to get access to perks:
ruclips.net/user/drewhowdentec... - Наука
Simple but effective. Great work!
Great video Drew :)
10/10 keep up the good work.
Just as my caddy broke, thx for the vid
This worked thanks so much
At 4:44, when I run
'grub-install /dev/sda'
I get an error:
Cannot find EFI directory.
I've dual-booted Ubuntu Jammy with Windows 10, both on separate partitions in Legacy. What should I do?
Make sure you’re booting your USB in legacy mode.
@@DrewHowdenTech Thanks.
This looks identical to your first video.
whenever i try to chroot it says failed to run command '/bin.bash' : no such file or directory. im trying to recover a digital ocean droplet after it was destroyed by an angry ex-admin
Check to make sure that you are chrooting your ROOT partition, but that would indicate that there is more missing from your installation than just your bootloader.
At this point, your best bet would be to extract the drive and copy the data off (hope your ex-admin didn’t delete that too).
@@DrewHowdenTech you respond so quick thankyou. from the looks of it, he blocked all ports (cant access anything) and then just deleted any boot files? how would i extract the drive?
Well, if you’re able to boot this system from a flash drive (to try chrooting), that would mean you have physical access to the system, right? If so, open it up, take out the drive, and connect it to a working computer, using a hard drive dock or something like that.
You can also copy any data to an external drive, using the live USB.
NOTE: I am writing the above with the assumption that you own the system in question.
@@DrewHowdenTech bad news, system is hosted on digitalocean, the way im trying to chroot is through the recovery ISO
Ahh, you’re remote hosting.
Are you able to access the contents of the drive from DigitalOcean’s dashboard, or some other way over the internet (without booting it)?
If not, are you able to access the contents of the drive from the recovery ISO?
The problem for me is that with the other video you don't show how to do it if you've got a separate boot partition like you mentioned. So I'm guessing that it only works for ubuntu based systems or certain installation methods.
This method is even easier. It's actually the exact same regardless of whether your /boot is on your root partition, or another partition. Only difference in the latter case is that, in addition to mounting your root and EFI System partitions, you also have to mount your boot partition at /mnt/boot (after mounting your root partition, but before mounting your EFI System Partition).
@@DrewHowdenTech Yeah idk. I'd have to see a video of it.
Check the description for a command for that.
@@DrewHowdenTech I did. Not working for me. Getting an error message.
What error message are you getting?