LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Sailfish OS, Replicant, Ubuntu Touch, webOS, and other similar projects and products.

Notices


Reply
  Search this Thread
Old 12-04-2018, 07:20 PM   #1
ordealbyfire83
Member
 
Registered: Oct 2006
Location: Leiden, Netherlands
Distribution: LFS, Ubuntu Hardy
Posts: 302

Rep: Reputation: 89
Can't share SD card between Android and GNU/Linux


I'm having some weird problem with an SD card being rejected by Android (Replicant, Marshmallow) as "corrupted" when it is not. I typically move this card between a camera, my laptop, and Android and as it was called "corrupted" I decided to move everything off, overwrite the entire space, and re-format. The camera expects a particular UID, so I had to manually edit the FAT32 partition's identifier. What I'm finding out is that Android accepts this card when I use a new UID, but when I specify the old one, it is automatically corrupt.

Is there any way to completely reset Android's knowledge of SD cards? Something seems off here.
 
Old 12-07-2018, 08:49 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Are you formatting the card on the camera or the android device?
 
Old 12-09-2018, 09:21 AM   #3
KIOPRET
LQ Newbie
 
Registered: Nov 2018
Posts: 20

Rep: Reputation: 1
try formatting your SD card and choosing FAT instead of NTFS, FAT seems to be more friendly towards mobile devices
 
Old 12-09-2018, 03:49 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by KIOPRET View Post
try formatting your SD card and choosing FAT instead of NTFS, FAT seems to be more friendly towards mobile devices
did you even read the first post?

here:
Quote:
Originally Posted by ordealbyfire83 View Post
The camera expects a particular UID, so I had to manually edit the FAT32 partition's identifier.
 
Old 12-09-2018, 05:37 PM   #5
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,111
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
Hmmm.

Quote:
A unique identifier (UID) is a numeric or alphanumeric string that is associated with a single entity within a given system. UIDs make it possible to address that entity, so that it can be accessed and interacted with.
https://developer.android.com/studio...d-line/dumpsys

Take my post with a grain of salt. These waters I am in are deeper than I am used to.
 
Old 12-18-2018, 09:01 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
I would expect a camera and an android to format sdcards as FAT.

You need to unmount fat partitions because they automatically set (and ignore) a 'dirty' bit. Then when you unmount it, it clears that 'dirty' bit. If you don't unmount it, the next OS will wag fingers at you. It's a pain, nothing to go reformatting about. Just repair it.
 
Old 11-28-2021, 12:05 AM   #7
ordealbyfire83
Member
 
Registered: Oct 2006
Location: Leiden, Netherlands
Distribution: LFS, Ubuntu Hardy
Posts: 302

Original Poster
Rep: Reputation: 89
Not to bump an old thread, but having run into this issue again, I thought I would share my findings in case anyone else has this problem too.

Android has two ways of dealing with removable SD cards, one which uses it as storage for installed apps, and another which treats it as a removable flash drive. If you insert an SD card into your Android device that was formatted and filled with data elsewhere, it will be treated as the second.

In this case, if an app tries to store its own data on the SD card (either on its own will or if you tell it to), Android will no longer be able to tell which of the two ways it should treat the SD card. If you go through the system logs using logcat, you will probably see something like

Code:
11-28 00:15:02.175  1934  1986 E cutils  : Failed to lstat(/mnt/runtime/write/F045-D0FA): Transport endpoint is not connected
11-28 00:15:02.175  1934  1986 V vold    : /dev/block/vold/public:179_17: UUID="F045-D0FA" TYPE="vfat" 
11-28 00:15:02.175  1934  1986 E vold    : public:179_17 failed to create mount points: Transport endpoint is not connected
11-28 00:15:02.175  2372  2485 D VoldConnector: RCV <- {652 public:179_17 vfat}
11-28 00:15:02.175  2372  2485 D VoldConnector: RCV <- {653 public:179_17 F045-D0FA}
11-28 00:15:02.175  2372  2485 D VoldConnector: RCV <- {654 public:179_17 sdcard1}
11-28 00:15:02.175  2372  2485 D VoldConnector: RCV <- {656 public:179_17 /mnt/media_rw/F045-D0FA}
11-28 00:15:02.175  2372  2485 D VoldConnector: RCV <- {655 public:179_17 /storage/F045-D0FA}
11-28 00:15:02.175  2372  2485 D VoldConnector: RCV <- {651 public:179_17 6}
11-28 00:15:02.175  2372  2485 D VoldConnector: RCV <- {400 23 Command failed}
11-28 00:15:02.180  2372  2484 D MountService: Volume public:179_17 broadcasting checking to UserHandle{0}
11-28 00:15:02.180  2372  2484 D MountService: Volume public:179_17 broadcasting unmountable to UserHandle{0}
11-28 00:15:02.180  2372  2392 I ActivityManager: Killing 9966:com.android.shell/2000 (adj 13): empty for 1802s
11-28 00:15:02.215  2549  2549 D StorageNotification: Notifying about public volume: VolumeInfo{public:179_17}:
11-28 00:15:02.215  2549  2549 D StorageNotification:     type=PUBLIC diskId=disk:179_16 partGuid=null mountFlags=VISIBLE 
11-28 00:15:02.215  2549  2549 D StorageNotification:     mountUserId=0 state=UNMOUNTABLE 
11-28 00:15:02.215  2549  2549 D StorageNotification:     fsType=vfat fsUuid=F045-D0FA fsLabel=sdcard1 
11-28 00:15:02.215  2549  2549 D StorageNotification:     path=/storage/F045-D0FA internalPath=/mnt/media_rw/F045-D0FA
Of note is the part "Transport endpoint not connected" and the SD card being flagged as unmountable.

The solution to this problem is:

1. Uninstall whatever app tried to write to the SD card (meaning, whatever app tried to write to your 'removable' sd card while treating it as 'internal storage'. (First back up any necessary data, of course.)

2. Make sure the SD card is physically removed.

3. Reboot the device.

4. Re-insert the SD card. It shouldn't be marked as 'corrupted' anymore.

For this scenario, rest assured, your SD card is certainly NOT corrupted, so don't take Android up on its offer to format your SD card. In my case, I dropped my supposedly corrupted SD card into another identical phone, and it was read without issue. Likewise you do not need to alter the UUID.

This issue in 2021 is still found in the latest Replicant images. So it is still a relevant problem to be watched out for.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Patents Are Turning BlackBerry and Nokia, Which Used Android, Into Anti-Android Fronts That Tax Android OEMs LXer Syndicated Linux News 0 10-14-2017 09:05 AM
Encrypted IM between Gnu/Linux and Android pi3.14 Linux - Software 9 08-28-2016 10:07 AM
LXer: Android takes 62% share of tablet market in 2013; Apple's share declines LXer Syndicated Linux News 0 03-03-2014 11:30 PM
License issue difference between The GNU Lesser General Public License and GNU tkmsr Linux - General 2 06-18-2010 01:21 PM
LXer: Why GNU+Linux is > GNU/Linux and > just Linux LXer Syndicated Linux News 0 05-26-2010 05:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile

All times are GMT -5. The time now is 03:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration