2

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.

In Mint 17 you can check Menu > System Settings > Preferences > Preferred Applications > Removable Media, and it brings up this window. (In previous Mint versions this was found under Menu > System Tools > System Settings > System > Details > Removable Media)

Removable Media Settings

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.

Prompt, AutoMount

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 (see below)

  2. Tell Android not to allow the computer it is plugged into to take over the sdcard

How to prevent the sdcard from being automatically mounted:

dconf-editor > org > cinnamon > desktop > media-handling

dconf-editor

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.

enter image description here

Linux detects but does not mount, and a few seconds later:

enter image description here

Edit #2 (Solution):

I solved this one by changing the usb connection type (was usb mass storage) :

enter image description here

7
  • Am I at the wrong *flow site for Linux Gurus?
    – BullShark
    Apr 12, 2013 at 23:14
  • Hi! Welcome to StackOverflow! StackOverflow is for programming questions, and this is not a programming question. Please use other sites, like android.stackexchange.com, for non-programming Android questions.
    – CommonsWare
    Apr 12, 2013 at 23:15
  • I think it's gnome-volume-manager that needs to be killed/stopped to prevent the auto mounting. Apr 12, 2013 at 23:17
  • I have no android experience, but regular Linux distributions have a file /etc/fstab which supports the noauto flag as an option.
    – Hennes
    Apr 13, 2013 at 0:19
  • noauto won't work. from man fstab, "noauto do not mount when "mount -a" is given (e.g., at boot time)"
    – BullShark
    Apr 13, 2013 at 7:06

1 Answer 1

1

Linux Mint Cinnamon is a fork of the Gnome Shell and I found that gsettings was installed by default. That is why

gsettings set org.gnome.desktop.media-handling automount false

worked in my case to prevent the OS from auto-mounting SD cards.

1
  • This setting can also be changed using the graphical tool dconf-editor. And there's also an automount setting in org.cinnamon.desktop.media-handling and org.mate.media-handling.
    – basic6
    Dec 31, 2014 at 16:52

You must log in to answer this question.

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