The simple way to install grub/ grub2 from any linux live-CD or any other bootable medium.
Step 1: boot from linux live CD/DVD or even USB
Step 2: mount your hdd
Step 3: chroot in the mounted filesystem
Step 3: install grub
Step 4: reboot
1 2 3 4 5 6 7 8 9 | fdisk -l mount /dev/sda1 /mnt/ mount -t proc none /mnt/proc mount -o bind /dev /mnt/dev mount -t sysfs sys /mnt/sys chroot /mnt/ /bin/bash update-grub /usr/sbin/grub-install --recheck --no-floppy /dev/sda sync & reboot |
SUSE Syntax:
update-grub is debian and ubuntu little helper this execute the same as:
1 2 3 | grub2-install --recheck --no-floppy /dev/sda grub2-mkconfig -o /boot/grub2/grub.cfg mkinitrd |
Akos says
Can I chroot and execute grub update when I only want to add another linux deployment to grub menu?
I don’t want to make the working linux distro on another SSD go faulty because of this.
Thanks.
Igor Drobot says
Hi, I believe, in your case, is a linux live CD the best way to:
1. verify the hdd for issue
2. change the password over the chroot
As a linux live CD, personally I prefer to use GRML
Bob says
Thank`s but you don`t understand i can not get into a terminal, i can`t logon as it won`t take my password for either account-both sudo-admins. When i start up i have 2 options ** E ** or **Advanced Options ** but neither does any good. I changed the ro quiet to re quiet init=/bin/bash booted then nothing.
Let me ask a more specific question, if i use a live debian 10.6 how do i get into the fixed hdd – sd1 on my desktop as root ? I just was able to change the password by using a different version in advanced options it was the second one down the list but with the first one i could not do anything. I just tried to login with the new password but i could not do it still. I`m thinking how do i remove any passwords so i can login w/o one to see how that works.
Sorry for the choppy format but i`m trying to do two things at the same time w/o knowing the outcome.
Igor Drobot says
Hi, have you already checked, if your boot device has any issues?
Example:
fsck -fyCV /dev/sda1
Bill W. says
I have a problem after shutting my system down for several hours when i booted up i could not login like i normally do, debian 10.6 would not take my password. I created two accounts with the same privileges but the same thing with account 2. Recovery mode does not work and neither does e. Live OS does not work either if trying to chroot. I can sudo su and change the password but it will not take it on installed OS boot.
Any suggestions so i don’t have to reinstall and loose everything ?
Igor Drobot says
This already the correct syntax:
sudo -t proc /mnt/proc
In your commands is mount missing!
Wayne says
mint 19.3 Mate installed SDA(1) – xfce4 desktop installed after Mate installed. Booted live mint 19.3 Mate. Machine has several OS’s installed. While using Grub-Customizer, grub-menu failed to show. Attempted your solution, but no success. Below is the first difficulty:
mint@mint:~$ sudo mount /dev/sda1 /mnt/
mint@mint:~$ sudo -t proc none /mnt/proc
sudo: none: command not found
mint@mint:~$ sudo -t proc /mnt/proc
sudo: /mnt/proc: command not found
mint@mint:~$ sudo -t /mnt/proc
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] []
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-T timeout] [-u user] file …
mint@mint:~$
Gnoki says
Thank you man !!
Pavel says
Also for LVM to work in chroot
mount -o bind /run /mnt/run
KS says
I have broken grub2 countless times and this is the only distro agnostic guide that has enabled me to reach a solution. Thank you very much for this. I’d get this tattooed on my face if it were acceptable.
Michael says
Thank you very very much
DolfyCzech says
Hi. Very usefull, works for me. But with one notice: Can’t be uses ANY Live CD/DVD/USB. In my case, I have AMD64 (x86_64) OS on PC and i386 (x86) Live USB (Ubuntu 14.04). When I try to chroot, it said, that I can’t chroot to different architecture. Solved by create AMD64 Live USB flash.
SoseR says
–force is required if have any error message
( grub-install –force /dev/sda )
Grateful Reader says
Thank you. Very helpful.
zeldor says
Problem: Cannot find list of partitions! (Try mounting /sys.)
Solved: mount sysfs /sys -t sysfs