1

I want to copy the latest Ubuntu release installer ISO to a usb key. I may be wrong but from my knowledge, on an uefi machine it is not necessary to have boot in MBR, the EFI folder suffices to boot the installer. So why not simply copy the .iso content as files on a GPT fat32 usb stick ? This solution works for Windows and MacOS (I tried both) and avoids to "burn" to the usb stick, as it is prone to damage the usb stick, and also erases its content.

I can without issue extract and copy the files from the .iso to a folder but it fails for some symbolic or hard link files when copying to the usb stick.

So I wonder if there is still a simple solution for uefi machines to get a bootable Ubuntu installer on a key without writing image using unetbootin, dd,.. and without erasing what may already be on the stick ?

hello world
  • 133
  • 9
  • 1
    To make a bootable media, you replace what's on the media with the ISO. This is done by your ISO image tool. When you create the ISO, the media (DVD or iso stick) will then have the content of the ISO. To use it for a different purpose later, you would have to either image a different ISO to the stick, or format it as storage and use it that way. – L. D. James May 02 '18 at 05:05
  • @dsstorefile1 depending on how the image writer is implemented it may write several times the same bits at the same places on the stick when creating the image. As the number of writes is limited for usb stick memory this will drastically shorten device life time if the algorithm is "badly" implemented, far more than for SSD devices which have internal mechanism to spread writes. My personal usage seems to confirm this. Recently a new stick died after one image writing. – hello world May 02 '18 at 15:41
  • @L.D.James for macOS and Windows I don't need to use an ISO image tool to make bootable usb stick installer, simply copying ISO's content as files suffices (for uefi machine). Why do you want me to use an ISO image tool to get a bootable stick for Ubuntu installer ? Is that because there is no other solution to copy Ubuntu's link files ? Is that what you mean ? – hello world May 02 '18 at 15:57
  • 1
    No. The reason is that copying files and creating a bootable disk is quite different. There is partition info, boot loaders and many other components to the disk that are not actual files. Some of these components include disk type, parition type, partition tables and more. It would take an awful lot of work to be able to copy files and create a bootable disk that would function as a Ubuntu installer. It's not impossible but would require a lot of time and testing (possibly years) to get it right. Creating bootable media from the image only takes minutes. – L. D. James May 02 '18 at 16:03
  • 1
    If you have something on the usb stick that you don't want to loose, you might consider copying those files to your computer's hard drive, then use your favorite tool to create a bootable media of your usb stick. – L. D. James May 02 '18 at 16:20
  • 2
    UEFI only USB key, just extract ISO ( 7 zip or similar) to FAT32 formated flash & set boot flag. http://askubuntu.com/questions/395879/how-to-create-uefi-only-bootable-usb-live-media Many standard installers use dd which is a hybrid. And then flash is not partitioned and many partition tools fail. You then have to use dd to erase beginning of flash drive to make it usable as a flash drive. – oldfred May 02 '18 at 16:26

4 Answers4

2

Simply copying and pasting the files (remember to also copy hidden files on the iso) works also on ubuntu. I recently created a bootable USB for my ubuntu 18.04 LTS by simply copying the files from the ISO to a clean fat32 pendrive (MBR partition table). When i booted the pen on UEFI machine it just worked. I was scared using dd was going to damage the drive

However when I tried that same bootable pendrive to boot in Legacy (BIOS) mode on a different machine it didn't work. In that case i came back to using dd which worked

ptetteh227
  • 1,904
  • This is the method that I used and works for Windows and MacOs but fails for Ubuntu 18.04 LTS, the live/installer boots but cannot finish loading and I get ramdisk prompt. 3 files of the ISO are missing, as symlinks are not supported by fat32 paritition: stable , unstable and especially ubuntu --> . Obviously this is the reason of failure. Using dd or disk imaging solve the issue as the file format is no more real fat32 and therefore the 3 symlinks are present. I don't grasp how you manage to get a working live/installer simply by copying files ? – hello world May 07 '18 at 01:32
  • UEFI boots from a file in a FAT32 formatted partition with boot flag. If installer not created with dd or similarly, then you have a FAT32 flash drive. Other installers will erase flash drive, format it to FAT32, add boot flag, extract ISO and install syslinux for BIOS boot. If you only want UEFI boot the extracted folder /EFI/Boot/bootx64.efi is the UEFI boot file needed. But that configuration has no BIOS boot loader. – oldfred May 07 '18 at 03:39
2

Backup

You should backup all data that you don't want to lose to separate media. Do this at regular intervals or when there is something important to backup.

This advice is relevant to data on all drives, particularly USB pendrives and memory cards, because they are mass produced, and the lifetime is hard to predict. They may fail suddenly.

Make a clean installation

It is a bad idea to create a USB boot drive of a drive, where you keep data unless you have a special reason for it, for example because you want to upgrade a persistent live drive. There is always a risk that the data will be damaged, by a human mistake or power failure or because the internal system in the pendrive is 'overloaded'.

Cloning is a robust method

I have used USB pendrives a lot for years (because I develop tools for creating USB boot drives and I test Ubuntu community flavours before they are released). I use the cloning method, and the pendrives survive.

The cloning method writes only once (yes, from the beginning of the drive all the time), but on the other hand a cloned Ubuntu iso file makes a read-only iso9660 file system, so there will be no writing onto it while you are using it to run a live system or install Ubuntu from it.

