16

Why ISO images of some flavours of Ubuntu can be put on USB stick by dd command and boot successfully, while others flavours don't? Moreover it looks like it is dependant of particular USB stick too. I tried with standard Ubuntu:

$ sudo dd if=./ubuntu.iso of=/dev/sdd bs=8129

And it works like charm, I mean: boot and installs or run live Ubuntu. But when I use another USB stick prepared the same way, it fails to boot with Operating system not found BIOS error.

When I try the Ubuntu GNOME, then it simply does not boot with the same error as in previous example, regardless of which one USB stick I use.

I know, that there is Startup Disk Creator application in Ubuntu, but I have been convinced, that it is only a GUI facade for simple dd command, and I can always use dd to create bootable USB stick, at least for Linux. Am I wrong?

3 Answers3

9

If you run Startup Disk Creator (SDC), you'll notice that it does three (four) things:

  1. Format the drive
  2. Copy over the data from the ISO to the drive
  3. (Add an extra casper1 file for persistence, if selected. dd does not give you persistence.)
  4. Install a bootloader

It is not a GUI for dd (there are GUIs for dd, but SDC is not one of those). You can think of it as doing equivalent of Arch Linux's or Gentoo's manual methods. You should be able to create a bootable USB using most (reasonably popular) distros' installation ISOs at present. This was not true about three or four years ago, when I looked at Arch. It was only 2010 that all Arch ISOs gained this feature (where you could write it directly to a USB drive) - from 2008 to 2010 they had special USB images.

Further, if you dd a drive directly, that drive is effectively read-only until you format it or use the remaining space somehow. A SDC-created disk is still usable as a USB drive, even though the contents are not accessible from the live environment easily. So if you dd a 1GB ISO to a 8 or 16 GB USB drive, you're effectively abandoning the remaining space unless extra steps are taken.


1 Typically, most live images use a SquashFS file for the root partition. SquashFS is read-only, so for persistence, a casper-rw file is created in /casper. I am not sure of the origins of casper. From what I understand, when booted with the boot=casper option, the kernel overlays the casper file (creating one if none exists) on top of the squashfs, so that it gains write capability. casper doesn't have to be a file, it can also be a partition.

muru
  • 197,895
  • 55
  • 485
  • 740
  • 1
    What is "casper file"? Please explain. –  Aug 16 '14 at 09:44
  • 1
    @MikołajBartnicki I'm not very sure myself, but I have updated the answer. – muru Aug 16 '14 at 09:59
  • 1
    Casper is a ghost (which you all know). Like you said, it overlays some folders on the ro filesystem. Examining the filesystem from a running live image with persistence enabled shows some directories 'upper' and 'lower' which exists on both the read-only and write systems, but appear as one on the running system, somewhat similar to a mount over an already existing folder – oneindelijk Jan 07 '17 at 15:09
  • 1
    Please notice that these instructions were relevant when written, but in April 2016 the Ubuntu Startup Disk Creator was revamped. After that it is a cloning tool, that copies the hybrid iso boot system with an iso9660 file system from the iso file (each bit is copied without modification). - Furthermore, the current Ubuntu iso files, when written to a USB drive, makes a system that grabs the drive space behind the cloned image and creates an ext4 file system (when booted the first time). – sudodus Oct 06 '23 at 07:14
4

try first:

su -c 'mkfs.vfat /dev/sdc -I'

To make bootable usb disk from iso file using dd command, disk can't have partitions like /dev/sdc1(one from four possible primary partitions of disk /dev/sdc ). You can't clone blocks of iso file to primary partition, becouse dvd or cd disc doesn't have it too. That's why you have to create a filesystem exactly on the disk /dev/sdc, not in the partition primary.

In addition you made few mistakes by typing dd command.

Try this:

su -c 'dd if=/home/user/debian.iso of=/dev/sdc bs=4M;sync;eject /dev/sdc'

your command doesn't correct without mkfs.vfat first. can be if you install bootloader too and make partition active. Other usb drives don't works maybe becouse your usb port can be shared with another your usb port or you don't have power for working live usb OS, probably working hdd drive and other usb disk what needs more power than usual. Than the average power consumption of this type of devices(like hdd disks in external case with usb from sata adapter)

gr8b8
  • 41
2

You can even create a bootable USB stick with cp (it seems much more straightforward for me than dd or a GUI):

sudo cp path/to/ISO /dev/sdX


Remember that /dev/sdX should be replaced with the name of your block device (e.g. /dev/sdb, /dev/sdc).

  • 1
    That was really new to me. Together with progress https://unix.stackexchange.com/a/301329/87264 it shows progress, too – Jonas Eberle Nov 30 '19 at 14:55