Whenever I insert/remove SD card, my ubuntu doesn't recognize those behaviors automatically. I have to run lspci command to manually tell ubuntu about the hardware change.

I want to make my ubuntu automatically detect the SD card. (auto-detecting the hardware change, not auto-mounting the file system)

Here is the detailed steps to use SD card on my ubuntu:

  1. Insert SD card to the computer. No new messages on dmesg.
  2. Run lspci command on terminal. Then the new messages appear on dmesg.
  3. Mount the SD card and do something. When finished, unmount the SD card.
  4. Remove SD card physically from the computer. dmesg says nothing about this detachment.
  5. Run lspci command again. Then dmesg says mmc0: card aaaa removed.

Some additional information:

  • I'm using ubuntu 18.04.3 LTS with RTS5227 card reader.
  • No problem with mount, read, write and unmount.

Any suggestions appreciated.

1 Answer 1


A lengthy Q&A on Unix & Linux addresses this issue:

After many pages of scrolling the solution is a new udev rule:

# enable in-kernel media-presence polling
ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000"
ACTION=="add", ATTR{removable}=="1", ATTR{events_poll_msecs}=="-1", ATTR{events_poll_msecs}="2000"

The Q&A is far too long to repost here, but please read the entire link to learn more.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .