Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any way to create a bootable Ubuntu USB flash drive from the terminal without using any third-party applications like YUMI,Unetbootin, etc.

I tried to create a bootable Ubuntu flash drive with dd method,

sudo umount /dev/sdb
sudo dd if=/path/to/ubuntu.iso of=/dev/sdb bs=1M

It create files on the USB disk, but when I try to boot the USB disk it shows a Operating System Not Found error.

share|improve this question
    
You have to make sure that your USB flash drive is NOT mounted. Check with lsblk. If necessary, do sudo umount /dev/sdb (probably sdb1, sdb2). Add ;echo $? after your dd copy command. So: sudo dd if=... of=... bs=4M; echo $? If the commandd ends, the returning value should be 0. –  user85164 Nov 8 '13 at 7:21
    
i follwed your steps,but it also creates the same files as sudo umount /dev/sdb sudo dd if=/path/to/ubuntu.iso of=/dev/sdb bs=1M creates.It doesn't create any ubninit,ldlinux.sys,etc files which are mainly important a linux os to boot. –  Avinash Raj Nov 8 '13 at 9:38
    
I would install grub on the MBR of the USB disk as a final step. –  Elder Geek Jan 2 at 15:45

6 Answers 6

up vote 32 down vote accepted

Creating a bootable Ubuntu USB flash drive from terminal

  • Place the ubuntu.iso file in any hard disk partition.

  • Then mount the ubuntu.iso file with the below commands in terminal:

    sudo mkdir /media/iso/
    sudo mount -o loop /path/to/ubuntu.iso /media/iso
    
  • Insert your USB flash drive. My drive is /dev/sdd. Here's a screenshot:

GParted screenshot

  • Your drive may be automatically mounted inside /media/. Let's assume that it was mounted in /media/xxx/.

  • Copy all files from /media/iso/ to your mounted USB flash drive by running the below command (make sure to include the dot):

    cp -a /media/iso/. /media/xxx/
    
  • Next, you need the ldlinux.sys file in your USB flash drive to make the USB bootable. My USB partition is /dev/sdd1; enter lsblk to see what's yours. Run the below commands:

    sudo apt-get install syslinux mtools
    sudo syslinux -s /dev/sdd1
    
  • Navigate to the /media/xxx mount folder and rename the isolinux directory to syslinux. Then go into the renamed folder and rename the file isolinux.cfg to syslinux.cfg.

  • Reboot your PC and change the boot order in BIOS to allow booting from a USB drive. Now your Ubuntu USB flash drive will boot and you can install it.

This method will work for any Linux distribution, not only Ubuntu. You don't need to install any third party software to make a Linux USB flash drive.

share|improve this answer
    
I am trying it at the moment, could you please specify what/why you use: cp -a rather than cp -r –  moldovean Jul 19 '14 at 15:44
1  
You need sudo for the syslinux command. –  Cammy_the_block Nov 4 '14 at 4:55
    
How can I confirm the the dd command worked correctly? –  Vader Mar 12 at 19:58

Use dd.

 sudo dd if=input.iso of=/dev/sdc

where input.iso is the input file, and /dev/sdc is the USB device you're writing to. This method is fast and has never failed me.

share|improve this answer
1  
it doesn't work for me. –  Avinash Raj Nov 16 '13 at 1:16
1  
Really? Are you sure you have the correct .iso file name including path, and the correct /dev for your USB drive? How does it fail? Is there an error message, or does it just fail to boot? Are you sure the .iso isn't corrupt? –  Marc Nov 16 '13 at 10:25
    
it creates only read only files,this method doesn't copy ldlinux.sys file to the usb drive.See my answer it works,you can try the method i posted. –  Avinash Raj Nov 16 '13 at 12:01
    
I just created a bootable Lubuntu live USB on a 2GB drive last weekend using this command, and used it to install Lubuntu on an old computer. –  Marc Nov 16 '13 at 15:51
1  
You could have a corrupt .iso. Have you checked it? Are you certain the .iso is actually a copy of something that is bootable? –  Marc Nov 16 '13 at 16:00

