Grub Issues with USB Install

SnowMan151

New Member
Joined
Aug 23, 2023
Messages
4
Reaction score
3
Credits
49
Hello,

I am new here but figured this would be the best place to post.

I have been trying to install linux to a USB drive so that I can carry my favorite distro around on my keychain as a complete PC and not just a live boot with a persistent folder. I have used Ubuntu since forever and typically you would just install to the USB like it was a HDD. For some reason now I noticed that when I install to a USB my PC BIOS does not recognize the USB drive, I have tried this on several PCs with several distros and they all behave the same. The live ISO works fine or if I install to a HDD or an M.2 SSD it boots fine but the USB never works.

I noticed that I can set my BIOS to boot the live USB and then access grub at boot and change root to the USB that has the linux install I want and it boots fine so I believe it's not an issue with grub. Also I'm confident that it isn't a BIOS setting like secure boot or UFEI issue. I'm pulling my hair out at this point and all I get from Google is Bios settings or Live boot not recognized answers.

Typically I would post PC specs and distro info here but I have tried this with several so lets just say Ryzen 9, 128GB DDR4, RTX 2060 Super, 1TB WD Blue SSD, Ubuntu 22.04.2, 128GB SanDisk MicroUSB.
 


G'day @SnowMan151 and welcome to linux.org :)

Ryzen 9, 128GB DDR4, RTX 2060 Super, 1TB WD Blue SSD, Ubuntu 22.04.2, 128GB SanDisk MicroUSB

Can you adopt me and leave me your rig in your will?

On topic, it's been a while (some years) since I had occasion to do what you are seeking to do, but it used to be the case as follows:
  1. Burn Ubuntu iso to a USB stick (as low as 4GB would do)
  2. Have another USB stick ready to insert - the 128 GB Sandisk might be what you want, depending on your needs, and format to EXT4 (might need to do that from the 1st stick if you have no other Linux on your HDD)
  3. Insert that 2nd stick
  4. Boot from the first stick via BIOS boot order
  5. Run Ubiquity (installer), choose Other/Something else and direct it to the target, which is your 2nd USB stick
  6. Complete the installation process, power down, remove unnecessary drives and reboot
See if you follow that and you should get a favourable result.

Cheers

Chris Turner
wizardfromoz
 
my PC BIOS does not recognize the USB drive
where are you expecting that recognition to take place? are you trying to use the one-time boot menu or something else?
if I install to a HDD or an M.2 SSD it boots fine but the USB never works.
are those also external or removable drives?
so I believe it's not an issue with grub.
yet your title says it's a grub issue. do you expect it could be something else?

for ubuntu or ubuntu-based distros that could use a ppa, you could try boot-info to see if it might help steer you in the right direction: https://help.ubuntu.com/community/Boot-Info

or there is boot-repair: https://help.ubuntu.com/community/Boot-Repair

editing to add: forgot this: https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html

For removable installs you have to use --removable and specify both --boot-directory and --efi-directory:


# grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable
 
G'day @SnowMan151 and welcome to linux.org :)



Can you adopt me and leave me your rig in your will?

On topic, it's been a while (some years) since I had occasion to do what you are seeking to do, but it used to be the case as follows:
  1. Burn Ubuntu iso to a USB stick (as low as 4GB would do)
  2. Have another USB stick ready to insert - the 128 GB Sandisk might be what you want, depending on your needs, and format to EXT4 (might need to do that from the 1st stick if you have no other Linux on your HDD)
  3. Insert that 2nd stick
  4. Boot from the first stick via BIOS boot order
  5. Run Ubiquity (installer), choose Other/Something else and direct it to the target, which is your 2nd USB stick
  6. Complete the installation process, power down, remove unnecessary drives and reboot
See if you follow that and you should get a favourable result.

Cheers

Chris Turner
wizardfromoz
lol thanks, I just updated the bios to accept the Ryzen 9 and upgraded the RAM from 32GB to 128GB :) Who ever said boats are a waste of money never owned a custom rig haha.

Thanks for the tips on Ubiquity, I'll take a look and see if that solves my issue.
 
where are you expecting that recognition to take place? are you trying to use the one-time boot menu or something else?
I expect to see the boot option in my BIOS when I load it via the F2 key.

are those also external or removable drives?
I have used them both internally and externally.

yet your title says it's a grub issue. do you expect it could be something else?
Yeah, thats probably stupidity on my part. I expect it's an issue with my BIOS not seeing GRUB and not an issue directly with GRUB. It's almost like the partition is not flaged as bootable but this is not the case.


Hopefully that helps a little.
 
in the case of trying to install ubuntu or ubuntu-based distros to a usb, this might be of note: https://forums.linuxmint.com/viewtopic.php?p=1590470#p1590470

This is crucial because there’s a bug in the Ubuntu installer, also used by Mint, which in UEFI will bollix the internal hard drive’s boot loader even if one specifies the new boot loader should be installed only to the USB drive.
 
in the case of trying to install ubuntu or ubuntu-based distros to a usb, this might be of note: https://forums.linuxmint.com/viewtopic.php?p=1590470#p1590470
Thanks for the info. I suspect the issue I'm experiencing will be fixed in later releases but it's odd that in my case it only applies to removable media. I like what you said earlier about;

"For removable installs you have to use --removable and specify both --boot-directory and --efi-directory:
# grub-install --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable"

I'm planning to use a live boot to enter GRUB and load the 128GB MicroUSB. Then I should be able to reinstall GRUB and specify the directories and removable flag. I'll report back with the results.

Obvioustly I can still force the PC to boot into the prefered OS by piggybacking off the GRUB of a live USB so it seems to be just the way the computers are seeing the USB bootable partition. This makes me think its an issue with /dev/sdx1 not being setup correctly. Seems to point back to the removable flag for grub-install although what does the flag even do? I suspect the PC nor the OS should care if it's removable rather just if it has a bootable partition.
 
I expect to see the boot option in my BIOS when I load it via the F2 key.
F2 is probably your main BIOS, whilst there check that USB is enabled
the one time or short boot menu will probably be one of the following F8 F10 or F12 [but there are other keys/combinations],
when making a full installation to a pen-drive [to avoid any chance of baulking my main drive, I used to use my tower, and pull the HDD data cables so only the USB was connected,
If you want an exact clone of your current main drive, this should be possible using the DD command
 
Seems to point back to the removable flag for grub-install although what does the flag even do?
some info on that here: https://superuser.com/questions/175...alls-removable-flag-do#comment2729280_1756758

more here: https://www.rodsbooks.com/efi-bootloaders/principles.html
The fallback boot loader mentioned earlier (EFI/BOOT/bootx64.efi, or variants of that, depending on the architecture) is something of a special case. This filename was originally intended for use only on removable media, so that they could be booted to install an OS.
 
If you don't mind opening your computer case, you can try temporarily disconnecting all the internal drives from the system and then performing the installation onto USB. I have had to use that method in the past.
 
@SnowMan151 -

I'm planning to use a live boot to enter GRUB and load the 128GB MicroUSB. Then I should be able to reinstall GRUB and specify the directories and removable flag. I'll report back with the results.

Subject to what you report back, can you let us know what is on your computer (and whether laptop or desktop) in terms of OSes currently, eg Windows and Linux (name of distro)?

Thanks.

Wizard
Also I'm confident that it isn't a BIOS setting like secure boot or UFEI issue.

UEFI - so if there is one or more ESP's (EFI System Partitions) eg /dev/sda1, /dev/sdb2 - could you let us know those as well?
 

Members online


Latest posts

Top