Cant do anything on my Htc one m8
That's because your memory is read-only! You can't write data to it: the delete operation writes to memory - at least modifies it.

Not sure about what may be causing this, but probably from malwares or as I can think of now a defective eMMC chip like you know those SD Card that suddenly becomes "Write protection enabled" .

I have myself experienced this and never found a solution so far. This seems to happen with HTC, HUAWEI and I had a case involving a Motorola phone.