This seems like it needs a bug report. It's an intermittent problem. It fails and recovers between boot cycles and it's random.
Also,
I had the same problem but I couldn't use your automated script to fix it. I think you may have a typo. I had to change file permissions manually.
find /sys -iname \*mmc\* | sed 's#$#/uevent#' | xargs ls -l
/\
|| that works fine
vs
|| this throws an error
\/
find /sys -iname \*mmc\* | sed s#$#/uevent# | xargs sudo chmod a+r
missing '' single quotes on sed 's#$#/uevent#'
? I was too chicken to experiment. I'm not well versed in shell scripting or operating systems.
I had to change the file permissions manually and reboot. There was only one file, but I didn't save the path so I don't know which file I changed.
When I rebooted, there was still only one file:
--w------- 1 root root 4096 Feb 5 22:50 /sys/bus/mmc/uevent
and even though it's write only again, the memory card reader is still working.
Seems very fishy and I'm not convinced this is a robust fix and won't fail again. Should be entered as a bug report somewhere. If it is indeed an uninitialized variable somewhere that tweaking file permissions can repair, there's no guarantee it won't fail again later if that uninitialized variable gets altered, e.g. by a system update.
Additional info:
I'm using this box that comes with a 4 port USB 3.0 PCIe card with two internal ports that are routed to the box in the front panel:
https://www.centralcomputer.com/comkia-usb-3-0-internal-card-reader-usb-3-0-pci-e-1x-card-support-cf-md-sd-ms-xd-sdhc-sdxc-micro-sd.html
but this other box also from Comkia that I tried seems to work fine when connected to the dual USB 2.0 socket on the motherboard:
https://www.centralcomputer.com/p-IOC-CRMLCB01-comkia-all-in-1-internal-card-reader-w-bluetooth-support-sd-sdhc-ms-cf-md-mmc-xd-micro-sd.html
I confirmed that plugging a USB stick into the USB 3.0 PCIe card supplied with the first box reproduces the intermittent behavior, as expected since the front panel USB 3.0 port on that memory card reader that also doesn't function reliably is probably just hard-wired straight through.
I'm thinking it's a problem with the OS not properly detecting or reading the USB card reliably, and not related to the card reader box itself. I'm wondering if other USB PCIe cards face the same issue.
I can see the memory ports and the USB stick in the bios under boot options so I know it's working fine, but Ubuntu can't figure out that the thing is there reliably even though the bios sees it.
If it was related only to a funky file permission, it wouldn't work at all until the file permission was fixed, and the file permission would stay fixed through a reboot if that fixed the problem. I don't think you've adequately identified the root cause of the problem.
Possible solution:
I'm contemplating a work-around for the PCIe card by connecting a dual port USB 3.0 box that simply converts the mother board dual USB 3.0 port connector into a front panel pair, that is normally supposed to mount in a 3.5" drive bay but instead leaving it inside the case to act as an adapter between the card reader box and the USB 3.0 dual port connector on the motherboard.
https://www.amazon.com/Bytecc-Front-Bracket-Dual-Tray/dp/B00I609FS4?SubscriptionId=AKIAILSHYYTFIVPWUY6Q
It's a waste of the USB card, but it saves me a PCIe slot and fixes the problem without having loose boxes cluttering the space around the machine or having to reach around behind the computer for the rear external ports on the motherboard. It clutters th inside of the case with a floating plastic box instead. Ugly.
My other option is to use the other functional (USB 2.0) memory card reader box, forego the front panel USB 3.0 connector on the other (USB 3.0) box entirely, and settle for USB 2.0 speed on the memory card reader with bluetooth instead of a front panel USB 3.0 port.
Haven't decided yet but I'm thinking maybe I would rather have bluetooth. Haven't tested to see if it's actually functional. Becoming impatient.
Found this link. Apparently just marking the box with 'Linux' doesn't mean the USB card that is supplied with the reader is actually supported.
https://help.ubuntu.com/stable/ubuntu-help/hardware-cardreader.html
journalctl --follow
, then insert the MicroSD card. – waltinator Feb 07 '19 at 04:59