1

This question already has an answer here:

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:

marked as duplicate by David Foerster, Terrance, karel, Fabby, Elder Geek Apr 3 '17 at 13:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @DavidFoerster, Umm.. it's normal to not be able to format a USB stick? – psusi Apr 3 '17 at 1:23
  • After plugging in the USB stick, run dmesg in a terminal and see if anything interesting appears near the end. – psusi Apr 3 '17 at 1: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 3 '17 at 3: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 8 '17 at 15:25
  • Could you please edit your question to include the output of sudo lsblk -f? Thanks. – David Foerster Apr 9 '17 at 8:25
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

  • 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 8 '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, askubuntu.com/questions/894095/… and ubuntuforums.org/… – sudodus Apr 9 '17 at 18:20
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.

  • it says not mounted – Mohamed Shaaban Apr 8 '17 at 15:23
  • Now, almost a week later the system state and situation likely changed. If the drive isn't mounted could you please retry to format it like in your question or update your question with it's current kernel path (i. e. what used to be /dev/sdb)? Thanks. – David Foerster Apr 8 '17 at 16:23
  • it gives me the same errors above even after using sudo hdparm -r0 /dev/sdb and replug it – Mohamed Shaaban Apr 8 '17 at 17:04

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