Whenever I flash the Raspbian OS into the SD card, the SD card automatically goes into write protect mode. I was trying to bring up the xvisor on the RPi3. For this, you need to build a custom boot, kernel and then write it to the RPi3 partition. Since the partition has become write protected, I'm not able to copy these into the necessary partitions. Even when I try to format it in Windows and Linux(VM), it says the disk is write protected. The OS runs fine on the Pi, though.

Is there a reason why the SD card goes into write protect mode? Do I need to take any care while flashing so that the card doesn't go into write protection mode?

I have already replaced it twice because I would like to use the card for other purpose. Please help me understand why does the OS send the card (or rather partitions) into write protect mode and make the card unusable?

closed as off-topic by goldilocks Feb 17 '18 at 14:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – goldilocks
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome. That the card is "write protected" in a linux VM inside a Windows host that also considers it so is probably the fault of the Windows host. You need to eliminate Windows as a cause (or not) by investigating "How does an SD card become write-protected in Windows and how can I change that?", a question better suited to our larger sibling site, Super User. Unfortunately, if the context here is it only happens after you alter the card from a linux VM, you are unlikely to get an answer anywhere (all I can say is, linux will not do this).... – goldilocks Feb 17 '18 at 14:26
  • ...But: I believe there is an advisory write protect flag on SD cards. Some software you have used via Windows, or the Windows OS itself, may have set this and now be enforcing it. So a more to the point question is simply "How can I clear an SD card write protect flag in Windows?" to which, eureka, there is already an answer online. And probably quite a few more besides that one if you search yourself. – goldilocks Feb 17 '18 at 14:27
  • If after all this Windows persists in re-marking the card write protected after you alter it from a linux VM, that is also a good question for Super User. – goldilocks Feb 17 '18 at 14:29
  • Thanks for your detailed reply. I was trying to format is via the Windows format utility. VM was the last option that I tried. Neither seemed to work. I went through a couple of forums searching for the answer and I think the problem why the SD card went into write protect mode was due to the fact that there is improper shutdown of the RPi either during any write operation or just like that. And that care needs to be taken so improper shutdowns doesn't happen. – vinwin Feb 19 '18 at 16:40
  • If the system was not cleanly shutdown, the filesystems on it need to be checked and possibly repaired. Raspbian will do this automatically at boot, or you can do it yourself in another computer with (linux) fsck. However, that won't affect the write protect flag if you put it in a Windows machine that sets it for whatever reason. – goldilocks Feb 19 '18 at 17:23