Return to the main UEFI-and-BIOS page


Original attempt

The method described and the 'final product' as a compressed image file worked for me in a Toshiba notebook according to the following specification.

http://www.toshiba.se/laptops/satellite-pro/c850/satellite-pro-c850-19w

It was also tested in a middle-aged HP computer where it worked in BIOS and UEFI when chainloaded. That computer does not boot from grub via USB (which is independent of the BIOS-UEFI issue).

This web page describes how to install a portable Ubuntu system, that boots in UEFI as well as BIOS mode.

Not stable enough to survive certain updates

I expected that it could be installed into a USB pendrive as a good alternative to a persistent live system, possible to update and upgrade without limits. But unfortunately a current update involving a new kernel and updating grub will make it fail to boot. So this system is not stable enough to survive certain updates. It is good only as an illustration of a method to make a bootable drive in UEFI as well as BIOS mode.

It might help to prepare by reading the following link

https://help.ubuntu.com/community/Installation/FromUSBStick

The following link gives more background information about partitioning

https://help.ubuntu.com/community/DiskSpace


Detailed instructions

Make a system bootable in UEFI as well as BIOS

Instructions how to make an installed system (typically in a USB pendrive) that works with UEFI and BIOS, and is small enough to work in an undersized 8 GB pendrive (7.8 GB).

It is easier to find a fast pendrive of 16 GB or larger size. Look for USB 3 pendrives, move the swap and grow the root partition to use the whole drive.

A. Make an install CD/DVD/USB drive from a current Ubuntu 64-bit desktop iso file

Use standard Ubuntu, Kubuntu, Lubuntu, Xubuntu, Ubuntu Gnome, Ubuntu Studio, Edubuntu ...

http://www.ubuntu.com/download

http://www.ubuntu.com/download/alternative-downloads

http://releases.ubuntu.com

and check the md5sum with the listed value at https://help.ubuntu.com/community/UbuntuHashes

B. Boot into UEFI mode from the install drive

C. Connect a target USB pendrive, where the system is to be installed

D. Wipe the target USB pendrive if necessary

E. Start gparted

F. Device -- Create partition table -- Advanced -- gpt

You may need to reboot to inform the kernel of the change.

G. [If complaint about rebooting]

Boot into UEFI mode from the install drive, connect the target USB pendrive, and start gparted again.

H. Create partitions

1a. Make a 1 MiB partition without file system (unformatted)

1b. Add the flag bios_grub.

2a. Make a 250 MiB partition with FAT32 file system and the label EFI

2b. Add the boot flag

3. Make a 6838 MiB partition with ext4 file system and the label pendrive (the size and label can be modified to fit the pendrive).

4. Make a 348 MiB swap partition (linux-swap) (the size can be modified to fit the pendrive).

I. Check partitions

sudo parted -l|grep gpt
[should have the output]
Partition table: gpt

sudo parted -l|tail -n8
[should have the output (unless you modified the sizes)]
Number  Start   End     Size    File system     Name  Flags
 1      1049kB  2097kB  1049kB                        bios_grub
 2      2097kB  264MB   262MB   fat32                 boot
 3      264MB   7434MB  7170MB  ext4
 4      7434MB  7799MB  365MB   linux-swap(v1)

sudo blkid|grep EFI
[should have an output similar to this]
/dev/sdx2; LABEL="EFI" UUID= ....

sudo blkid|grep pendrive
[should have an output similar to this]
/dev/sdx3; LABEL="pendrive" UUID= ....

J. Check that you are still in UEFI mode

Install Ubuntu (or your favourite flavour of Ubuntu) into the partition 'pendrive' (use 'Something else' at the partitioning window).

The following instructions assume that you install Ubuntu 12.04.4 LTS desktop 64-bit, but it should work with other current 64-bit systems with minor modifications.

Partition #3 on the target drive should be used as ext4 and have the mount point / and need not be formatted (it was formatted with gparted).

Check that the device for boot loader installation is the same target drive with the root partition (at the bottom of the partitioning window).

Select time zone, language, user name, computer name, password ... and let the installer finish.

K. Reboot into the installer

Install Boot-Repair and run it to 'repair' the installed system in the target pendrive.

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair

Unmount all partitions of the target pendrive, particularly /dev/sdx3 'pendrive'.

boot-repair

Run 'Recommended repair'

L. Shutdown

Wait for the shutdown process to finish. Remove the install CD/DVD/USB drive.

M. Boot into the target drive. It should boot in UEFI mode

If problems, repeat K, L, M.

Run the command

sudo update-grub

without any other drive connected or edit manually the file /boot/grub/grub.cfg to get a clean grub menu (remove the menuentries for 30_os-prober)

N. Change the computer's setting from UEFI to BIOS (sometimes called CSM)

O. Boot into the installer in BIOS mode. Try Ubuntu without installing

P. Repair grub (in BIOS mode)

sudo mount /dev/sdXY /mnt
# Example: sudo mount /dev/sdb3 /mnt
sudo grub-install --boot-directory=/mnt/boot /dev/sdX
# Example: sudo grub-install --boot-directory=/mnt/boot /dev/sdb

Q. Similar to K. but now in BIOS mode

Install Boot-Repair and run it to 'repair' the installed system in the target pendrive.

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair

Unmount all partitions of the target pendrive, particularly /dev/sdx3 'pendrive'.

boot-repair

Run 'Recommended repair'

R. Repeat P. Repair grub (in BIOS mode)

S. Shutdown

Wait for the shutdown process to finish. Remove the install CD/DVD/USB drive.

T. Boot into the target drive. It should boot in BIOS mode

U. Reboot

Change the computer setting to UEFI and check that it can boot from the target drive.

V. Repeat [only if necessary]

Repeat K. Boot-Repair in UEFI mode and after that repeat P. repair grub in BIOS mode

Final tweaks

../#Final_system_tweaks


Return to the main UEFI-and-BIOS page

Installation/UEFI-and-BIOS/original-attempt (last edited 2016-04-10 18:08:18 by h87n1)