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 '15 at 15:45
    
The easiest way with the built-in tools using the terminal is to use dd as described here. It works with all hybrid iso files. But dd is a dangerous tool because it does what you tell it to do without questions. So if you tell it to wipe the family pictures ... and it is a small typing error away. Many tools are more secure. They help you to identify and select the target drive, and provide a final checkpoint, where you can double-check, that you will be writing to the correct drive. Most of these are GUI tools, some can work in text mode too, e.g. mkusb-dus. – sudodus Mar 26 at 18:16
    
If using dd it is important to identify the target drive, for example with the following command line: sudo lsblk -f and to unmount all partitions on the target drive. The following command line will unmount all partitions on a USB drive: sudo umount /dev/sdx* where x is the drive letter (identified for example with the previous lsblk command line). – sudodus Mar 27 at 4:42
up vote 165 down vote accepted

You can use dd.

 sudo umount /dev/sdc<?>  

where <?> is a number, look it up. Then, next:

 sudo dd bs=4M 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.

EDIT: It is best to run

sync

afterwards, see How to create a bootable Ubuntu USB flash drive from terminal?.


EDIT: for those on a Mac ending up here, use lowercase for bs=4m:

sudo dd if=inputfile.img of=/dev/disk bs=4m && sync

EDIT: If USB drive does not boot (this happened to me), it is because the target is a particular partition on the drive instead of the drive. So the target needs to be /dev/sdc and not dev/sdc <?> For me it was /dev/sdb .

Reference: https://superuser.com/a/407327 and https://askubuntu.com/a/579615/669976 My edit should actually be a comment, but I do not have sufficient privileges to post one.

share|improve this answer
6  
it doesn't work for me. – Avinash Raj Nov 16 '13 at 1:16
5  
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
2  
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
7  
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
3  
Original question and most upvoted answer is the same person that said this method is not working for him. ;-) For me approved answer is not working and this one does. :-) Upvoting. – Drachenfels Mar 22 '15 at 19:18

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
3  
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
2  
You need sudo for the syslinux command. – Cammy_the_block Nov 4 '14 at 4:55
7  
This method did not work for me. The cp -a gives: 'cp: cannot create symbolic link ‘/media/xxx/./ubuntu’: Operation not permitted' and other of the like, since the target is fat32. I tried ignoring that... didn't work – sheß May 30 '15 at 12:26
4  
Important to note that the usb must be a fat32 filesystem, otherwise syslinux will not work – Ricardo BRGWeb Nov 2 '15 at 1:22
1  
The console shows me same error than @sheß. I verified filesystem (FAT32) and flag BOOT. – Chofoteddy Jan 4 '16 at 18:07

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
7  
+1 for mentioning sync. Without it, you have no idea if the content was actually copied. Also, if you're not in a hurry, you should md5sum both files just to be doubly-sure. – Dave Oct 15 '15 at 0:28
    
Maybe worth mentioning the USB may need to be (re)formatted as FAT32 with sudo mkfs.msdos -F 32 /dev/sdX first? – Nemo May 4 '16 at 22:32
3  
@Nemo, is it possible for that to make a difference? dd to /dev/sdX will overwrite any existing file system. – mwfearnley May 8 '16 at 13:54
2  
sync is pointless here. It only affects file system operations. – punund Jun 19 '16 at 14:03

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

#Replace X accordingly in both commands

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

Just be sure /dev/sdX 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
1  
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
1  
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
1  
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 '15 at 21:44
1  
@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 '15 at 13:58

First, unmount the USB device and then use lsblk to verify the device.

Sometimes (usually older iso files) dd is not sufficient and the pendrive will not boot. In this case, you may need to install syslinux:

sudo apt-get install syslinux

and then run the following commands:

sudo mkfs -t vfat -I /dev/sdX

You want to run that last command to /dev/sdX and not /dev/sdX1.

Then, proceed with the following commands:

isohybrid /path/to/file.iso --entry 4 --type 0x1c
dd if='/path/to/file.iso' of=/dev/sdX bs=8M

or, to see progress of image write:

pv -tpreb /path/to/file.iso | dd of=/dev/sdX bs=8M

or instead of dd, you can use cat instead:

sudo -s
cat /path/to/file.iso > /dev/sdX

Rememeber to issue sync command to flush write cache

sync

web.archive.org/web/20140327085331/https://tails.boum.org/doc/first_steps/installation/manual/linux/index.en.html

share|improve this answer
    
I need to mention that for me everything else failed, but this worked - I opted for the cat command. – Digital Dracula Nov 29 '16 at 12:46
$ 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
2  
what is the significance of bs=1MB in dd command??? – juggernaut1996 Jan 25 '16 at 12:56
1  
@juggernaut1996 none. It's the block size to use when copying. Since no count argument was supplied it will copy the whole of the input in 1MB blocks. It could be removed. – sjbx Jun 29 '16 at 15:23
    
The "Don't use the path to bit" is a misinformation. The process itself does not bake the path components into the copied image in any step, so it's irrelevant if you navigate to the directory containing your ISO image or just give the full path. Moreover, dd can accept input from stdin too, so you can simply pipe two dd into eachother to make sure no path baked into the image. – Gabor Garami Aug 15 '16 at 14:12

Try this, and never failed me for 100+ times:

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/* /SD_CardMountPoint

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
3  
-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 '15 at 15:29

protected by Avinash Raj Feb 7 '15 at 15:12

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

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.