Prevent auto mounting Android sdcard under Linux Mint
Posted
by
BullShark
on Super User
See other posts from Super User
or by BullShark
Published on 2013-04-12T22:43:28Z
Indexed on
2014/06/03
21:29 UTC
Read the original article
Hit count: 548
I recently obtained an older Android phone, so that I could test Android Apps on it. I've needed it because I have a Nexus 7 but not older Android versions, hardware, etc. to test on.
I'm having a problem with it under Linux Mint with Cinnamon. When I plug the phone in, or remove and plug the sdcard from the phone back to it while the phone is plugged in, Linux automatically mounts the sdcard. This is a problem because once it is mounted under Linux, it dismounts from the phone running Android 2.3.5, and I can no longer test Android Apps I write that require the sdcard to be present, writable.
I went to Menu > System Tools > System Settings > System > Details > Removable Media, and it brings up this window.
I have changed the settings to always "Ask what to do" on "Select how media should be handled". However, the sdcard still gets mounted and then I am asked how I want to open these files (media players, photo importers, file browser, etc.). If I click the checkbox for "Never prompt or start programs on media insertion", then the sdcard is mounted, and I am not asked how to open these files.
Eject is just a noob word for Ubuntu users that means umount (unmount) like "Adminstrator" is another ubuntu noob word for the root user. And if I unmount the sdcard, the phone doesn't recognize it again until I take the sdcard out and plug it back in. The phone sees it for a brief moment until Linux Mint takes it over.
There are 2 possible solutions and maybe more:
1) Prevent Linux from automounting sdcards some how
2) Tell Android not to allow the computer it is plugged into to take over the sdcard, HOW?
Edit:
I found out how to prevent the sdcard from being automatically mounted:
Now it gets recognized by Linux:
bullshark@beastlinux ~ $ dmesg | tail -n 25
[597212.218323] sd 21:0:0:0: [sde] Attached SCSI removable disk
[597212.218639] sr 21:0:0:1: Attached scsi CD-ROM sr2
[597212.218910] sr 21:0:0:1: Attached scsi generic sg7 type 5
[597217.139373] sd 21:0:0:0: [sde] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)
[597217.140726] sd 21:0:0:0: [sde] No Caching mode page present
[597217.140735] sd 21:0:0:0: [sde] Assuming drive cache: write through
[597217.143595] sd 21:0:0:0: [sde] No Caching mode page present
[597217.143602] sd 21:0:0:0: [sde] Assuming drive cache: write through
[597217.152240] sde: sde1
[597389.751008] 4:2:1: cannot get freq at ep 0x84
[597390.238742] 4:2:1: cannot get freq at ep 0x84
[597624.903132] sde: detected capacity change from 1977614336 to 0
[597637.677763] sd 21:0:0:0: [sde] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)
[597637.679616] sd 21:0:0:0: [sde] No Caching mode page present
[597637.679626] sd 21:0:0:0: [sde] Assuming drive cache: write through
[597637.682508] sd 21:0:0:0: [sde] No Caching mode page present
[597637.682515] sd 21:0:0:0: [sde] Assuming drive cache: write through
[597637.692758] sde: sde1
[597661.857979] sde: detected capacity change from 1977614336 to 0
[597688.775455] sd 21:0:0:0: [sde] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)
[597688.776814] sd 21:0:0:0: [sde] No Caching mode page present
[597688.776823] sd 21:0:0:0: [sde] Assuming drive cache: write through
[597688.780055] sd 21:0:0:0: [sde] No Caching mode page present
[597688.780062] sd 21:0:0:0: [sde] Assuming drive cache: write through
[597688.788639] sde: sde1
bullshark@beastlinux ~ $
However, the phone still unmounts the sdcard upon being detected by Linux.
Linux detects but does not mount, and a few seconds later:
Edit #2 (Solution):
I solved this one by changing the usb connection type (was usb mass storage) :
© Super User or respective owner