104

I was using:

dd  if=/path/to/my/ubuntuiso/ubuntu.iso  of=/dev/sdb1  bs=4M  &&  sync

In order to create bootable Ubuntu USB drives on older Ubuntu versions. It was working perfectly. Sometimes I used the Startup Disk Creator program, which worked well.

But when I use the same methods on Ubuntu 16.04 LTS, I get some warnings while formatting it afterwards.

The installation media works as expected, but when I try to format that USB stick after my work is done, I get the following warning :

enter image description here

The partitioning of that Pendrive looks strange :

enter image description here

And it also shows my 16GB pendrive as 64GB.

After struggling a lot with Gparted, I will somehow format it. But Why is it happening like this ?? Is there any better methods of creating bootable Ubuntu in 16.04 ?

EDIT : there is a related question here. But my question is not about how to format it properly. My question is "How to create a bootable USB without that errors." & "Wht are the causes of that error"

Severus Tux
  • 10,126

11 Answers11

122

A command-line method to make a live USB for UEFI systems

Please note: this deletes all data on the target device.

Install prerequisite:

sudo apt-get install p7zip-full

Assuming the target USB is at /dev/sdb

(please check first with lsblk or gnome-disks or sudo fdisk -l and be sure you know what you are formatting)

Make sure the device has no mounted filesystem and unmount it if necessary, for example:

udisksctl unmount -b /dev/sdb1

Destroy existing partition table:

sudo sgdisk --zap-all /dev/sdb

Create new GPT:

sudo sgdisk --new=1:0:0 --typecode=1:ef00 /dev/sdb

Format as FAT32:

sudo mkfs.vfat -F32 /dev/sdb1

Check it:

sudo fdisk -l /dev/sdb

Should output something like:

Device     Start      End  Sectors  Size Type
/dev/sdb1   2048 15663070 15661023  7.5G EFI System

Mount the drive and extract iso onto it, replacing 'name-of-iso' with the actual filename of the iso you downloaded earlier

sudo mount -t vfat /dev/sdb1 /mnt
sudo 7z x name-of-iso -o/mnt/

Unmount

sudo umount /mnt

Now reboot & enjoy Ubuntu ^_^

