Announcement

Collapse
No announcement yet.

SD Card Reader / Writer Now Works

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [CONFIGURATION] SD Card Reader / Writer Now Works

    The Story

    I had bought a second hand desktop computer with 4 cores at a low price the other day. Soon I noticed something, it lacked its own SD / SH / MC reader! :O
    That very same day I asked the clerk if there was another PC that already included such a SD card reader. He told me that there was a couple of them but I had to add another $40 to that price tag... only to get some extra 4 GB RAM and that reader. At first it sounded like a good option, yet, I decided that I preferred to get an additional SSD disk. Well, I somehow suspected I'd badly need the extra space in the (near?) future. The extra RAM could be replaced by some memory cards I still had on my now burned out PC. This old computer also featured an useful SD card reader so why wouldn't I try installing it on the new one like any good Linuxer would do it, right?

    There was no plastic cover that would allow me to simply insert the old reader in no time.

    OK, it was time to get my old but helpful screwdriver back from oblivion.

    Everything went kind of awry till I found the perfect screw to finish adjusting the reader in its new (or should I say custom?) device slot.

    Its only cable was connected and the reader was able to get the power it badly needed.

    Now it was time to get back on Linux, namely Kubuntu Jammy. The next LTS had not been published as of today April 6th.​​​

    The Issues

    But there was no functional reader displayed on the DIsks & Devices sytem tray applet! :O

    I tried running SEVERAL console commands to find out what might have happened there.

    dmesg and udevadm monitor --kernel detected my "new" device that had not been present at the time I had installed Kubuntu Jammy on my disk.

    udevadm info -q path -n /dev/sdx, replace x with your actual letter based on udevadm info -q path -n /dev/sdx output, told me it should have been linked to sdx indeed.

    ls -l /dev/sdx told me this:

    Code:
    brw-rw---- 1 root disk 6, 22 apr 6 10:40 /dev/sdx​
    The Solution

    Based on Shallow Thought's input, I finally managed to mount the SD card reader on KJ!!

    There was a section that said something like this, after I modified its contents to suit my own needs. For convenience sake, I'll repost my previous output below:

    Code:
    brw-rw---- 1 root disk 6, 22 apr 6 10:40 /dev/sdx​
    The b at the beginning of the line tells me it's a block device; the major and minor device numbers for the base SD card device are 6 and 22. To get the first partition on that card, use the same major device and add one to the minor device: 6 and 23.
    Later on the site suggests that we should enter this line on the console window:

    Code:
    sudo mknod /lib/udev/devices/sdx1 b 6 23
    I soon noticed that devices didn't exist so I just created that directory on my own AND then let it create the sdx1 "file" on its own.

    Nonetheless, that was not the end of the story. Not yet, there's one last step to be done right before I could finally restart the PC.

    I could add one of these 2 lines to fstab:

    Code:
    /dev/sdx1 /media/sdcard vfat user,noauto,exec,fmask=111,shortname=lower,errors=continue 0 0
    IIRC, replacing fmask with umask will allow you to set the read / write capabilities of files and directories at will.
    umask=0000 will let you whatever you wanna do to that card. :O

    EDIT: After some further testing I decided to remove a customized line because automounting the SD card when it's not available was a painful experience forcing you to watch how grub would send you to the halted screen of doom with 2 choices: systemctl reboot and systemctl default.

    Honestly, I didn't know how to relaunch fstab on the current session and totally ignored the possible consequences of doing it right away so I just rebooted my computer.

    Now I can read the actual contents of my useful SD cards at will!
    Praise the Lord because I seriously thought I had been doing a lot of crazy stuff the whole time.
    (There were articles online that kept telling people to format / reformat the SD card to make it readable on Linux. Gladly, I didn't pay attention to them!
    Last edited by kyonides; Apr 06, 2024, 09:33 PM. Reason: Removed a line from fstab code box
    Multibooting: Kubuntu Noble 24.04
    Before: Jammy 22.04, Focal 20.04, Precise 12.04 Xenial 16.04 and Bionic 18.04
    Win XP, 7 & 10 sadly
    Using Linux since June, 2008
Working...
X