When the data transfer speed is reduced to about half of the original speed, I wipe the whole drive, which restores (almost) the original speed and also reduces the risk of a corrupted internal management of data inside the USB pendrive.

Extraction methods

If you want a persistent live drive, you should normally use an extraction method, that tampers with the partition structure, boot structure and copies files. It is more sensitive (compared to cloning) but works too, and you can install programs and store data on the pendrive.

Maybe the 'Do it yourself' method described in one of the links is what you want. It works in its simplest form in UEFI mode.


Edit because the 'Do it yourself' method failed for you

My experience was from earlier versions, so I tested now with Ubuntu 18.04 LTS.

The first attempt was a little tricky and flaky. I had to remove 'quiet splash' from the grub menuentry in order to make it boot all the way in my Toshiba laptop (which is my test computer). I tried again and found that the electrical connnection was flaky with the pendrive I used. The connection went on and off, when I wiggled a little on the pendrive.

So I tested with another [less worn] combination of pendrive and USB hub, and now it works flawlessly. The following screenshot shows that it works even when those links are broken (red in the list by ls). Please notice the boot flag. I think it is important.

enter image description here


Links

Pendrive lifetime

mkusb - tool to create boot drives

Cloning and extraction - you may like the 'Do it yourself method'

Installation/FromUSBStick

sudodus
  • 46,324
  • 5
  • 88
  • 152
2

While it is straightforward for Windows and MacOS (simply copying content of .iso installer(s) to usb partition(s)), it seems there is no simple solution to get an UEFI-only live for Ubuntu 18.04 LTS, as the ISO contains 3 symlinks and these files cannot be copied to a fat32 partition. Doing so will result to a usb key that will boot but fail to completely load the system and lead to initram shell because of the missing links.

To allow to get an uefi-only working usb live for Ubuntu 18.04 LTS by simply copying files from the ISO, we would need a different ISO distribution designed to work without symlinks.

EDIT : It appears that the missing symlinks are not necessary for the live/installer to work. So simply copying files to a fat32 partition is sufficient to have an UEFI-only bootable and working Ubuntu 18.04 live installer. MBR or GPT partitioning has no importance (for UEFI machine), but the latter allows to add many more (primary) partitions so I would recommend it. If it however does not work on a UEFI machine, this should be for other reasons specific to hardware/software setup, like old worn hardware, corruption or whatever.

hello world
  • 133
  • 9
  • The method described in a comment by @oldfred, and in my answer, 'Do it yourself' works. Copying to a FAT32 partition will create a USB drive, that works in UEFI mode. I have done it with Ubuntu iso files, so I know that it works. – sudodus May 12 '18 at 01:56
  • My experience was from earlier versions, so I tested now with Ubuntu 18.04 LTS. It works too, but is a little tricky. I had to remove 'quiet splash' from the grub menuentry in order to make it work all the way in my Toshiba laptop (which is my test computer). I will edit my answer. (But you can still use the cloning method and make persistent live drives with mkusb without any manual tweaks and have it work both in UEFI mode and BIOS mode.) – sudodus May 12 '18 at 02:38
  • @sudodus "Copying to a FAT32 partition" the files of the ISO ? What about the missing symlinks ? Or copying the ISO itself as one file and boot through iso loopback method ? The first doesn't work on my machine (initram shell, because of the missing symlinks I suppose ?), the second should work however. Else writing ISO as image works for me, but it erases everything and it's no more a fat32... Should I retry with a MBR instead of GUID, maybe the (empty) ESP is the origin of incomplete loading and not the missing symlincs ? Though for other multiboot GUID usb I use empty ESP successfully... – hello world May 12 '18 at 02:58
  • Sorry I did not see your last response...So it confirms GUID should not be the cause of failure. Thank you. MBR or GUID has no incidence for usb boot on an uefi machine I think. The latter has an useless ESP but allows to make plenty of partitions for multiboot stick... I suppose we can ever remove the ESP partition. – hello world May 12 '18 at 03:25
  • I think my problems were caused by old and worn hardware (poor electric connection). I have a pendrive that works well now made with the 'Do it yourself' method. – sudodus May 12 '18 at 03:47
  • @sudodus I will edit my response, as now copying files works every time with various combinations of archive/isoloop mounter gui/cp/rsync copying gpt/mbr formating, and I cannot reproduce the failure ! Previously I could not get usb working by copying also with various combinations. This is strange. The only difference that comes to my mind is that for previously failures I used xenial xerus xfce for copying bionic beaver 18.04 files to usb, while lastly I used (without any failure) bionic beaver gnome. On same machine. – hello world May 12 '18 at 22:40
  • I'm glad to see that things are working for you now, and in many ways. Congratulations :-) – sudodus May 13 '18 at 06:45
0

1- Download the iso file from the official Ubuntu website

2-
* If you are using a Debian based distro (Ubuntu, Linux mint, ...) you can create a bootable USB using gnome-disk-utilisty (you can find it a good tutorial :here)
* If you are using Windows, you can use universal boot to create a bootable usb ( you can follow this tutorial)

3- Plug your USB drive to your computer then reboot it, and follow the installation steps.

singrium
  • 6,880