It was the "dirty bit"!
I used the fsck command to check the fileysystem. For me, it is the first time I have tried this.
If your USB flash drive suddenly becomes read-only..
Suspect that there is a corrupt or broken file somewhere on it. It is the signal that the USB flash drive has "suffered an event". It need not be broken, but it may have copied onto it somewhere, a file that is (broken). Mine happened to come from a Windows system, and it had something called "broken chains".
It need not be a Windows file, but most users opt to use a Windows/MSDOS type filesystem on flash sticks, usually FAT32 if it it is a stick bigger than 4GB. It allows to move files between Linux and Windows machines. I have no idea what a Windows machine does if one plugs in an ext4 formatted stick.
If a whole folder was copied, with files in sub-folders, it can happen that there are broken chains in fragmented files.
If the drive was removed while the copy was only locally cached, it can cause broken chains in a FAT32 system. Even if enough time has passed for the copy to complete - it does not mean the cache cooperated.
"Safely Remove" is what you need, but this still does not guarantee the flash drive dirty bit will stay OK.
All the later symptoms of repeatedly reverting to read-only seem to be because of the "dirty bit" flag
The drive can be temporarily set to read-write, and under limited forced conditions, be written to, but as soon as it is seen in normal operation, the "dirty bit" flag will turn it back into read-only.
In the following fix-it example, the flash drive is /dev/sdb1 and has name B3AB-8FAD
Repair the filesystem with sudo fsck
Code:
$ sudo fsck -V /dev/sdb1
fsck from util-linux 2.31.1
[/sbin/fsck.vfat (1) -- /dev/sdb1] fsck.vfat /dev/sdb1
fsck.fat 4.1 (2017-01-24)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 1
/untitled folder/<the_broken_filename>
Start does point to root directory. Deleting dir.
Reclaimed 256 unused clusters (4194304 bytes).
Free cluster summary wrong (1758355 vs. really 1758611)
1) Correct
2) Don't correct
? 1
Perform changes ? (y/n) y
/dev/sdb1: 3093 files, 117424/1876035 clusters
..lets one correct the dirty bit flag. It finds messed up folder, and allows to delete the directory and reclaim unused clusters.
We are not done yet. The fix leaves some loose ends, and the filesystem is still read-only. Use sudo fsck again.
Code:
$ sudo fsck -V /dev/sdb1
fsck from util-linux 2.31.1
[/sbin/fsck.vfat (1) -- /dev/sdb1] fsck.vfat /dev/sdb1
fsck.fat 4.1 (2017-01-24)
Orphaned long file name part "<the_broken_filename>"
1: Delete.
2: Leave it.
? 1
Perform changes ? (y/n) y
/dev/sdb1: 3092 files, 117424/1876035 clusters
It allows to correct the free cluster summary.
Keep going one last time - to check it reports clean.
Code:
$ sudo fsck -V /dev/sdb1
fsck from util-linux 2.31.1
[/sbin/fsck.vfat (1) -- /dev/sdb1] fsck.vfat /dev/sdb1
fsck.fat 4.1 (2017-01-24)
/dev/sdb1: 3092 files, 117424/1876035 clusters
It may be fixed, but it is still flagged read-only. So finally use the remount again to force it to be mounted as read-write.
Code:
$ sudo mount -o remount,rw /media/<username>/B3AB-8FAD
$ /home/<username># mount | grep /dev/sdb1
/dev/sdb1 on /media/<username>/B3AB-8FAD type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
From this point on, the USB flash drive should work again normally.
Very strange that the "dirty" Windows file was easily copied off the USB while in "dirty" read-only state, and it seemed OK, but I trashed it anyway.
I am hoping this can be marked "SOLVED", but I leave it here for a bit.
My thanks to all for their suggestions.