11

I am trying to install grub2 from a live CD of lubuntu 16.04, I am following this tutorial, after I mounted the /dev/sda1 in the mnt folder using this commands

sudo mount /dev/sda1 /mnt
sudo mount /dev/sda1 /mnt/boot
sudo mount --bind /dev /mnt/dev

Then changing the root directory :

    sudo chroot /mnt

But when try installing grub using sudo grub-install /dev/sda I get this error :

sudo: unable to resolve host ubuntu
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist.   Please specify --target or --directory.

I tried turning off the uefi mode from bios but I think that my bios version doesn't even support it because it is from 2005

4 Answers 4

8

Dont know if you solved your problem, thus this is 1y ago.

I ran into a same situation recently in Ubuntu 18.04, that chroot to another directory and run grub-install:

$ chroot /media/cdrom0 grub-install

Throws error:

grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify --target or --directory.

Finally solved this error by installing grub-pc:

$ sudo apt-get install grub-pc

After this, items under /usr/lib/grub changed from:

grub-mkconfig_lib  x86_64-efi  x86_64-efi_signed

To:

grub-mkconfig_lib  i386-pc  x86_64-efi
2
  • works like a charm !
    – Alex
    Apr 11, 2023 at 19:54
  • Thanks! Installing grub-pc helped me for same kind of problem while using woeusb Apr 30, 2023 at 14:43
5

install grub-pc-bin

grub-pcappears to be a meta package which will remove(!) grub-efi-amd64, which I guess would brick the pc, maybe not right away.

installing apt install grub-pc-bin added the necessary decencies for me to install pc bootloaders from an efi system.

1
  • For those who haphazardly installed grub-pc, like I did, and then saw that apt had removed grub-efi-amd64 you can run two commands which will fix things: 1) apt install grub-efi-amd64 and 2) apt install grub-pc-bin
    – MikeyE
    Oct 15, 2023 at 15:55
2

Just install Grub Customizer and you can do the rest easily by the following command:

sudo apt install grub-customizer
0

Try running the following command first (in the live session):

sudo apt install grub-efi

then run the grub-install command again - this fixed the error for me

Tip from this comment: https://itsfoss.com/fix-minimal-bash-line-editing-supported-grub-error-linux/#comments/350013

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .