1

This issue happened for my 32 kingstone flash drive. I tried to make bootable USB by using dd command:

sudo dd if=file.iso of=/dev/sdb

After that I can't do anything with my USB stick.

When trying new partition table with GParted:

David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • @DavidFoerster, Umm.. it's normal to not be able to format a USB stick? – psusi Apr 03 '17 at 01:23
  • After plugging in the USB stick, run dmesg in a terminal and see if anything interesting appears near the end. – psusi Apr 03 '17 at 01:24
  • "Can't write to /dev/sdb, because it is opened read-only." – I suspect the drive is mounted somewhere. Please run sudo umount /dev/sdb and try to repartition again. – David Foerster Apr 03 '17 at 03:09
  • psusi those are the last two messages [ 2159.495428] blk_update_request: critical medium error, dev sdb, sector 120 [ 2159.495431] Buffer I/O error on dev sdb, logical block 15, async page read – Mohamed Shaaban Apr 08 '17 at 15:25
  • Could you please [edit] your question to include the output of sudo lsblk -f? Thanks. – David Foerster Apr 09 '17 at 08:25

2 Answers2

1

Looks like the drive is mounted somewhere:

Can't write to /dev/sdb, because it is opened read-only.

Please run

sudo umount /dev/sdb

and try to repartition again.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
0

Cloned live-only USB boot drive

When you clone an Ubuntu iso file to a USB drive, the USB drive will be a bootable live drive, that can be run to 'Try Ubuntu' or to install Ubuntu into an internal drive. dd is a cloning tool, when used as described in the original question.

There are other cloning tools that are safer, for example 'Disks' alias gnome-disks, the 'Ubuntu Startup Disk Creator' in Ubuntu 16.04 LTS and newer versions, 'mkusb' and 'Win32 Disk Imager'.

USB drives that are cloned from iso files have the ISO9660 file system which is read-only. This is a feature of the system, that can be used on CD/DVD drives and it is inherited when cloned to USB drives.

There are other tools, that extract the files from an Ubuntu iso file to a file system in a USB drive. 'Unetbootin' and 'Rufus' are extracting tools. 'mkusb' is an extracting tool, when it is creating a persistent live drive.

Persistent live USB boot drive

If you want to use the pendrive both to boot Ubuntu live and to store files, I suggest that you create a persistent live drive.

Restore to a standard storage device

If/when you no longer need need the drive for booting Ubuntu live or installing Ubuntu, you can restore the USB drive to a standard storage device with 'mkusb-dus'.

enter image description here

See the following links and links from them,

help.ubuntu.com/community/mkusb

help.ubuntu.com/community/mkusb/persistent

help.ubuntu.com/community/mkusb/wipe

askubuntu.com/questions/768970/how-do-i-make-a-persistent-live-usb-of-ubuntu-16-04/856083#856083

A simple 'Do it yourself' method

New: A simple 'Do it yourself' method is described in the following links.

If you only want to use the pendrive to run Ubuntu live or install Ubuntu, a cloned system is the best alternative. If you want to make a persistent live drive I think mkusb provides the best alternative.

But if you want to use the pendrive to run Ubuntu live or install Ubuntu and use the remaining drive space to store data or transfer data between computers, the 'Do it yourself' method is a good alternative. It is also a good alternative, if you want to understand the details by doing it manually.

It is enough to

  • Create an MSDOS partition table and a partition with a FAT32 file system and a boot flag.
  • Extract the content from the iso file to the mounted FAT32 file system to create a drive (live drive or install drive) that boots in UEFI mode.

You must add a bootloader separately, if you want the drive to boot also in BIOS mode. There is a compressed image file, that helps you fix this, in cases where it is very difficult to install the bootloader for BIOS mode.

There is a general description in this first link,

help.ubuntu.com/community/Installation/iso2usb

There are detailed instructions in this second link,

help.ubuntu.com/community/Installation/iso2usb/diy

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • hi sudodus thanks for your answer i tried mkusb-dus but it still give me the same error "device is read only" and partitioin table is unreadable – Mohamed Shaaban Apr 08 '17 at 15:34
  • @MohamedShaaban, When mkusb fails like that, I am afraid, that the drive is 'gridlocked', a first stage of failing. I don'ẗ know how to repair that. But try these things before giving up: Reboot and try again, disconnect other USB devices, try other USB ports, try another computer, try another operating system. Check if there is a microswitch that you happened to set in the read-only position. See these links for more details, https://askubuntu.com/questions/894095/cannot-format-sd-card-with-ubuntu/894227#894227 and https://ubuntuforums.org/showthread.php?t=2196858&p=13199297#post13199297 – sudodus Apr 09 '17 at 18:20