Grub installation failed on a USB stick.

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
rastabaik

Grub installation failed on a USB stick.

Post by rastabaik »

I want to install a non live version of linux mint on a sub stick. So since my laptop has 2 usb ports i used 2 usb sticks, one with a bootable live version and the other on which the system has to be installed.

So let us call /dev/sdd the target USB drive.

In the installer i choose "other, custom" and created 2 partitions (/dev/sdd1,/dev/sdd2) on the usb stick (/home and /), i formated them and asked the installer to put the system here and to install grub on /dev/sdd.

The instalation process went fine till the instalation of grub point at which it failed.

Then i tried to install grub from the live session.

i mounted /dev/sdd1 on mnt and did:
sudo grub-install --root-directory=/mnt/ /dev/sdd
but it failed too.

I m puzzled, i also checked that /dev/sdd1 has the boot flag on.

I don't understand at all, my usb stick should behave exactly like any other storage device (ie like any harddrive).

Last i would also be happy to find a non uefi installer for linux mint, i know how to handly the legacy system and how to boot (repair) as system from Grub -- it is a bit messy but once you found the initram file and the kernel file you are done. The uefi boot mode is just obscure to me and i don' t even know why it was pushed by the hardware designer (may be to prevent us from using open soruce operatng systes
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
kc1di
Level 18
Level 18
Posts: 8175
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Grub installation failed on a USB stick.

Post by kc1di »

I think what you may be running into (not sure from your description) is that it's trying to install grub in UEFI mode. which requires a seperate efi file/partition.
Grub will try to make that file but sometimes it fails. if you can boot the machine in legacy bios mode and do the install that way it should work.
If you need uefi boot. I'm not sure you can place grub on the stick.
good luck.
Easy tips : https://easylinuxtipsproject.blogspot.com/ Pjotr's Great Linux projects page.
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608
rastabaik

Re: Grub installation failed on a USB stick.

Post by rastabaik »

Ok i will check that, i m not too sure how to boot in legacy mode, probably some option in the bios.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Grub installation failed on a USB stick.

Post by pbear »

Caution: Installing to a USB drive in UEFI can be hazardous to your internal hard drive's bootloader. It's a bug. There are a couple of strategies for getting around this, of which I prefer the one described in this thread. Notice the install is done in BIOS mode, then the UEFI bootloader added manually in Terminal.
rastabaik

Re: Grub installation failed on a USB stick.

Post by rastabaik »

So changed in the bios the option to boot in legacy mode, but then the usb stick that i created using dd is not considered as a valid boot device.

When i change back to UEFI the usb stick is found and boot normaly.

The file system on the usb stick does not look like a traditionnal linux root file system, no vmlinux and initram file, instead i have the weird uefi organisation :
/mnt/Linux Mint 18.3 Cinnamon 64-bit/boot/grub $-> ls
efi.img font.pf2 grub.cfg loopback.cfg x86_64-efi

I tried to find a traditional (legacy) iso image for mint but could not fund it.
User avatar
kc1di
Level 18
Level 18
Posts: 8175
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Grub installation failed on a USB stick.

Post by kc1di »

Then mint .iso boot to whatever mode you have the machine set to , there is not seperate .iso for legacy boot.
it your machine is set to boot in bios mode then mint will boot and install in that mode. if it's set to boot uefi it will install in that boot mode.
hope this helps.
Easy tips : https://easylinuxtipsproject.blogspot.com/ Pjotr's Great Linux projects page.
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608
User avatar
kc1di
Level 18
Level 18
Posts: 8175
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Grub installation failed on a USB stick.

Post by kc1di »

perhaps this thread will be helpful too you.
viewtopic.php?f=46&t=186040&p=963551#p963551
Easy tips : https://easylinuxtipsproject.blogspot.com/ Pjotr's Great Linux projects page.
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Grub installation failed on a USB stick.

Post by pbear »

rastabaik wrote: Sat Feb 24, 2018 1:21 pmthe usb stick that i created using dd is not considered as a valid boot device.
The problem isn't the ISO. As kc1di says, that's dual boot. Rather, I don't think dd is generally recommended for this task. If you have access to a Windows machine, Rufus is very reliable. Failing that, Etcher is probably the second best choice.
fabien85
Level 7
Level 7
Posts: 1877
Joined: Tue Mar 11, 2014 4:30 pm

Re: Grub installation failed on a USB stick.

Post by fabien85 »

rastabaik wrote: Sat Feb 24, 2018 7:29 am In the installer i choose "other, custom" and created 2 partitions (/dev/sdd1,/dev/sdd2) on the usb stick (/home and /),
[..]
Then i tried to install grub from the live session.
i mounted /dev/sdd1 on mnt and did:
sudo grub-install --root-directory=/mnt/ /dev/sdd
but it failed too.
Unless there is a typo in your post, you tried to install grub to /home instead of / (the latter containing /boot where grub needs to put its config file)

Also you can force installation in Legacy mode thanks to the --target option.
So I would do :

Code: Select all

sudo mount /dev/sdd2 /mnt
sudo grub-install --target=i386-pc --root-directory=/mnt  /dev/sdd
If that fails, please provide the error message.
User avatar
Sgthawker
Level 4
Level 4
Posts: 226
Joined: Sun Apr 27, 2014 2:23 am

Re: Grub installation failed on a USB stick.

Post by Sgthawker »

I use uefi boot. When doing an install to any drive on a uefi system the boot loader install looks to the drives in a prescribed order. The first drive in that sequence that has an esp is used to install the boot loader. So if the sequence is

sda
sdb
sdc
sdd

and there is an esp on sda it will use that esp even if you tell the installer to use sdd.

A way around that is to disconnect all other internal drives during the live USB to USB drive install so there is no other esp to be selected in lieu of your directive.

Hope this helps.
LM21.1 KDE/LM21.1 Cin/ UEFI Tuf Gaming X570 Plus, Ryzen 7 5800X, GTX 3060, Samsung 980 Pro M.2 NVMe
LM21.1 KDE/LM21.1 Cin/ UEFI on STRIX laptop, i7700 HQ, GTX 1060, Samsung 980 Pro M.2 NVMe
Sir Charles

Re: Grub installation failed on a USB stick.

Post by Sir Charles »

Sgthawker wrote: Sun Feb 25, 2018 11:05 am A way around that is to disconnect all other internal drives during the live USB to USB drive install so there is no other esp to be selected in lieu of your directive.
I just finished an installation of LM 18.3 Xfce onto a USB flashdrive in UEFI-mode. Prior to the installation process, I made three partitions on the target USB. First, one fat32-formatted 512 MiB partition flagged as esp and boot. Then one partition for / and one for swap.
Screenshot_2018-02-25_16-11-32.png
I chose the first partition as the location for the bootloader and the installation completed without any problem. I am actually posting this booted into this newly made installation.

Edit: Just upgraded to the latest kernel, rebooted and everything seems to work fine so far.

Code: Select all

uname -a
Linux minty 4.13.0-36-generic #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Locked

Return to “Installation & Boot”