Install Grub2 On Usb

 admin
  1. Install Grub2 Onto Usb
  2. Install Grub2 Efi On Usb
  3. Install Grub2 On Ubuntu 14.04.3
  4. Install Grub2 On Usb From Linux
  5. Install Grub2 On Usb From Windows
Install Grub2 On Usb
  • The grub2 menu system will enumerate the.grub2 files in each of the grub2 folders on the second partition and add the contents of each.grub2 file into it's own internal menu.
  • Tip: See GRUB/Tips and tricks#Alternative installation methods for other ways to install GRUB, such as to a USB stick. See grub-install(8) and GRUB Manual for more details on the grub-install command.
  • Normally, when correctly flashed a bootable Windows USB, the firmware should be able to load you into Windows. However, if it fails to do so, and you have another bootable USB with grub, you may try the following steps to boot Windows manually.

In my case, sdb1 was my active Porteus USB drive (which was already mounted), and sdc1 was the target drive. 4) Create a new directory to hold grub on the target drive: mkdir /mnt/sdc1/boot/grub. 5) Copy all of the files from /usr/lib/grub/i386-pc to /mnt/sdc1/boot/grub. 6) In your terminal, type ‘grub’ and hit enter. This will open a grub shell. Now, if try to go another way and install grub2 on the USB disk itself, I can't understand how to install g2hdr.bin and g2ldr.mbr to USB disk's MBR. As far as I understand grubinst utility which latest version available to me is of January 2008 contains grub(1,2) boot sectors inside it and uses these old ones.

Active1 year, 2 months ago

This question already has an answer here:

  • How do I install Ubuntu to a USB key? (without using Startup Disk Creator) 23 answers
  • How to install grub on usb flash drive? 1 answer

I have a request for Ubuntu: I need the team to update the Ubuntu iso on the download page with an updated installer, so that Ubuntu can successfully be installed on my USB drive.

I don’t like dualboot systems on my PC’s hard drive, so I decided I'd install the system on a flash drive; a safer way to install and use systems.

I did so, but the bootloader (GRUB) is installed on my PC instead of my destined USB drive, with the rest of the Ubuntu system, no matter what, so I can’t use Ubuntu on any other PC, like other systems like Chromium OS systems.

I can bootload Pop! OS an any PC because it does not depend on a bootloader/GRUB to access the system. But I don’t like Pop!_OS like I do Ubuntu.

Ubuntu team, please fix this in your isos so that GRUB won’t be installed on the PC and I can use my USB drive to use Ubuntu on any PC.

Zanna
53.1k14 gold badges149 silver badges250 bronze badges
ScholeggoScholeggo

marked as duplicate by Panther, user535733, sudodus, karel, WinEunuuchs2UnixJul 9 '18 at 1:58

Install Grub2 Onto Usb

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Install

2 Answers

Just install to the USB in legacy mode. Trying a UEFI install to a USB risks leaving your system unbootable (without the USB) -- see bugs 1173457, #1396379, 1229488,.. and add yourself to the 'Does this affect me?' list.

