LinuxQuestions.org
Visit Jeremy's Blog.
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 03-14-2023, 07:18 PM   #1
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 311
Blog Entries: 2

Rep: Reputation: 16
Question Can't edit text files saved on phone's micro sdcard


RE: Phone can't alter grocery list(*.txt) on sdcard!!! Just rooted phone with fastboot, and thus all my usual apps were gone.

Phone
Android Nougat
LG Aristo (The very first model!) LGMS210
Android Version 7.0
Build Number 3.18.31
Software Version: MS21011c
Computer
Code:
a@a-MS-7D05:~$ uname -a
	Linux a-MS-7D05 5.4.0-137-generic #154+10.0trisquel11 SMP Sun Jan 15 01:27:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
To begin with, I was using things perfectly on this phone/sdcard prior to February 9th, 2023. That is more specifically, I could not only write in English and Chinese on my sdcard *.txt files, but also when I connected via usb data cable to my desktop computer I could open the files(on phone's micro sdcard), write one of the two languages I write, save to the sdcard and then open the file from phone everything saved perfectly. Writing to text files via computer, due to the bigger screen and keyboard is essential for persons who have both eyesight issues and who have fingers too big for mobile phone's 'on screen' keyboards, especially when writing longer passages.

However when traveling abroad I tried to use my LG Aristo (1), after buying a local phone card, I couldn't connect to the network so naturally backed up all my data/contacts and then adb reboot bootloader, then fastbooted it. The OS reinstalled. Besides still not being able to connect to the local mobile phone carrier network, when I did successfully restore all setings and software to the phone to that almost identical to the original state, I couldn't write a simple list(*.txt file) to the sdcard?!??! Strangely enough, when I take pictures and video, it saves into sdcard/DCIM/Camera with no problems.

Remembering back to when I first set this phone up... Wait! That was back in 2018, and not only is one of my favorite subjects Mathematics, my memory of the past is AS BAD AS most mathematicians. Anotherwords, I have no idea what I did back in 2018 to overcome this sdcard problem then.

Before experiementing with different solutions, I transferred all my data off the sdcard to the computer HDD for a backup, then used android system to reformat the sdcard.

I started looking online for tutorials, first finding:


Attempt 01: icare-recovery
  1. Reconnect Android phone sd memory card
  2. Unlock/Turn off phone CF memory card write protection/password protection
  3. Format memory card
  4. Delete sd card in Disk Management and Creat New Volume (100% Work for logical damages)
    With my above Desktop, I did this via Parted.
  5. SD card is dying, change it with a new memory card
    Yes, I changed with a new SanDisk 128 GB and an old 32 GB micro sdcard. Same result.
  6. Clean android phone viruses completely by Factory Reset
    I think this is redundant being that I just reinstalled my android OS as a result of fastboot.
None of the above worked.
{fail}

Attempt 02, support.google
Change app permissions on your Android phone: https://support.google.com/android/answer/9431959?hl=en
Go to settings | General | Apps. Select Markor, then go into it's permissions. Microphone and Storage already on. (Same for other text editors, like retro text editor, etc.)
As for the "Change permissions based on their type", that doesn't exist in aforementioned android OS version.
{fail}

Attempt 03, Samsung Galaxy A20 SD Card Helpful Tips | How to put memory card in samsung a20
Nothing in this tutorial had any effect. He never tries to save lists to a *.txt file at all!
{fail}

Attempt 04
20230308 pm Discovery
sdcard write error: Certain FSF software can’t write, And it depends on what fm you open the text files with also. So maybe the sdcard permissions, maybe not?
[Outcome]
Instead of using FSF F-Droid file managers and text editors, you can only use the big corporate bully "Google" Play Store, and even many of their software doesn't work!! The only couplet I found to work was "CX File Explorer" paired with Simple Text Editor, with its Google Play Store specific info below(name too generic):
Name: Simple Text Editor, Nbow Developer
Email: {private}@gmail.com
Address: Ahmadabad, Gujarat India
Shortcoming: When this software(app) saves to sdcard, then you connect phone to pc, and then open that file (on phone's sdcard), all the Chinese displays as rubbish code. Additionally, linux enthusiasists want to use F-Droid. Down with the Google/Apple monopoly!! Thus this counts as a fail.
{fail}

Attempt 05
I then install retro text editor, and it gives the following error when I try to save onto the sdcard: "error on write /root/storage"?? This phone already fastbooted, wouldn't that mean it is already rooted? If not than why the following message when I reboot:

Quote:
Your devicesoftware cannot be checked for corruption. Lock the bootloader.
Press the Power Key To continue.
???

So I look up on the internet if the above error message means anything, and then find the Video Tutorial:
Your device software cannot be checked for corruption. Lock the bootloader - fixed ( Lg phone) - G6!
where I execute the following:
Verify mobile phone connected to Desktop Computer Via usb datacable.
Settings | General
Verify Debugger Mode already enabled
Developer Options
Observe how the "Enable OEM unlock" is greyed out.
Enable USB debugging mode.
In computer's Terminal, i verify adb can see connected to my android device:
Code:
		
$ adb devices
List of devices attached
LGMS21034378a4f	device					
$ adb reboot bootloader
$ fastboot oem lock
...
(bootloader) Erasing userdata and cache
OKAY [  0.448s]
finished. total time: 0.448s					
$  fastboot reboot
rebooting...
finished. total time: 0.052s
I then have to reinstall the android OS, and redo the basic config.
I redo the developer activation, as follows:
Verify mobile phone connected to Desktop Computer Via usb datacable.
Settings | General
Verify Debugger Mode already enabled
Developer Options
Observe how the "Enable OEM unlock" is no longer greyed out, and is on.
-->But now the cursed "USB debugging mode" is greyed out, and you can see it is set to off. No matter how many times I hit it there is no reaction.
In computer's Terminal:
Verify adb can see connected android device:
Code:
		
$ adb devices
List of devices attached
<none listed!!>

I search on web for "usb debugging greyed out how to fix" quickly finding stackoverflow14251398 solution of unmounting and disconnecting phone from computer usb connection.

Immediately I see that USB debugging is no longer greyed out, and turn it on.
I then reconnect usb connection.
I then wondered about the "oem lock" configuration. What is this? I quickly found on samfw: "While OEM unlock may be a prerequisite of rooting, it tends to offer an entirely different function of its own." Thus I know that enabling oem lock is merely a prerequisite of rooting your phone, and at all equivalent to it.

Suddenly I remember at some time years ago that I had completed a tutorial on this phone where you root your phone and then go into some super secret system file via text editor and change a line with permissions from something like "r--r-----" to something like "rwxrwxrw-". Did "FUSE" have anything to do with it? I do a breif search to find that past tutorial online now but simply just can't find it. I think I must root my phone.

I then open terminal:
Code:
	
$ adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
LGMS21034378a4f	device
I tried the tutorial ( how to root any Android phone with computer(Android N Nougat 7.0, OEM Unlock,Install TWRP Recovery)) right after Gupta fastboot reboots his android device at 5:00.

Then I realized I couldn't follow starting at 5:00, thus I had to go back to 3:30 and run:
Code:
	
$ adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
LGMS21034378a4f	device			
$ fastboot flashing unlock
< waiting for any device >
((Hangs Indefinitely))
Since that didn't work, I then sign in as sudo su, and re-run above command, only to get the exact same indefinite hang.

I then try:
Code:
		
a@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f$ adb reboot bootloader
The Android phone's screen goes back to the terminal screen, and then I go back to following the tutorial at 3:30:
Code:
		
a@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f$ fastboot flashing unlock
...
(bootloader) Erasing userdata and cache
OKAY [  0.198s]
finished. total time: 0.198s	
a@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f$ fastboot reboot
rebooting...
finished. total time: 0.052s
Even though I didn't get the exact screens Gupta got on his screen, still you can see I was able to run above commands.

Next I disconnect the usb cable, and press the power button to reboot.
Unfortunately when I both power off and / or reboot, I never get the screen he gets @ 5:26, and I tried to press the "power" and "volumne down" buttons together, but I simply don't get the response he gets.
Maybe if I just go on anyway it might work??
So I continue on the tutorial at 5:30, and at 5:38 I run into the problem of the computer(currently connected via usb data cable) to the android phone can't connect, more specifically:
Code:
			
a@a-MS-7D05:~$ fastboot devices
a@a-MS-7D05:~$ 
<<No devices detected>>
With no devices detected I can only redo the developer - OEM unlock - debugging mode procedure, where I run into the problem that both the OEM unlock(on) and the usb debugging(off) are greyed out. I refer to the above procedure(https://stackoverflow.com/questions/...ion-greyed-out) and disconnect usb data cable from my phone. Suddenly I can put the usb debugging on, but the OEM lock is still greyed out. I suddenly notice a pattern! Just before, right after running the reboot bootloader, I executed the command "fastboot flashing unlock", so thus now by reverse logic the "Enable OEM unlock" config is greyed out. In the first instance of me executing the "adb reboot bootloader" I executed "fastboot oem lock", which resulted in the "Enable OEM unlock" to not be greyed out. Why negative logic and not positive logic?

Gupta tells us to download the TWRP for our phone, where I use the search <twrp phone +"LG Aristo 1">, and find https://forum.xda-developers.com/t/t...a-lv3.3656019/. The tutorial has me AGAIN execute following commands:
Code:
			
$ adb reboot bootloader
a@a-MS-7D05:~$ fastboot oem unlock
...
(bootloader) 	Device already : unlocked!
OKAY [  0.003s]
finished. total time: 0.003s
I then rebooted via the "fastboot reboot" command while unplugging the usb data cable. Once the phone rebooted I then powered off, held down the volume down button and then reconnected the usb data cable. I get into the "Welcome to Fastboot Mode:" screen, where I then enter the following command in terminal:
Code:
			
$ fastboot devices
LGMS21034378a4f	fastboot							
$ fastboot flash recovery twrp.3.1.1.-0_lv3.img
error: cannot load 'twrp.3.1.1.-0_lv3.img': No such file or directory
I then noticed that the "https://forum.xda-developers.com/t/twrp-for-the-lg-aristo-aka-lv3.3656019/" forgot to have us first download the file "twrp.3.1.1.-0_lv3.img". I skim down and discover the line "Recovery Link: https://www.mediafire.com/file/wj1jhzjop2jchag/twrp.3.1.1-0_lv3.img", where I download this file to ~/Downloads folder. Next I execute the following in terminal:
Code:
			
a@a-MS-7D05:~$ fastboot flash recovery ~/Downloads/twrp.3.1.1-0_lv3.img
target reported max download size of 262144000 bytes
sending 'recovery' (18400 KB)...
OKAY [  0.602s]
writing 'recovery'...
OKAY [  0.236s]
finished. total time: 0.838s
I then follow the forum.xda-dev instructions by taking the battery out to power off, then hold down volume button, reinsert battery and hold down power button. Unlike the tutorial suggests:
"BOOT INTO RECOVERY MODE FOR THE FIRST TIME HOLD VOLUME DOWN + POWER" until you see the LG logo and then temporarily release the POWER button, immediately pressing and holding it back down until you see the white prompt [factory reset] screen. You will NEVER release the volume down button in this process!
Use the hard keys to select "YES" and then "YES" again to boot into TWRP!"
In reality, when you execute the above you actually see the LG logo and then temporarily release the POWER button, immediately pressing and holding it back down, but then you never see the white prompt [factory reset] screen. Actually the phone reboots when you do this.

At this point, it seems obvious that I didn't successfully implement this "twrp" tutorial, but before I give up I notice in settings that when usb data cable is plugged into the phone, both 1) "Enable OEM unlock" and 2) "USB debugging" are greyed out but "on".
{fail}

Attempt06:
I tried to change permissions on the sdcard with in the phone from the usb data cable computer connection:
First I manuvered into the sdcard, and targeted the folder where I put all my files.
Code:
$ ls -la
total 8710
drwx------ 1 a a       0 Dec 31  1969 .
dr-x------ 1 a a       0 Dec 31  1969 ..
drwx------ 1 a a   32768 Mar 14 16:33 AC
drwx------ 1 a a       0 Mar 14 02:23 Android
-rw------- 1 a a      52 Mar 14 01:35 a.txt
drwx------ 1 a a       0 Mar 14 00:50 DCIM
-rw------- 1 a a 8881348 Mar 14 11:26 F-Droid.apk
drwx------ 1 a a       0 Mar 14 00:50 LOST.DIR
-rw------- 1 a a    3469 Mar 14 16:33 超市單.txt
a@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f/SD card$
chmod -R 775 AC

$ sudo su
/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f/SD card# chmod -R 775 AC
chmod: cannot access 'AC': Permission denied
root@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f/SD card# ls -la
ls: cannot open directory '.': Permission denied
root@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f/SD card# cd /run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f/SD card
bash: cd: too many arguments
root@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f/SD card# ls -la
ls: cannot open directory '.': Permission denied
root@a-MS-7D05:/run/user/1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034378a4f/SD card# cd /run/user
root@a-MS-7D05:/run/user# cd 1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034348a4f
bash: cd: 1000/gvfs/mtp:host=LGE_LGMS210_LGMS21034348a4f: Permission denied
root@a-MS-7D05:/run/user# cd 1000/gvfs
bash: cd: 1000/gvfs: Permission denied
root@a-MS-7D05:/run/user# exit
Just look at above "drwx------" for folder AC! So I tried chmod -R:
Code:
$ chmod -R AC
But I got a unaminous error message:
Code:
chmod: changing permissions of 'AC/PENDING/old/202209____PUbklyn_MAP.png': Operation not supported

But just look at the ownership and group! How can I know what owner I am on the android? If the user is not "a" when I edit text files on my sdcard via android phone, then even without the changing permissions error above, it still wouldn't have worked.

{fail}

In Synopsis, I have clearly shown that after early February 2023 I can't write to text files saved on micro sdcard within their Android 7 phone anymore through the five above failed attempts. Why now (obviously the most likely possibility is some form of white collar crime: e.g.- a developer corporation somewhere got the solution taken down so they could sell us something extra)? Certainly there may be other solutions out there. Maybe I skipped over something? Are any of my above attempts in any way close to the correct solution? Am I right to suspect that this has something to do with the sdcard permissions or some system file that contains some 'permissions data line' that one has to change in order to use the many outstanding text editors (like retro text editor, and I tried many other F-Droid text editors with error messages close to the retro text editor above stated error message) to edit text files saved on the phone's micro sdcard with multilingual support for world languages?

Last edited by andrew.comly; 03-14-2023 at 07:31 PM. Reason: indenting, grammar
 
Old 03-14-2023, 11:05 PM   #2
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,117
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
Yeah. You are right to suspect sd card permissions.

I just use my S7 bluetooth to pipe the music to my juke box speaker in the shop.
I upgraded to a S10 just because hardware wear and tear on my S7 was pretty extensive.

I don't know what to tell ya though as I have no problem on mine with stock android .

Since your uname -a shows you running this https://trisquel.info/

All I can say is check permissions.
 
  


Reply

Tags
formatting, permission error, sdcard, write



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
mounting ext4 sdcard to work like a FAT32 sdcard Brusca.lyfe Linux - Newbie 8 03-26-2021 10:20 AM
current sdcard installs try to mount nonexistatnt sdcard justwantin Slackware - ARM 4 02-09-2021 02:15 AM
[SOLVED] Which File System on micro SDcard. Niraj Kulkarni Linux - Software 1 06-14-2011 04:47 PM
Can't open saved web pages just saved by web browser... JeanBrownHarrel General 2 04-06-2008 11:52 AM

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

All times are GMT -5. The time now is 08:06 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