Cannot format/restore a bootable USB

I created a bootable USB with Xubuntu iso (actually made it on a Mac with BalenEtcher), but I never replaced my Ubuntu so now I want to free the USB from being bootable.

I followed the standard steps, located the disk with fdisk -l

Disk /dev/sdb: 7,24 GiB, 7763656704 bytes, 15163392 sectors
Disk model:                 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5dbde0fb

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1  *       64 2988159 2988096  1,4G 17 Hidden HPFS/NTFS

unmount it with umount /dev/sdb, even if it appears to be already unmounted

umount: /dev/sdb: not mounted.

and then tried to format with mkfs.vfat -n "name" -I /dev/sdb , obtaining

mkfs.fat 4.1 (2017-01-24)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
mkfs.vfat: unable to open /dev/sdb: Device or resource busy

I read many many similar questions on the web, as how to format readonly iso9660 USB drive, USB Disk stuck in read only after dd an ISO, Unable to open /dev/sdb read-write (Read-only file system), but none of them provided answer/solution to my problem. I tried with gparted where I cannot delete partition, since the command is grayed out, and when trying to format I get again the message "Read-Only..."

gparted

and got no more luck from Disks

enter image description here

I heard someone calling the USB "lost", "broken" due to this "Read-Only mode" but I cannot see how the process of making OS bootable USB can destroy a pendrive, even on a Mac (I won't commit the same error again). Anyone has an idea?

EDIT @Matigo solution:

Following kind @Matigo's solution leads to the following error in my case

enter image description here

EDIT @Stormlord solution:

Even following these steps I find trouble since Xubuntu is still there. I executed the following code as su -

:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0   9,1M  1 loop /snap/canonical-livepatch/95
loop1    7:1    0   219M  1 loop /snap/gnome-3-34-1804/66
loop2    7:2    0  55,4M  1 loop /snap/core18/1944
loop3    7:3    0  62,1M  1 loop /snap/gtk-common-themes/1506
loop4    7:4    0    55M  1 loop /snap/core18/1754
loop6    7:6    0 217,9M  1 loop /snap/gnome-3-34-1804/60
loop7    7:7    0  64,8M  1 loop /snap/gtk-common-themes/1514
loop9    7:9    0  49,8M  1 loop /snap/snap-store/467
loop10   7:10   0  31,1M  1 loop /snap/snapd/10492
loop11   7:11   0  97,9M  1 loop /snap/core/10577
loop12   7:12   0    51M  1 loop /snap/snap-store/518
loop13   7:13   0  31,1M  1 loop /snap/snapd/10707
loop14   7:14   0  97,9M  1 loop /snap/core/10583
sda      8:0    0 465,8G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0 465,3G  0 part /
sdb      8:16   1   7,2G  0 disk 
└─sdb1   8:17   1   1,4G  0 part /media/opisthofulax/Xubuntu 18.04.4 LTS i386
:~# umount /dev/sdb1
:~# sudo dd if=/dev/zero of=/dev/sdb1 bs=4M count=1
1+0 records in
1+0 records out
4194304 bytes (4,2 MB, 4,0 MiB) copied, 0,5299 s, 7,9 MB/s
:~# umount /dev/sdb1
:~# sudo dd if=/dev/zero of=/dev/sdb1 bs=4M count=1
1+0 records in
1+0 records out
4194304 bytes (4,2 MB, 4,0 MiB) copied, 0,522972 s, 8,0 MB/s
:~# 

and then went on gparted, but with no results

enter image description here

enter image description here

EDIT dmesg output:

I'll post a small section (since basically it is repeating all the rimes the same message) of dmesg output, who knows if it could be useful...

[ 1450.196085] usb 1-1: USB disconnect, device number 5
[ 1461.321884] usb 1-1: new high-speed USB device number 6 using xhci_hcd
[ 1461.476270] usb 1-1: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.02
[ 1461.476275] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1461.476278] usb 1-1: SerialNumber: 11121959030800
[ 1461.480766] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 1461.481361] scsi host2: usb-storage 1-1:1.0
[ 1462.515384] scsi 2:0:0:0: Direct-Access                               8.07 PQ: 0 ANSI: 2
[ 1462.520476] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 1462.520955] sd 2:0:0:0: [sdb] 15163392 512-byte logical blocks: (7.76 GB/7.23 GiB)
[ 1462.521104] sd 2:0:0:0: [sdb] Write Protect is off
[ 1462.521108] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 1462.521424] sd 2:0:0:0: [sdb] No Caching mode page found
[ 1462.521431] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 1462.550861]  sdb: sdb1
[ 1462.553046] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[ 1587.022776] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 1587.022781] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[ 1587.022786] sd 2:0:0:0: [sdb] tag#0 <<vendor>>ASC=0xff <<vendor>>ASCQ=0xff 
[ 1587.022790] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 00 00 00 00 08 00
[ 1587.022794] blk_update_request: I/O error, dev sdb, sector 0 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0