The default install will create two partitions, a root and a swap. If you want something else (FAT for data exchange with Windows, no swap, separate /home, etc. select the 'something else' for the install choice.

Doing a full install without any proprietary drivers should work in a good number of other machines, but will probably not be as portable as the install-media. Maybe an install-media created with mkusb with persistence would be the maximal portability solution, but you will forgo the regular security updates you would get with a full install.

ubfan1ubfan1
10.5k4 gold badges19 silver badges31 bronze badges

Full Install to USB - BIOS/UEFI

If you would like your USB drive to be able to boot from multiple computers, both BIOS and UEFI:

Toshiba 3555c driver. • Extremely compact multifunctional colour system • Reliable productivity of up to 35 pages per minute • Excellent print quality and brilliant images • State-of-the-art document security thanks to Toshiba Secure HDD • Low power consumption and long-lasting toner. Product Description Toshiba e-Studio 3555C Efficiency, sleek styling, striking image quality – the new e-STUDIO 3555C SE series brings it all together. In five up-to-date compact models loaded with high-performance functionality and options, Toshiba delivers the answer to today’s document workflow needs.

Use mkusb to make a Live system on the Installer USB (2GB or larger).

Use mkusb to make a Persistent system on the Target USB, 16GB or larger, using default settings with ~12GB persistence, (remaining NTFS partition is used as Windows accessible data partition).

Open GParted and delete sdx4, the ISO9660 partition and expand sdx5 into the recovered space, sdx being the device name of the Target drive.

Unplug or remove HDD before proceeding further, (optional but recommended, highly recommended in UEFI mode).

Boot Installer drive, select Try.

Insert Target drive

Start Install Ubuntu..

Select Something else.

Select sdx5, (on the target drive), and click Change.

Select Use as: ext4, Format and Mount point: /.

Don't touch any other partitions (unless adding a /home partition).

Select sdx5 as Device for boot loader installation.

Complete installation.

Cut grub.cfg from sdx5/boot/grub and paste to sdx3/boot/grub, overwriting the existing grub.cfg file.

Boot the target drive and run sudo update-grub to add all drives to boot menu.

C.S.CameronC.S.Cameron
5,2971 gold badge13 silver badges34 bronze badges

Not the answer you're looking for? Browse other questions tagged grub2system-installationusb-installation or ask your own question.

A usb drive with only 1 partition to load grub2 on usb-bootable machines with Legacy BIOS, 64bit UEFI or 32bit UEFI.

Partition the drive and install grub2

Warning: the usb drive will be formatted, save your data before proceeding!

First of all, on you current installation, check if the folder /usr/lib/grub/ exists and is not empty.If it is empty or does not exist, make sure the package grub-common (or equivalent for your distribution) version 2 or higher is installed.Depending on the system, /usr/lib/grub/ will contain one or more of the following folders: x86_64-efi, x86_64-efi-signed, i386-pc, i386-efi, ..

The x86_64-efi, i386-pc and i386-efi folders need to be present in order to install the corresponding bootloader on the usb drive.

Install them using the package manager, for instance on Ubuntu :

sudo apt install grub-pc-bin grub-efi-ia32-bin grub-efi-amd64-bin

Now, find the device file for your usb drive. Here, the file is /dev/sdX. Replace X with the appropriate lower case letter(s) in the commands.

Make sure it's the right drive! (check the capacity and the partitions) :

sudo fdisk -l /dev/sdX

Open fdisk :

sudo fdisk /dev/sdX

Press the following keys (THIS WILL ERASE ALL DATA FROM THE SELECTED DRIVE!) :

o<enter> # Create a new empty DOS partition table

n<enter> # Create a new partition

p<enter> # Select primary partition type

1<enter> # Set partition number to 1

<enter> # Start partition at the first possible sector (default)

<enter> # Set partition end to the last possible sector (default)

t<enter> # Change partition type

ef<enter> # Set partition type to EFI (FAT-12/16/32)

a<enter> # Enable the bootable flag on partition 1

w<enter> # Write the partition table

Create a fresh filesystem in the newly created partition :

sudo mkfs.fat -F32 /dev/sdX1

Mount the filesystem :

sudo mount -o umask=000 /dev/sdX1 /mnt

Write the MBR and install the grub files required for legacy BIOS boot on the drive :

sudo grub-install --no-floppy --boot-directory=/mnt/boot --target=i386-pc /dev/sdX

Install Grub2 Efi On Usb

Install /EFI/BOOT/BOOTX64.EFI and other grub files required to load grub from a 64-bit UEFI firmware :

sudo grub-install --removable --boot-directory=/mnt/boot --efi-directory=/mnt --target=x86_64-efi /dev/sdX

Install /EFI/BOOT/BOOTIA32.EFI and other grub files required for 32-bit UEFI :

sudo grub-install --removable --boot-directory=/mnt/boot --efi-directory=/mnt --target=i386-efi /dev/sdX

Create a grub.cfg file :

touch /mnt/boot/grub/grub.cfg

Example grub.cfg with Xubuntu 18.04 Live

(skip this if you already have a working grub.cfg for the usb drive)

Create a folder for cd images :

mkdir /mnt/isos

Create a folder for the OS files :

mkdir /mnt/isos/xubuntu18_04-i386

Download an Ubuntu cd image (for example: Xubuntu 18.04 32-bit) :

Note: make sure there is enough space on the usb drive.

wget --directory-prefix=/mnt/isos/xubuntu18_04-i386 http://cdimages.ubuntu.com/xubuntu/releases/18.04.1/release/xubuntu-18.04-desktop-i386.iso

Extract vmlinuz and initrd from the iso archive :

isoinfo -i /mnt/isos/xubuntu18_04-i386/*.iso -x '/casper/vmlinuz.;1' > /mnt/isos/xubuntu18_04-i386/vmlinuz

isoinfo -i /mnt/isos/xubuntu18_04-i386/*.iso -x '/casper/initrd.lz;1' > /mnt/isos/xubuntu18_04-i386/initrd.lz

Edit grub.cfg :

nano /mnt/boot/grub/grub.cfg

Install Grub2 On Ubuntu 14.04.3

Write or paste something like this :

Notes :

Install Grub2 On Usb From Linux

  • The search command on the second line is only useful if you install the bootloader and the OS files on different partitions.
  • Remove or change the value of the locale parameter to set the language of the live system.
  • Remove or change the value of the console-setup/layoutcode parameter to change the keyboard layout.
Save grub.cfg (in nano) :

CTRL+O

Install Grub2 On Usb From Windows

<enter>

CTRL+X

Finish

Unmount the filesystem :

sudo umount /mnt