You have two choices.

If you desire a graphical interface, use usb-creator (it is in the ubuntu repos)

enter image description here

If you want a command line tool, use dd

sudo umount /dev/sdb
sudo dd if=/path/to/ubuntu.iso of=/dev/sdb bs=1M

Just be sure "/dev/sdb" is the flash drive you wish to use (it will destroy the data on the flash drive).

See https://help.ubuntu.com/community/Installation/FromUSBStick for additional information.

share|improve this answer
    
i want only command line tools,not gui tool(like startup disk creator).According to the dd method,only 3 folders and 1 file was created in my usb.While i trying to boot it says operating system not found error.Files like ubninit,menu.c32,ubnpathl.txt,ubnfilel.txt,ldlinux.sys are missing(which are very important to boot live ubuntu usb). –  Avinash Raj Nov 8 '13 at 5:00
    
I tried the dd method with ubuntu.iso and it worked! it too a lot of time however to be written on an USB. I wonder what bs=1M stands for. I found this site manpages.ubuntu.com/manpages/karmic/en/man1/dd.1.html . Now I wonder if changing the value will make to copying to the USB faster? And what are the risks.. maybe someone knows. –  moldovean Aug 17 '14 at 7:42
    
The bs is the block size. dd will read 1MB of data into the memory and then proceed to write it at the disk as a whole. Using a very small block size you will get a lot of CPU overhead. Using a very big block size may result in unexpected side effects, e.g. longer pauses of no disk activity and/or big RAM usage. 1M or 4M usually is a good value when making a disk from an ISO. More info on block sizes: stackoverflow.com/questions/6161823/… –  ApolloLV Nov 11 '14 at 18:28
    
I figure making a bootable usb is something I do infrequently, but when I do it, I want it done right. A smaller block size may take longer, but is that an issue? Nope. –  Marc Feb 18 at 21:44
    
@Marc - The only issue is speed, a smaller block size is no more or less error prone then a larger block size and thus a smaller block size != "done right". Done right means checking the md5sum of the iso and confirming the md5sum of the written image. Once you confirm the m5dsums you know it was done right. –  bodhi.zazen Feb 19 at 13:58
$ dd if=ubuntu-14.04.1-desktop-amd64.iso of=/dev/sdX bs=1MB

Don't use the path to bit.

  1. Use the cd command to get to the folder that contains the .iso file
  2. use the command dd if=FILE NAME HERE.iso of=/dev/sdX bs=1MB
  3. Wait until the console output looks something like this:

    1028+1 records in
    1028+1 records out
    1028653056 bytes (1.0 GB) copied, 55.4844 s, 18.5 MB/s
    
  4. Boot from the usb.

Note: Make sure you write to the correct device a usb will not always be mounted at: dev/sdX where X can be any letter.

share|improve this answer

You're almost there with dd, but you're missing a step.

sudo umount /dev/sdX
sudo dd if=/path/to/ubuntu.iso of=/dev/sdX bs=4M && sync

where sdX is your usb device (this can be verified with lsblk).

The sync bit is important as dd can return before the write operation finishes.

share|improve this answer

Format the card:

$ sudo mkfs.vfat -F32 /dev/sdx

Mount the ISO image:

$ sudo mount ubuntu.iso /mnt

Copy contents to card:

$ sudo cp -rvf /mnt/* /dev/sdx

Then:

  • rename isolinux folder into syslinux
  • rename syslinux/isolinux.cfg to syslinux/syslinux.cfg
  • rename syslinux/isolinux.bin to syslinux/syslinux.bin
  • run syslinux -s /dev/sdx
share|improve this answer
    
-1. Did you even test this? sudo cp -rvf /mnt/* /dev/sdx will not work (or at least not do what you intend). You don't copy files to a raw device (/dev/). Instead, you should mount the card and copy the contents of the ISO file to the card (mount point to mount point). And what's wrong with the current accepted answer which has the same approach. –  gertvdijk Jan 2 at 15:29

protected by Avinash Raj Feb 7 at 15:12

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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