It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
That looks interesting, thanks!
avatar
clarry: ...I don't know if hdparm is supposed to work on sdcards but if it does, it's still not going to change the mount options of your partition. Your screenshot shows you continuing to use a read-only filesystem after running hdparm. Of course it won't suddenly start writing.
According to its man page hdparm works at kernel/driver level, so it's as low-level as software goes on a Linux system. If you know of another utility (that runs on BusyBox) then I'd be happy to give that a shot and post results.
avatar
AstralWanderer: However the great caveat (and the reason I mentioned the need to test in my post), is that the type of USB adaptor you use matters...So as long as you have the right USB adapter, SD's write protection switch should be fully secure from a software perspective.
avatar
clarry: You're getting closer to the truth: that write protect switch is a lie, and can be bypassed. Indeed, the sd card specification says that the position of the write protect switch is unknown to the internal circuitry of the card ...
Which is why the choice of USB adaptor is important - it's *this* that implements (or doesn't implement) the write protect function (and, if an SD card was plugged in directly to an SD reader, that reader would be responsible for implementing, or not, write-protect). Given that the position of the switch has to be sensed by hardware, it shouldn't be too great a leap to figure that the same hardware can then decide to block subsequent incoming writes (with a USB adaptor, translation has to be done between USB and SD protocols so all commands are intercepted anyway). Edit: as an aside, this also makes USB-SD adaptors less vulnerable to a BadUSB attack.
avatar
clarry: However, the conclusion that write protect is implemented in host hardware is wrong. Hardware delivers the signal (if it is wired at all..), the rest is implemented in the drivers (both the high level sd/mmc layer and the low level controller driver), which are both software.
Note the final comments in this question about USB translation and the availability of USB readers that support locking.

The USB adaptor which worked for me can still be picked up on Amazon.com (I'm not sending you my precious because it's My Preciousss!!) so you could try experimenting yourself to see if you get similar results.
avatar
clarry: It's actually a somewhat common thing that the write-protect line in hardware is sometimes missing (floating), miswired, or has a resistor pulling it high/low...In this case, you'll see a message like "host does not support reading read-only switch, assuming write-enable." When sd card support was first coming to Linux in 2005, drivers needed to be updated to add support for that switch...
No doubt there is faulty hardware requiring software workarounds. But I don't see that as being relevant here.
avatar
clarry: So read-only flag is only set if write-protect capability is implemented in driver, and has not been disabled, and the switch has been enabled.
If it were that straightforward, then hdparm would have been able to change the flag to read/write (which it reportedly did on my system) and allow subsequent writes to work (which they did not, failing with a write-protect error). Hence my conclusion that there must be a hardware element at work and that the Veho USB adaptor was responsible - especially since the same SD card (with the switch still set at Lock) was writable with a different USB adaptor.
Post edited October 22, 2020 by AstralWanderer
avatar
AstralWanderer: According to its man page hdparm works at kernel/driver level, so it's as low-level as software goes on a Linux system.
To wrap this up, I decided to try the card reader on my thinkpad. As expected, hdparm did not accomplish anything because the ioctl is not implemented by the mmcblk device.

So what do I do? Implement the ioctl. And just like that, I can bypass the write protect. It's all software. See screenshot for proof.

Convinced yet?
Attachments:
Post edited October 23, 2020 by clarry
avatar
clarry: ...While yes, USB adapters could interpret the command stream and reject write commands, I can't imagine anyone designing them like that. That's just not how these things generally work...
Then how else can you explain an SD card with its switch set to lock being write-protected in one USB adaptor and not write protected in another?
avatar
AstralWanderer: Then how else can you explain an SD card with its switch set to lock being write-protected in one USB adaptor
That one has the WP line wired, and the driver respects it.

and not write protected in another?
That one does not have the WP line wired, or the driver does not support reading the signal, or the driver/host just ignores it.

Really simple.