...
[ 9919.920261] print_req_error: 1 callbacks suppressed
[ 9919.920264] blk_update_request: critical target error, dev sdb, sector 0 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9919.920269] buffer_io_error: 247 callbacks suppressed
[ 9919.920271] Buffer I/O error on dev sdb, logical block 0, lost async page write
[ 9919.920279] Buffer I/O error on dev sdb, logical block 1, lost async page write
[ 9919.920283] Buffer I/O error on dev sdb, logical block 2, lost async page write
[ 9919.920286] Buffer I/O error on dev sdb, logical block 3, lost async page write
[ 9919.920289] Buffer I/O error on dev sdb, logical block 4, lost async page write
[ 9919.920293] Buffer I/O error on dev sdb, logical block 5, lost async page write
[ 9919.920296] Buffer I/O error on dev sdb, logical block 6, lost async page write
[ 9919.920299] Buffer I/O error on dev sdb, logical block 7, lost async page write
[ 9919.920302] Buffer I/O error on dev sdb, logical block 8, lost async page write
[ 9919.920306] Buffer I/O error on dev sdb, logical block 9, lost async page write
[ 9919.922267] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.922272] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.922276] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.922280] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 00 f0 00 00 f0 00
[ 9919.922284] blk_update_request: critical target error, dev sdb, sector 240 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9919.924093] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.924098] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.924101] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.924105] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 01 e0 00 00 f0 00
[ 9919.924109] blk_update_request: critical target error, dev sdb, sector 480 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9919.925905] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.925910] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.925913] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.925918] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 02 d0 00 00 f0 00
[ 9919.925922] blk_update_request: critical target error, dev sdb, sector 720 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9919.926359] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.926362] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.926365] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.926368] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 03 c0 00 00 40 00
[ 9919.926371] blk_update_request: critical target error, dev sdb, sector 960 op 0x1:(WRITE) flags 0x800 phys_seg 8 prio class 0
[ 9919.926792] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.926795] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.926798] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.926801] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 02 00 00 00 00 08 00
[ 9919.926804] blk_update_request: critical target error, dev sdb, sector 131072 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0
[ 9919.927234] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.927238] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.927241] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.927244] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 e7 5c 00 00 00 f0 00
[ 9919.927247] blk_update_request: critical target error, dev sdb, sector 15162368 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9919.927701] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.927705] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.927709] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.927714] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 e7 5c f0 00 00 f0 00
[ 9919.927718] blk_update_request: critical target error, dev sdb, sector 15162608 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9919.928214] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.928218] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.928222] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.928227] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 e7 5d e0 00 00 f0 00
[ 9919.928230] blk_update_request: critical target error, dev sdb, sector 15162848 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9919.929055] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9919.929062] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9919.929066] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9919.929071] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 e7 5e d0 00 00 f0 00
[ 9919.929075] blk_update_request: critical target error, dev sdb, sector 15163088 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[ 9947.621089] scsi_io_completion_action: 4 callbacks suppressed
[ 9947.621097] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9947.621101] sd 2:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current] 
[ 9947.621105] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Write protected
[ 9947.621109] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 00 00 00 00 f0 00

...

