Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Wiping write protected USB

  1. #1
    Join Date
    Mar 2015
    Beans
    40

    Wiping write protected USB

    I wanted to try Kubuntu on another PC (I've just upgraded to Ubunutu 20 on this one) and created a USB but couldn't get it to boot from it. I suspect the creation didn't quite work and so wanted to wipe it and try again but the USB is write protected.
    I spent ages looking up how to remove the write protection and lots of pages saying different ways, different things to install etc. all of them missing bits of what I need.

    As I understand it I can use chmod 666 /dev/xyz where xyz is the assignment of the device.

    If I do a lsusb I get this for the device "Bus 002 Device 002: ID 0951:1666 Kingston Technology DataTraveler 100 G3/G4/SE9 G2" but I believe that doesn't have what I need but it does show the device is being seen. I believe I'm looking for either a sda or tty followed by usb but when I do an ls I'm getting lots of sdas and ttys but none of them referencing a USB.

    So how do I find out the right thing I need to put in place of the xyz in the chmod command?

  2. #2
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Wiping write protected USB

    but couldn't get it to boot from it.
    Perhaps you have not set boot flags (as just one thought).
    I would inspect the drive using gparted.
    In fact, by coincidence, I am about to refresh an old USB drive to hold a fresh download of Ubuntu 20.04 to install on an SSD (USB port) and I will be using gparted to setup.

  3. #3
    Join Date
    Aug 2006
    Beans
    13,299
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: Wiping write protected USB

    Why do you think it is write protected? Is there a switch/button to toggle on the USB stick?
    The chmod command is used on files, and has nothing to do with write protection. No matter what mode is set on files, you should still be able to format the device, which is what is done, when an Ubuntu USB gets created.

  4. #4
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    6,097
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Wiping write protected USB

    Run ls /dev, then insert the usb drive, then run ls /dev again. Which device was added the second time? Probably sdb or sdc (if sdb already exists), along with something like sdb1 or sdb2, which are partitions on the usb drive.

    Root should already have read and write access to the usb drive, other users shouldn't, so I don't expect you have to use chmod. Use sudo to write to the usb when wiping it clean or creating the live usb. Some usb drives have a physical switch to make then read-only. I haven't encountered any such drives recently, but they exist. In that case you have to move the switch.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Wiping write protected USB

    Not all USB flash drives are supported by every USB controller on every computer. I have a number of USB flash drives with different Linux installers that work on 3 of my computers, but not the other 2. Over the decades, I've looked for a pattern for which worked and which didn't. Never found one.

    USB write protection is very uncommon. If a device has it at all, then it is a hardware switch to be toggled, like on the SDHC cards with the slider.

    Chmod won't make a USB device writable. When creating a boot flash drive, the device much be unused, but still connected to the PC. Systems that auto-access all connected storage will have issues with this.

    When I'm creating a boot flash drive, I'll have 2 terminals.
    a) dmesg -w
    b) for other commands

    Then I plug in the flash drive to be wiped. When the OS sees it, the dmesg window will show the device name. There are a few lines to see, all related to /dev/sd ..... something. Suppose the dmesg shows /dev/sdh and partitions sdh1 and sdh2. We'll use that for commands below. What you see will most likely be different.

    Next, I use the "cp" command in the "b" terminal
    Code:
    sudo cp /path/to/ubuntu-xxx-yyy.iso  /dev/sdh
    Let that run. Should take 2-4 minutes.
    Next type, sync; sync; sync into the "b" terminal. By the time you type the 3rd one, all the disk buffers should have been flushed to the flash storage and it should be done.

    When the command prompt comes back, it is done. I'd pull it out, wait 10 seconds, reinsert it. Watch the "a" terminal with dmesg and see the connection and partitions.
    If it gets auto connected, go into the GUI (file manager) and "Eject" the USB partitions.
    It is ready for use.

    While I used 'cp', any command that moves bits, unmolested, from a--->b can be used. So, cat, more, less, dd, ddrescue, tee, can all be used. Of course, you can use those specialty tools like unetbootin, rufus, etcher, whatever too, but they are just fancy tools to move bits from a--->b.

    None of this can make a flash drive become magically compatible with a USB controller. Sorry.

    I've never touched the partition types or boot flags on the flash storage. It isn't needed. The flags are contained in the ISO, already.

  6. #6
    Join Date
    May 2008
    Beans
    2,164
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Wiping write protected USB

    mkusb is a very useful utility for creating bootable usb devices https://help.ubuntu.com/community/mkusb

    It also includes features (among others) to:-
    Restore to a standard storage device
    Wipe a device

  7. #7
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Wiping write protected USB

    +1 for mkusb.

    I've used it a few times for multi-boot with a little storage outside the ISO and "persistent" areas for data storage. I think it was multi-boot, but don't quote me on that. The guy behind it is active in these forums and has a long running thread with all the different releases and methods to use it.

    Took me 3 attempts to get it to do what I wanted. I didn't understand the subtle terminology differences for the different choices available. What I wanted was something that says
    Code:
    Persistent ext4 size = Xgb 
    Persistent NTFS size = Ygb
    Persistent exFAT size = Zgb
    and let me specify the size for each.

    About a year ago, the menus were dumbed down for less technical people than me. I found it confusing/unclear for what would really be the outcome for each selection.

  8. #8
    Join Date
    Jun 2014
    Beans
    6,370

    Re: Wiping write protected USB

    If you wrote an iso file of Kubuntu to the usb drive, it is read only and any time you mount it, you will get that message but you can still access it but not modify the contents. If you want to use it for something else, create another flash drive to use for data or use it for another iso, use GParted and from the Device tab, create a new partition table. What exactly are you doing when you get this message.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Wiping write protected USB

    yancek sees something that I had already moved passed. ISO files are ISO9660 standard read-only images of a CDROM/DVD. They are readonly and always will be. That's what an ISO is. The file system is read-only, always. Can't be anything else. Read-only is the core nature of an ISO9660 standard.

    To modify anything inside it there is a process called "re-mastering". Re-mastering is the same as building it again. There is a tool called mkisofs/genisoimage. It has been a few decades since I created an ISO using any of these tools.

  10. #10
    Join Date
    Mar 2015
    Beans
    40

    Re: Wiping write protected USB

    Many thanks for everyone who replied, I learned a lot that might be useful in the future even if I didn't use it this time around. I have re-done creating the bootable USB although not tried it yet, if it doesn't work I will look into TheFu's suggestion of using dmesg

    QUOTE=dragonfly41;14050129]Perhaps you have not set boot flags (as just one thought).
    I would inspect the drive using gparted.
    In fact, by coincidence, I am about to refresh an old USB drive to hold a fresh download of Ubuntu 20.04 to install on an SSD (USB port) and I will be using gparted to setup.[/QUOTE]
    I used the start-up disk creator from the Dash to create it so that should have taken care of the flags.

    Quote Originally Posted by mikewhatever View Post
    Why do you think it is write protected? Is there a switch/button to toggle on the USB stick?
    The chmod command is used on files, and has nothing to do with write protection. No matter what mode is set on files, you should still be able to format the device, which is what is done, when an Ubuntu USB gets created.
    I'd thought I should be able to format regardless of protection (unless it was a hard lock) but it told me I didn't have access.

    Quote Originally Posted by Impavidus View Post
    Run ls /dev, then insert the usb drive, then run ls /dev again. Which device was added the second time? Probably sdb or sdc (if sdb already exists), along with something like sdb1 or sdb2, which are partitions on the usb drive.

    Root should already have read and write access to the usb drive, other users shouldn't, so I don't expect you have to use chmod. Use sudo to write to the usb when wiping it clean or creating the live usb. Some usb drives have a physical switch to make then read-only. I haven't encountered any such drives recently, but they exist. In that case you have to move the switch.
    Yes, I finally opted for comparing the ls before and after I'd plugged it in, I was trying to avoid having the compare very long lists, but it had to be done.


    Quote Originally Posted by tea for one View Post
    mkusb is a very useful utility for creating bootable usb devices https://help.ubuntu.com/community/mkusb

    It also includes features (among others) to:-
    Restore to a standard storage device
    Wipe a device
    This looked like the most straightforward option so I went for this. Installed in linux and ran from Dash. It brings up a window asking for the source file first, then asking you for the destination, but has already found a likely looking USB and gives the sdb piece and the "Data Traveller" name so I'd no doubt it was the right one. It also has options to create a live/install one or a persistence one.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •