Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access files written in termux/emacs on my computer #1260

Closed
hapst3r opened this issue Sep 23, 2019 · 3 comments
Closed

Unable to access files written in termux/emacs on my computer #1260

hapst3r opened this issue Sep 23, 2019 · 3 comments
Labels

Comments

@hapst3r
Copy link

hapst3r commented Sep 23, 2019

Preliminaries
Hello everyone. To get this straight, I'm not completely new to linux, so I'm acquainted with the most basic commands. I know what environment variables are, how to change directories and list theirs contents, etc.

Also, I did the termux-storage-setup shenanigans. If I have not misunderstood its workings from the start, then the storage setup has worked for some time and has, for reasons which I am not all too clear about, broken at some time (some speculations below).

I do use termux mostly for emacs, in which I organise tasks in orgmode and finances in ledger.

Problem description
Well, essentially the problem boils down to this: I am able to view all directories and files that are present in my file structure when I am navigating both in the shell and my phone's file manager. however, when i attach my phone to my (linux) computer, there's some files I cannot see that should be present in any case. I have tried some things to make the problem apparent (see below).

What has made the problem apparent
I have stored my org mode files in /storage/shared/org, and my ledger file in /storage/ledger/. When I tried to synchronise manually before having automatic synchronising through syncthing, I was wondering why, on my desktop, last modifications appeared to have happened around March when I have edited the files but a few days ago. When I opened the files with emacs on my desktop, it showed the contents of the file as last modified in March -- even though, when opening that same file via shell/emacs, it was up to date.

First, I saved a copy of an org file, /storage/shared/org/work.org, to /storage/shared/org/work-new.org, hoping that my desktop's file manager would then find the thing. Unfortunately, it didnt, even though the newly created file is displayed both in the shell and in my phone's file manager. I have also not been able to find it via the desktop file manager's find/search function, or by using the shell. I obviously tried also showing the hidden files with Ctrl-H, but to no avail.

Second, I tried to move ledger/ from /storage/ledger/ to /storage/shared/ledger/. I did this because I thought "well, if I do this, it must become visible along with all the other folders that I can also see when on my desktop". !!NOTE that the ledger/ folder's blue was a bit darker than the blue of all the other folders!! Unfortunately, the problem persisted: even though I can see the folder's new location in shell and phone's file manager, I cant see it on desktop's file manager/shell. Again, Ctrl-H didnt help.

Lastly, I tried a "ls -R | grep ledger" on the /storage/shared/ folder, but this has been running for about half an hour without success. Will update if, within the next hours, something is found.

Speculations on possible causes for the problem
There is a small number of things that I believe could be responsible for breaking what used to work just fine:

  1. Updates of the termux app. This I consider quite unlikely since in this case I would have found the same problem in the issues, which I have not.
  2. I replaced the standard shell with ohmyzsh, only to replace it with the standard shell shortly afterwards. I believe that I have followed installation and uninstallation notes from https://github.com/robbyrussell/oh-my-zsh.
  3. I installed syncthing in order to synchronise between phone and computer. This I also consider quite unlikely, since it is described to work for a bunch of people, I have read about this prior to the installation.
  4. I have "collapsed" my internal storage with an sd card. I am unsure if I did this before/after installing termux, and if the problem has started to occur from this moment, or if it has been present beforehand. Intuitively, I believe the "collapsing" happened after installing termux.

Doing as much guesswork as I can, I believe that 2 and 4 are more or less plausible causes.

Additional information
Output of command termux-info (which I had to type by hand because the file generated by the command "termux-info > termux-info" could, obviously, also not be found -_-. This, typing errors are possible):
Updatable packages:
All packages up to date
Subscribed repositories:
https://dl.bintray.com/grimler/science-packages-24 science/stable
https://dl.bintray.com/grimler/game-packages-24 games/stable
https://dl.bintray.com/termux/termux-packages-24 stable/main
System information:
Linux localhost 3.4.0-perf-g284400a #1 SMP PREEMPT Thu Feb 7 8:04:52 UTC
Termux-packages arch:
arm
Android version:
8.1.0
Device manufacturer:
Fairphone
Device model:
FP2

Thank you very much for every bit of information/help that you can provide to solve the issue. I'm confident that you guys understand how shitty and frustrating such a problem can become if you write down vital information on your phone on the go and are unable to synchronise, or access, the files using your desktop computer.

@ghost
Copy link

ghost commented Sep 23, 2019

Unable to access files written in termux/emacs on my computer

Termux never exposed access to something via USB.

If I have not misunderstood its workings from the start, then the storage setup has worked for some time and has, for reasons which I am not all too clear about, broken at some time (some speculations below).

It isn't broken. It does what it should:

  • Ask for storage access permission.

  • Create symlinks to internal storage and to private directory (!!!) on external storage.

That's all.

Little reference about links in ~/storage:

~/storage $ ls -l | awk '{ print $9,$10,$11 }'
dcim -> /storage/emulated/0/DCIM
downloads -> /storage/emulated/0/Download
external-1 -> /storage/26f489e3-4709-41e7-8d66-5db0bb580dba/Android/data/com.termux/files
movies -> /storage/emulated/0/Movies
music -> /storage/emulated/0/Music
pictures -> /storage/emulated/0/Pictures
shared -> /storage/emulated/0

Files on external storage are stored in /Android/data/com.termux/files which obviously isn't a root directory of external drive.

First, I saved a copy of an org file, /storage/shared/org/work.org, to /storage/shared/org/work-new.org, hoping that my desktop's file manager would then find the thing. Unfortunately, it didnt, even though the newly created file is displayed both in the shell and in my phone's file manager.

  1. Make sure that you are accessing the correct path (see above the layout of "storage").

  2. Reboot your device and try again. MTP is a bit buggy sometimes and display stale results.

!!NOTE that the ledger/ folder's blue was a bit darker than the blue of all the other folders!!

Folder color doesn't say anything. To know exact file type, use utility file.

If you are accessing folder through symlink, of course it will have a different color.

Lastly, I tried a "ls -R | grep ledger" on the /storage/shared/ folder, but this has been running for about half an hour without success.

find . -iname \*ledger\* will be a lot faster...

@ChiefMikeK
Copy link

suggest you cd to your /storage/ then pwd

  • are you /data/data/com.termux/files/home/storage/shared
  • or /storage/emulated/0
  • maybe /sdcard/shared/Documents
  • if its the external sdcard I've had problems with .android_secure a hidden 0 byte file it's some sort of a security feature. 🤔
  • check the file-folder and file owner and group ls -AlR | less from a directory a level above.
  • lrwxrwxrwx 1 u0_a190 u0_a190 19 Jun 22 2018 shared -> /storage/emulated/0
  • drwxrwx--- 32 root everybody 4096 Aug 23 22:51 . drwx--x--x 4 root everybody 4096 Jul 1 00:13 ..
  • If your desktop is not in Termux group ie. u0_a190 then the file and maybe the folder needs rwx everybody 😥

@ghost ghost added the invalid label Sep 24, 2019
@hapst3r
Copy link
Author

hapst3r commented Sep 25, 2019

First, I saved a copy of an org file, /storage/shared/org/work.org, to /storage/shared/org/work-new.org, hoping that my desktop's file manager would then find the thing. Unfortunately, it didnt, even though the newly created file is displayed both in the shell and in my phone's file manager.

1. Make sure that you are accessing the correct path (see above the layout of "storage").

2. Reboot your device and try again. MTP is a bit buggy sometimes and display stale results.

Well, actually, that seems to have been the problem. Now that I restarted both my phone and my computer, I was able to find the files in their most current iteration/version.

Thanks a bunch for the tip. However, can you tell me what exactly needs to be restarted before it works? Is it termux, my computer, my phone or all of those that have to be restarted?

find . -iname *ledger* will be a lot faster...

thanks also a neat tip, thank you :-*

Other than that, I consider the issue closed. Again, thanks a million, I was really starting to shit my pants over potential data loss :D

Edit: typo

@ghost ghost closed this as completed Sep 25, 2019
@ghost ghost locked and limited conversation to collaborators Oct 17, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants