0

I'm a Windows user but use Live Ubuntu occasionally to do some troubleshooting. I'm trying to learn a bit more about Linux, and I'm trying to just install GRUB on a USB drive (ultimately I would also install Tiny Core on that same drive but for now I just want to get GRUB working, for educational purposes).

I read the GRUB manual up to the "Installing GRUB using grub-install" section, but I'm getting all kinds of errors which I lack basic knowledge to understand (and couldn't find answers on Google).

Here's what I've done so far:

  1. Boot from a Live USB of Ubuntu 18.04 (created from Windows using Rufus with MBR parition scheme)
  2. Use GParted to create an (empty) msdos partition table on my (2nd) USB drive (/dev/sdb)
  3. Download grub-2.06.tar.gz source code from https://ftp.gnu.org/gnu/grub/
  4. Install all the dependencies required to run ./configure with apt
  5. Execute ./configure --host=x86_64 --with-platform=efi to generate the Makefile (i think my computer is UEFI since the folder /sys/firmware/efi exists)
  6. Execute sudo make install

From this point, if I do:

  • sudo grub-install /dev/sdb i get grub-install: error: cannot find EFI directory.
  • sudo grub-install /dev/sdb --efi-directory=/cdrom/EFI i get grub-install: error: unknown filesystem.

Could anyone please point me in the right direction to get me unstuck? All the guides I found online were about "repairing" GRUB when having an already installed Linux OS. Thanks a lot.

1
  • How you boot UEFI or BIOS is then how it installs. So if looking for an ESP - efi system partition you are installing the UEFI version. And with UEFI better to use gpt not MBR. If an external drive you also want to include the removable parameter. And then you have to manually create your own grub.cfg as you have not tools as in a full install have. mounted the USB EFI partition at /media/test and I installed grub with sudo grub-install --target=x86_64-efi --efi-directory=/media/test --bootloader-id=grub --removable --recheck --debug You just need the ESP FAT32 boot & esp flags.
    – oldfred
    Jan 30, 2022 at 3:45

1 Answer 1

0

I think you are mixing legacy and uefi options and not setting up uefi correctly.

If you already have windows, you don't need another msdos partition. (This is assuming you want it on the hard drive and not removable media.)

  • Create empty directory /boot/efi
  • Look through your partition table for an EFI partition. Mount it on /boot/efi; there should be windows boot pieces in it already. If you have an installed linux already, you should add it (using its uuid preferably) to /etc/fstab
  • Then run grub-install but without any options. It should find your mounted efi partition. The disk options you tried to use are for legacy.
  • grub-install should create a linux directory and the windows directory should also be there; both operating systems should be in the same EFI partition.
  • Grub may also want a populated /boot partition that is in a linux format to store some of its pieces.

Installing on removable media is slightly different.

3
  • Hey thanks for your answer! I did more research following your suggestions and indeed I wasn't understanding what those options meant and also mixing legacy and uefi options. I finally got it to work :) Jan 30, 2022 at 20:25
  • I get grub-install: error: failed to get canonical path of `/cow'. when trying this. I don't have Linux installed. I just have a problem with the Windows bootloader, and I can't recover that. Was trying to install Grub to take it over
    – antivirtel
    May 29 at 19:25
  • Grub expext to boot linux and stores some of its pieces in the linux partition. If you don't have linux, grub isn't going to work. Worse, grub boots windows with the windows boot loader, so if its broken, grub isn't going to help. Go ask on a windows forum how to repair its boot loader. The procedure is similar but the pieces are totally different.
    – user10489
    May 30 at 11:26

You must log in to answer this question.

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