If you had the controller rejecting write commands while the software tries to write, then you would be seeing I/O errors. You didn't, so in this case the software didn't even try to write.
Post edited October 22, 2020 by clarry
While the idea of switching to Linux has always been attractive to me, not least because you would be entirely independent of MS products, the thing that always kept me from switching is, how the hell do you backup all your applications and settings? On Windows it's often as simple as copying over a folder, because usually applications have all their files in one folder. Dependency files, such as Visual C++ Redistributables can be kept in the same folder in case I need them. I have a folder of common apps, drivers, redists that I install on every fresh Windows install for just that purpose. Now on Linux you really have NO freaking clue where an application stores it's files. It may be easy to download and install an application from the package manager, but where exactly on the harddrive does it put the files? I may want to know the exact location of those files in case I want to create a backup. Most applications also have dependency files that get stored who knows where. The file structure of Linux is a complete mess in that regard. Also you have no clue which folders are safe to mess with and which ones are not. On Windows you're pretty much safe as long as you don't touch anything in the "C:/Windows" folder.

Also even if there is a way to backup your applications and settings and the dependency files, can you be sure that your applications will run on another Linux Distribution? What if you're forced to move to another Linux distribution because your distribution of choice is no longer receiving updates. Will it be possible to just move your applications and settings over to the new distro? So many questions, so few answers. That's why I still use Windows because it's just much more simple.
Post edited October 22, 2020 by DrmSucksMaster
avatar
DrmSucksMaster: While the idea of switching to Linux has always been attractive to me, not least because you would be entirely independent of MS products, the thing that always kept me from switching is, how the hell do you backup all your applications and settings?
Most people are content with backing up their home directory. This preserves (most of) your settings, but not installed applications. I think virtually nobody bothers with backing up applications, because it is indeed as you say easy to re-install.

