UEFI-n-BIOS installed system __________________________________________________________________ 1. Current system, seems very stable so far The current system contains a live system and an installed system, and both work in UEFI and BIOS mode. The compressed image files dd_Ubuntu_14.04.2-UEFI-n-BIOS-10GB.img.xz dd_Ubuntu_14.04.2-live-n-15.10-inst-UEFI-n-BIOS-10GB.img.xz at http://phillw.net/isos/linux-tools/uefi-n-bios/ are created like this (only a crude description so far) A. Create an MSDOS partition table Use gparted to get a partition table with the following partitions (or similar if you wish, for example also a casper-rw partition), listed by fdisk -lu Disk /dev/sdd: 15.7 GB, 15693664256 bytes 64 heads, 32 sectors/track, 14966 cylinders, total 30651688 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00063103 Device Boot Start End Blocks Id System /dev/sdd1 * 2048 2623487 1310720 b W95 FAT32 /dev/sdd2 2625534 19400703 8387585 5 Extended /dev/sdd5 2625536 18350145 7862305 83 Linux /dev/sdd6 18352128 19400703 524288 82 Linux swap / Solaris listed by parted -l Model: SanDisk Extreme (scsi) Disk /dev/sdd: 15.7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 1049kB 1343MB 1342MB primary fat32 boot 2 1344MB 9933MB 8589MB extended 5 1344MB 9395MB 8051MB logical ext4 6 9396MB 9933MB 537MB logical linux-swap(v1) listed by lsblk NAME FSTYPE LABEL MOUNTPOINT sdd ├─sdd1 vfat usb-live /media/usb-live ├─sdd2 ├─sdd5 ext4 usb-installed /media/usb-installed └─sdd6 swap B. Use the Startup Disk Creator alias usb-creator-gtk Install Ubuntu from the file ubuntu-14.04.2-desktop-amd64.iso into partition 1 of a pendrive with at least 16 GB. C. Boot from the pendrive in UEFI mode and install Ubuntu Install Ubuntu into partition 5 of the same pendrive. Install the bootloader into partition 5 (not into the head of the drive). Tweak the boot configuration files .../usb-live/syslinux/txt.cfg .../usb-live/boot/grub/grub.cfg .../usb-installed/boot/grub/grub.cfg according to the files that you find after installing with mkusb from dd_Ubuntu_14.04.2-UEFI-n-BIOS-10GB.img.xz to a pendrive. D. The pendrive uses the boot system of the Ubuntu installer Notice that this system is not like an ordinary installed system. It has an MSDOS partition table (not a GPT). It uses the boot system of the Ubuntu installer instead of what is normally created by installing in UEFI mode. This method seems stable when used in a USB pendrive. It is tested in two different laptops, a Toshiba Satellite and an HP Elitebook. The previous installed UEFI and BIOS pendrive system did not survive such adventures. It is also tested in an eSATA SSD drive, where it also works when installed according to the description above. But it might not work to flash the pendrive image directly to the SSD drive. F. Tweak the system See the tips at the end of this document 3.A. Decrease wear for a pendrive 3.B. Move swap and grow root partition 3.C. Login and password for the system to download __________________________________________________________________ 2. Previous system, that is unstable (can be destroyed by updates) Instructions how to make a pendrive that works with UEFI and BIOS, that is small enough to work in an undersized 8 GB pendrive (7.8 GB). It 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. See this link https://help.ubuntu.com/community/Installation/UEFI-and-BIOS A. Make an install CD/DVD/USB drive from a current Ubuntu 64-bit desktop iso file 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) ##### Make a compressed image file of an UEFI only system ##### clean-myself.bash (and truncate-log) zeroise the root partition's unused space mkxzimage-7.8GB: (modify to fit your system) ----------------------------------------------------------------- umount /dev/sdd? echo "making dd-sda-7.8GB.img.xz" dd if=/dev/sdd bs=4096 count=1904128|pv|xz > dd-sda-7.8GB.img.xz ----------------------------------------------------------------- mv dd-sda-7.8GB.img.xz dd_Ubuntu-UEFI-only-7.8GB.img.xz ########################################## 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. Only if necessary repeat K. Boot-Repair in UEFI mode and after that repeat P. repair grub in BIOS mode ##### Make a compressed image file of the final system ##### clean-myself.bash (and truncate-log) zeroise the root partition's unused space mkxzimage-7.8GB: (modify to fit your system) ----------------------------------------------------------------- umount /dev/sdd? echo "making dd-sda-7.8GB.img.xz" dd if=/dev/sdd bs=4096 count=1904128|pv|xz > dd-sda-7.8GB.img.xz ----------------------------------------------------------------- mv dd-sda-7.8GB.img.xz dd_Ubuntu-UEFI-n-BIOS-7.8GB.img.xz __________________________________________________________________ 3. Tweak the system A. Decrease wear for a pendrive Add the mount option noatime in /etc/fstab # / was on /dev/sdb3 during installation UUID=4c518694-d97c-4910-bb7b-eeb6a6b73874 / ext4 noatime,errors=remount-ro 0 1 Do not copy this line. Add 'noatime' to your own line. It is also possible to remove the swap partition and the swap entry in /etc/fstab in order to avoid wear due to swapping. B. Move swap and grow root partition Move the swap partition and grow the root partition to use the whole drive. See this link http://phillw.net/isos/linux-tools/uefi-n-bios/GrowIt.pdf C. Login and password for the system to download The installed systems that come with the compressed image files http://phillw.net/isos/linux-tools/uefi-n-bios/dd_Ubuntu-UEFI-n-BIOS-7.8GB.img.xz http://phillw.net/isos/linux-tools/uefi-n-bios/dd_Ubuntu_14.04.2-UEFI-n-BIOS-10GB.img.xz http://phillw.net/isos/linux-tools/uefi-n-bios/dd_Ubuntu_15.10-UEFI-n-BIOS-11GB.img.xz http://phillw.net/isos/linux-tools/uefi-n-bios/dd_Ubuntu_14.04.2-live-n-15.10-inst-UEFI-n-BIOS-10GB.img.xz have the following user and password user: guru password: changeme