(Here's where I originally learned to do this.)

Zanna
  • 72,312
41

Here's how I solved the problem of getting this error when trying to reformat a USB after using it as installation media:

  • First open the Disks Application under Applications > Disks
  • Select the bootable pen drive.
  • There will be an option menu on top right corner
  • Select the Format drive option (CTRL + F)
  • A pop-up will be shown. Select 0 partition and format the disk
  • Now the disk will be empty but it will be not recognized by system. But you can see on Disks Application.
  • Select the pen drive and re-format it. Now the pendrive can be detect by any system.

The accepted answer is too complex to use, as it required lots of typing and remembering the particular disk name (otherwise you may end up with serious problem). Mine is super easy to implement.

Zanna
  • 72,312
Gopal Prasad
  • 511
  • 4
  • 4
17

It is found that the problem is due to a bug in usb-creator-gtk. It is setting improper block-size during the creation of bootable media.

If this bug affects you, you can mark it here : https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/1589028

Severus Tux
  • 10,126
14

This was much easier. Just replace /dev/sdd with your device address. This can be found in the Disks or Gparted utility.

sudo dd if=/dev/zero of=/dev/sdd bs=2048 count=32

You can then use Startup Disk Creator to burn the image to the drive.

Zanna
  • 72,312
7

I use UNetbootin on Ubuntu (both older version and 16.04) and it works fine on my PC. Here's the link for more info.

sudo apt-get install unetbootin
trunk96
  • 200
6

Try dd if=/path/to/my/ubuntuiso/ubuntu.iso of=/dev/sdb this way never failed me. (Note b not b1 at the end - will destroy other partitions if present)

Did you check if the ISO is corrupted?

Also doing this from TTY while not logged in the graphical environment could help in tracking down the problem.

Edit: instead of using the ISO you could use /dev/null to overwrite the partition table.

2

The complaint about block size was probably caused by a bug in the software reading the iso9660 file system. A new version of gparted is released and is available at least in Ubuntu 17.10, where this bug is squashed.


You can use mkusb to clone the drive. This method is not sensitive to the content of the drive, so it is very reliable.

It is also very safe, because mkusb 'wraps a safely belt' around the powerful but dangerous dd command. The target drive is shown very clearly and you have a final checkpoint, where you can double-check, that you will be installing to the correct drive (and avoid mistakes).

See this link: https://help.ubuntu.com/community/mkusb

If it is still not working, you can try according to the following link,

Can't format my usb drive. I have already tried with mkdosfs and gparted - Analysis of the problem

Please notice that you need not start with formatting, because mkusb will overwrite the previous content of the drive anyway. You can go ahead directly and

  • install the operating system from the iso file (or image file) or
  • restore the drive to a standard storage device
sudodus
  • 47,684
1

a problem that comes up with the chosen answer : The pen drive is now invisible upon inserting. (I'm on Lubuntu 16.04 64-bit) Solution: Open the Disks utility to mount it.

In Lubuntu: Start menu > Preferences > Disks.

What has worked with the chosen answer, is that we're back to good old way of the USB drive getting the bootable ISO written to it and still remaining a writable USB drive with remaining space available to store other files (from another existing OS where we're not running the live OS). With Startup Disk Creatoras of 16.04, it is wiping out the USB, creating a read-only partition akin to a CD, making the remaining portion of the USB unallocated (so a 32GB drive becomes a 900mb read-only drive), and I wasn't able to create any secondary partition in the unallocated space.

Update: Unetbootin seemed to do the job, the pen drive remained visible, didn't hide on inserting, and the remaining part of the disk remained available for storing other data. BUT the disk did NOT get recognized as a bootable USB when I booted my laptop! I used the Ubuntu version of UNetBootin.

Nikhil VJ
  • 291
0

It is a shame that many of these GUI disk utilities won't just allow you to delete the partition table off the USB, instead of just prompting with stupid errors like:

Physical block size is 2048 bytes, but Linux says it is 512 bytes

That error dialog should be coupled with this question:

Would you like delete the partition table on this device (all data will be lost)?

Since it doesn't do this, you can immediately do it yourself with this command:

sudo sgdisk --zap-all /dev/sd?

Be sure of two things before you do the command above:

  1. Make sure your terminal is logged into the computer you think it is.
  2. Make sure the device path is correct (see the question mark in he command above,you need to change that to the correct device path).

As others have mention, you can figure out the device path with:

sudo fdisk -l

After this, you can probably proceed by using the utility you were using when you got this error.

BTW, the dd command solutions for this problem are too slow for my needs. All I really want to do is get rid of that error, without waiting on dd to zero out the whole drive.

Lonnie Best
  • 2,244
0

I had the exact same problem, even on a brand new SSD. I used Linux Mint 18.1 and Ubuntu 16.04 LTS ISO versions. No matter how many times I redownloaded the ISO's, rewrote the ISO's and did all tthe steps suggested above to resolve the error mention, it just wouldn't go away. Strangely I did have Mint 18.1 installed and wanted to do fresh install but then encountered the error. I even used the same USB sticks & SSD to install Windows 10, then rewrote the same USB disks AGAION with Ubuntu 16.04/Mint 18.1 and install failed. My opinion is that there was either fault with the ISO file or my particular hardware not compatible. I wasted several HOURS of my life.

** SOLUTION: Downloaded Ubuntu 17.04 ISO & installed. Worked fine on the exact same hardware, same USB drives/sticks where Ubuntu 16.04 wouldn't have any of it.****

0

Apparently the error lies with parted reading the drive incorrectly and not the dd command or the Startup Disk Creator program

Debian Bug report for parted: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=788808

Workaround: If you use fdisk instead of parted then you will see the correct partitioning. Use fdisk instead of parted until the parted bug is fixed.

guest
  • 1