Also even if there is a way to backup your applications and settings and the dependency files, can you be sure that your applications will run on another Linux Distribution?
Nope! I mean you can try, but usually you have a dependency hell ahead of you, and you'll just make a mess if you start copying over random deps you from another distro. Recipe for disaster. It highly depends on the application though. Just use your friendly package manager..
Post edited October 22, 2020 by clarry
DrmSucksMaster, I don't understand what the problem is for backing up files. You can copy files in Linux like in any OS, and if you use the dd command then you can make an exact duplicate of a drive to restore later (be careful with it though!).
avatar
HeresMyAccount: DrmSucksMaster, I don't understand what the problem is for backing up files. You can copy files in Linux like in any OS, and if you use the dd command then you can make an exact duplicate of a drive to restore later (be careful with it though!).
Yeah, but as I said, the file structure of Linux is a confusing mess so I wouldn't even know which files I need to restore my applications, which files are safe to overwrite, etc. It's not very intuitive at all for people who are only experienced with Windows. I can never be sure that the software I use will run on future Linux distributions either. I'm not a fan of re-downloading applications unless I really have to. I usually make offline backups of everything which is also why I get most of my games from GOG, so backing up my applications and settings to restore them later is vital for me. Maybe I'll switch to a Linux distro + a Windows VM (that's completely shut off from the internet) someday, that seems like a compromise I can live with.
Post edited October 23, 2020 by DrmSucksMaster
avatar
DrmSucksMaster: While the idea of switching to Linux has always been attractive to me
No need to switch when you can also have both, side by side. Then you can take your time to decide which you want to use more, or even exclusively.

I am spending more and more time on Linux nowadays, but still also use Windows as that is where I still play games mostly (some games on Linux too), and there are a couple of Windows applications that I still use from time to time (like FlickFetch, albeit I am pretty sure it would run just fine in Linux Wine).

avatar
DrmSucksMaster: not least because you would be entirely independent of MS products, the thing that always kept me from switching is, how the hell do you backup all your applications and settings? On Windows it's often as simple as copying over a folder, because usually applications have all their files in one folder.
In one folder? How about the Windows registry, don't any of your Windows applications need entries there? How do you backup the registry entries?

Also if I look under C:\users\username\Documents\ or %appdata%\Roaming\, many applications save settings and all kinds of stuff under those places too, and I think different applications from different times tend to save to different places, depending what was Microsoft's preferred way back when the application appeared.

Also I have no idea how I'd back up e.g. Windows UWP applications. Is it also just about compressing some folder and copying it around?

So all in all, I've never gotten the feeling at all that Windows applications are neatly contained within their own folders, like e.g, MS-DOS games and applications usually were.

avatar
DrmSucksMaster: It may be easy to download and install an application from the package manager, but where exactly on the harddrive does it put the files? I may want to know the exact location of those files in case I want to create a backup.
While I might not be sure how to "backup" single applications in Linux (nor Windows) manually, I think backing up the whole filesystem, in order to make an exact clone on your machine on some other PC, is much simpler on Linux.

It can be as easy as making big tarballs of e.g. the root filesystem and e.g. the data filesystem, if there was a separate data mountpoint, and then just copy them over the network to the new Linux machine and uncompress the tarballs overwriting everything in the root and data filesystem, and there you are.

Can you similarly just zip-compress e.g. your whole Windows machine (including the system directories), copy it over to another PC, unzip it over the Windows installation there and just expect it to work? I am pretty sure that doesn't work, you need to create a system image of your whole Windows system with special tools, boot the other PC with installation media and from there "recover" the new machine with the image etc.
avatar
DrmSucksMaster: It's not very intuitive at all for people who are only experienced with Windows.
That is quite natural. I am also quite lost with advanced use of Windows PowerShell, because I am used to Linux bash shell. Similarly I was quite lost when I first tried e.g. Windows 10 after years of Windows 7, or Windows 7 after years if Windows XP.

Linux does many things differently than Windows so certainly there are new things to learn if you are new to Linux. Basic daily use, like just opening applications and web browser in Linux and doing your stuff there isn't any harder on Linux, even my Windows-only wife learned it quite fast when I briefly showed her how to log into Linux and start the web browser.

But then my wife doesn't have to do any Linux (nor Windows) maintenance and administration, I take care of that.

avatar
DrmSucksMaster: I can never be sure that the software I use will run on future Linux distributions either.
Such guarantee doesn't exist on Windows either. That is why GOG needs to fix older Windows games with various methods so that they would run on modern Windows machines.

avatar
DrmSucksMaster: Maybe I'll switch to a Linux distro + a Windows VM (that's completely shut off from the internet) someday, that seems like a compromise I can live with.
Just add another empty hard drive to your system (or failing that, create a new empty partition on your only hard drive), and install Linux on it. Then you can use Windows and Linux side by side, without having to resort to virtual machines which are mostly unsuitable for e.g. running games. Virtual machines are pretty good for non-gaming purposes though.
Post edited October 23, 2020 by timppu
avatar
timppu: It can be as easy as making big tarballs of e.g. the root filesystem and e.g. the data filesystem, if there was a separate data mountpoint, and then just copy them over the network to the new Linux machine and uncompress the tarballs overwriting everything in the root and data filesystem, and there you are.
Just don't try to include /proc in the backup, as in x86_64 systems it contains a 128 terabyte virtual file called /proc/kcore, of which only parts of it can be read.
avatar
timppu: It can be as easy as making big tarballs of e.g. the root filesystem and e.g. the data filesystem, if there was a separate data mountpoint, and then just copy them over the network to the new Linux machine and uncompress the tarballs overwriting everything in the root and data filesystem, and there you are.
avatar
dtgreene: Just don't try to include /proc in the backup, as in x86_64 systems it contains a 128 terabyte virtual file called /proc/kcore, of which only parts of it can be read.
True, certain files/directories need to be omitted from the tarballs...
avatar
HeresMyAccount: drm9009, if you're a digital rights enthusiast then why the hell are you on this website? I'm not trying to be rude or to criticize, but I'm just curious, because that seems like the opposite attitude from that of a website that seeks to destroy DRM
The forum didn't notify me since it wasn't a direct reply, and sorry to be offtopic to the thread here, but: what I meant by "digital rights enthusiast", I mean my rights as someone who has purchased content :-) Unmanaged Digital Rights, perhaps is what I should have put instead. Fair Use Enthusiast. "DRM is malware" enthusiast. Anti-spyware gamer.

Edit: I changed it to "DRM is malware", that should clarify it, especially if it was being lost in translation for anyone else. Thanks.
Post edited October 23, 2020 by drm9009
avatar
dtgreene: Just don't try to include /proc in the backup, as in x86_64 systems it contains a 128 terabyte virtual file called /proc/kcore, of which only parts of it can be read.
avatar
timppu: True, certain files/directories need to be omitted from the tarballs...
Actually. in this case it's entire (virtual) filesystems that should be included. There's no point in backing up filestystems like /proc, /sys, the devtmpfs on /dev, /dev/shm, the cgroup filesystems, or the various tmpfs filesystems that systemd mounts.

(I note that /sys is also problematic because I believe there are some sysfs files that have side effects when *read*, not to mention that some of these files can return strange errors when naively accessed the wrong way.)