34

Recently I wanted to create a bootable USB of Linux mint. I found that there was a lot of conflicting advice/experience about whether the 'dd' command could be used to create a bootable USB. I decided to download an ISO and try. While dd definitely put the image on the USB stick it was not bootable. So my question is what is the magic ingredient that will make this work or why has this approach persisted if it does not work?

This is the command I used,

dd if=/mint/iso/image of=/dev/sdb1 oflag=direct 

migrated from stackoverflow.com Apr 1 '12 at 15:21

This question came from our site for professional and enthusiast programmers.

  • @sawdust while you are stating that the answers posted are a "no go", this article (community.linuxmint.com/tutorial/view/744) indicates that this is the correct procedure. – Dave G Apr 2 '12 at 2:03
  • 1
    @DaveG - Interesting, apparently 'dd' is a usable command iff the source file is a "Hybrid ISO image". But it is not a generic procedure for every iso. Perhaps that distinction is the reason for the conflicting advice jdowner encountered. – sawdust Apr 2 '12 at 5:26
  • @sawdust thanks for the additional clarification on that. – Dave G Apr 2 '12 at 7:47
  • You may have a system-on-a-stick that shall be used in an EFI boot system -- but your machine is configured to use "classical" boot. So seen with a Linux Mint USB stick. – David Tonhofer Aug 8 '16 at 16:12
  • Here is a simple/genius workaround for recalcitrant iso images (based on Ubuntu Live ISO): 1) Format stick so that there is a filesystem on (say) "/dev/sdX1" , 2) Mount stick as "/mnt/usb" for example, 3) Install grub2 on stick: grub2-install --boot-directory /mnt/usb/boot/ /dev/sdX, 4) Copy previously downloaded ISO image (for example "foolinux.iso") to stick: cp foolinux.iso /mnt/usb/ 5) Create "/mnt/usb/boot/grub2/grub.cfg" file that boots linux from the ISO image present on the stick (cont) – David Tonhofer Aug 8 '16 at 18:40
31

You are writing the image to the partition 1 of /dev/sdb

Change this to the following command:

dd if=/mint/iso/image of=/dev/sdb oflag=direct

this information was acquired from here

  • 2
    I'm doing: sudo dd if=./debian-8.4.0-powerpc-DVD-1.iso of=/dev/rdisk3 bs=1m and its not bootable, any ideas? – Yusufk Jun 11 '16 at 16:22
  • I'd rdisk3 a partition or a raw disk? You are attempting to write the image to a specific partition – Dave G Jun 11 '16 at 16:46
  • 1
    i'm doing /dev/sdb and it's still not bootable – holms Mar 17 '18 at 22:45
  • rdisk3 is the 3rd disk on a mac afaik. I have the same issue as Yusufk. Need to check if its related to UEFI. – gavit May 5 '18 at 16:23
10

You copied the image to the first partition. Try copying to /dev/sdb rather than /dev/sdb1.

The actual mechanism varies a bit depending on the type of image you're using, but for simple DOS/MBR images you need to get a correct partition table (with the bootable partition marked as being bootable, and the MBR - the part of the initial 512 bytes that isn't the partition table - containing initial boot code.

  • I would note that rather than trying to copy the whole ISO again to another partition, simply setting the boot flag on the partition you originally copied the image too may suffice (as hinted at in this answer) – GrayedFox Nov 19 '18 at 19:11
2

From my experience with another Linux distro, all you should have to do is change the syslinux boot loader file and modify it to boot the USB. There's more detailed information about this at the syslinux wiki.

See also this Google search.

1

You may need to have a BPB written into your bootloader. See Dex's post from Fri Apr 24, 2009 9:06 am at http://f.osdev.org/viewtopic.php?f=1&t=19681

The gist is that "if [your usb firmware] users floppy emulation and you do not have a BPB, it will NOT boot"

Armed with that advice, I was able to resolve this issue. I use linux, so my dd command was:

sudo dd bs=512 count=2880 if=IMG.bin of=/dev/sdb

You'll want to replace sdb with your usb device. You can find it by running

ls -l /dev/ | grep sd

before and after inserting your usb while linux is running. If you get e.g. sdb1 and sdb, chose the non-indexed option.

0

Have you made sure that your motherboard is set to boot from the USB device before it tries booting from your HDD? I would guess that may be your only issue - there's not much to using dd as you can see.

  • 1
    This was an issue that I had thought about, especially because I was working on an old computer. So when it did not work on my target machine, I set the boot order on my wifes laptop (shh, don't tell her) and it did not boot from that either. – jdowner Apr 1 '12 at 15:07
0

I've also encountered this issue a few times.

What I found that works for me most of the time is to zero-fill the drive first.

  1. Change X to your drive letter or number, to find it:

    • Mac: diskutil list
    • Linux: lsblk
  2. Zero-fill the drive

    • Mac: dd if=/dev/zero of=/dev/rdiskX bs=4m
    • Linux: dd if=/dev/zero of=/dev/sdX bs=4M
  3. dd your image again

(4meg block sizes seem to be the quickest for me)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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