11255.601271] blk_update_request: critical target error, dev sdb, sector 2224 op 0x1:(WRITE) flags 0x4800 phys_seg 30 prio class 0
[11262.748255] sd 2:0:0:0: [sdb] Write Protect is on
[11262.748260] sd 2:0:0:0: [sdb] Mode Sense: 03 00 80 00
[11262.754520]  sdb: sdb1 sdb2
[11417.161801]  sdb: sdb1 sdb2
[11647.372486] usb 1-2.2: USB disconnect, device number 27
[11654.197528] usb 1-2.2: new high-speed USB device number 28 using xhci_hcd
[11654.304292] usb 1-2.2: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.02
[11654.304307] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[11654.304317] usb 1-2.2: SerialNumber: 11121959030800
[11654.310561] usb-storage 1-2.2:1.0: USB Mass Storage device detected
[11654.311453] scsi host2: usb-storage 1-2.2:1.0
[11655.327639] scsi 2:0:0:0: Direct-Access                               8.07 PQ: 0 ANSI: 2
[11655.334753] sd 2:0:0:0: Attached scsi generic sg1 type 0
[11655.336948] sd 2:0:0:0: [sdb] 15163392 512-byte logical blocks: (7.76 GB/7.23 GiB)
[11655.337096] sd 2:0:0:0: [sdb] Write Protect is off
[11655.337100] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
[11655.337255] sd 2:0:0:0: [sdb] No Caching mode page found
[11655.337261] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[11655.362527]  sdb: sdb1
[11655.363859] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[11656.089711] ISO 9660 Extensions: Microsoft Joliet Level 3
[11656.091320] ISO 9660 Extensions: Microsoft Joliet Level 3
[11656.092591] ISO 9660 Extensions: RRIP_1991A
[11682.343675]  sdb: sdb1
[11694.117274] scsi_io_completion_action: 25 callbacks suppressed
[11694.117301] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[11694.117320] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[11694.117344] sd 2:0:0:0: [sdb] tag#0 <<vendor>>ASC=0xff <<vendor>>ASCQ=0xff 
[11694.117361] sd 2:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 00 00 00 00 08 00
[11694.117369] print_req_error: 25 callbacks suppressed
[11694.117381] blk_update_request: I/O error, dev sdb, sector 0 op 0x1:(WRITE) flags 0x0 phys_seg 1 prio class 0
[11694.117401] buffer_io_error: 1014 callbacks suppressed
[11694.117407] Buffer I/O error on dev sdb, logical block 0, lost async page write
[11694.133024] sd 2:0:0:0: [sdb] Write Protect is on
[11694.133029] sd 2:0:0:0: [sdb] Mode Sense: 03 00 80 00
[11694.142200]  sdb: sdb1 sdb2
[11694.158028]  sdb: sdb1 sdb2
[12260.204498] ISO 9660 Extensions: Microsoft Joliet Level 3
[12260.206286] ISO 9660 Extensions: RRIP_1991A
[12359.052413] usb 1-2.2: USB disconnect, device number 28
[12415.388939] usb 1-2.2: new high-speed USB device number 29 using xhci_hcd
[12415.496543] usb 1-2.2: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.02
[12415.496555] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12415.496563] usb 1-2.2: SerialNumber: 11121959030800
[12415.501755] usb-storage 1-2.2:1.0: USB Mass Storage device detected
[12415.504050] scsi host3: usb-storage 1-2.2:1.0
[12416.527481] scsi 3:0:0:0: Direct-Access                               8.07 PQ: 0 ANSI: 2
[12416.531663] sd 3:0:0:0: Attached scsi generic sg1 type 0
[12416.532908] sd 3:0:0:0: [sdc] 15163392 512-byte logical blocks: (7.76 GB/7.23 GiB)
[12416.533165] sd 3:0:0:0: [sdc] Write Protect is off
[12416.533176] sd 3:0:0:0: [sdc] Mode Sense: 03 00 00 00
[12416.533414] sd 3:0:0:0: [sdc] No Caching mode page found
[12416.533431] sd 3:0:0:0: [sdc] Assuming drive cache: write through

When a storage device is locked in read-only mode, it's usually because something appeared as a hardware failure. Going read-only reduces the risk that more damage will be done before important data can be recovered. That said, unless you're using an older Samsung or Kingston USB memory stick (where this was usually the case), the read-only is probably a false-positive.

Let's try to unlock the drive:

  1. Open Terminal (if not already open)

  2. Type:

    sudo hdparm -r0 /dev/sdb
    

    This should unlock the device, allowing it to be written to. Now let's go over to Disks.

In Disks:

  1. Select the device you want to format (/dev/sdb in this case)
  2. Press Ctrl+F to bring up the "Format" dialog
  3. Click "Format"

After the format is complete your device will appear as completely unallocated space. Now you can create a partition by pressing on the [+] button and formatting it however you please.

Hope this resolves the problem.


The following steps should solve the problem.

  1. Make sure the USB stick is not mounted.
  2. Open a terminal and type: sudo dd if=/dev/zero of=/dev/sdX bs=4M count=1. Replace X with the actual drive letter. Make sure it's the correct one because if it's not, you'll erase another drive irrevocably.
  3. You should have a completely empty USB stick after this operation. Run gparted and create a new mbr/ms-dos or gpt disk using the Device menu.
  4. Create the partitions you need on the USB stick.