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

Git - error: unable to write file .git while accessing internal storage #249

Closed
damionx7 opened this issue Sep 4, 2020 · 58 comments
Closed

Comments

@damionx7
Copy link

damionx7 commented Sep 4, 2020

I can access the sdcard files using arch linux. But while cloning a new repo or doing git commit, I get this error.

➜  markor git:(master) ✗ git add .
error: unable to write file .git/objects/70/1832ffa500a2dff741f2abbc614e7cf574cc85: No such file or directory
error: README.md: failed to insert into database
error: unable to index file 'README.md'
fatal: updating files failed
➜  markor git:(master) ✗ pwd
/sdcard/Shared/markor
➜  markor git:(master) ✗ whoami
damion
➜  markor git:(master) ✗ pwd
/sdcard/Shared/markor
➜  markor git:(master) ✗ sudo su
[sudo] password for damion: 
[root@localhost markor]# git add .
error: unable to write file .git/objects/70/1832ffa500a2dff741f2abbc614e7cf574cc85: No such file or directory
error: README.md: failed to insert into database
error: unable to index file 'README.md'
fatal: updating files failed
[root@localhost markor]# whoami
root
@SDRausty
Copy link
Owner

SDRausty commented Sep 4, 2020

@damionx7 this is what I get using these commands:

[17:02user]$ startarch l user
[user17:02~]$ gcl https://github.com/SDRausty/TermuxArch
Cloning into 'TermuxArch'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 38 (delta 1), reused 20 (delta 0), pack-reused 0
Unpacking objects: 100% (38/38), 119.76 KiB | 352.00 KiB/s, done.
gcl  2.0.489: DONE 🏁
[user17:02~]$ f clone ~/bin/gcl
git clone --depth 1 "$@" --branch master --single-branch
[user17:03~]$ cd TermuxArch/
[user17:03TermuxArch]$ touch new.document.md
[user17:03TermuxArch]$ ga
ga  2.0.489: DONE 🏁
[user17:04TermuxArch]$ f add ~/bin/ga
git add .
[user17:04TermuxArch]$

Can you try the BASH shell and reproduce these commands in a similar fashion please?

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

Here you go. Also i am having the permission issues on sdcard only.

Screenshot_20200905-064339

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

permission issues on sdcard only.

@damionx7 thank you for sharing. This page was very difficult to find for me once more (two days of on and off searching). Even though I knew this topic was shared recently, not that long ago. The search line https://www.google.com/search?q=git+site%3Aarchlinuxarm.org helped find the webpage sought:

From https://archlinuxarm.org/forum/viewtopic.php?f=15&t=14596:

The unpatched git package from Arch Linux Arm fails to commit in the Android shared storage. Termux has a patched version of git which allows commiting with a warning. It would be great if this could be incorporated into the ALA version of git.

It was really nice of @sudomain to share this information. How can this recommendation be fulfilled quickly?

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

can we try to use the termux git package in arch. maybe using a symlink or bind.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

Can we try to use the termux git package in arch? Maybe using a symlink or bind?

The command getprop and a few others might want ditto. Creating symlinks in:
echo $PATH /home/root/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/sbin:/sbin:/bin
Creating symlinks in /home/root/bin should be a doable solution. These links should propagate to the user accounts along with the ~/bin directory as it does now. Would you like to test this concept, and share a PR if successful @damionx7?

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

sure. i will try.

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

Screenshot_20200905-190328__01

i tried symlinked git package of termux and tried to access the sdcard directory. still the same issue.

@sudomain
Copy link

sudomain commented Sep 5, 2020

It's been a while since I used TermuxArch (I've switched to proot-distro), but isn't Termux's PATH appended to the end of TermuxArch's PATH? So uninstalling Arch's git with pacman -R git should allow you to use Termux's patched version.

I imagine that a bash function could be written to detect if the current directory is in that shared storage. If it is, then use Termux's patched version and if it isn't then use Arch's.

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

I just tried it. The termux git package doesn't seem to work in arch proot.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

@sudomain Termux's PATH has been depreciated due to nesting issues:

isn't Termux's PATH appended to the end of TermuxArch's PATH?

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

PATH=\"\$HOME/bin:\$PATH:/usr/sbin:/sbin:/bin

can be changed to

PATH=\"\$HOME/bin:\$PATH:/usr/sbin:/sbin:/bin:$PATH

to accomplish appending at the end of TermuxArch's PATH statement (use with caution). Maybe this addition should be at the beginning? Please be on the lookout for nesting issues should you choose to do this! Have you looked at all of the packages that are installed with Termux git? Possibly some of these should be symlinked into the system somewhere to get Termux git going in Arch @damionx7?

This issue can also possibly resolve TermuxAPI commands run in Arch @sudomain and a few other programs SDRausty/termux-archlinux#63 as well. Can a link to Termux git be added here to this issue along with this one that we have?

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

I just tried it.

Thank you for trying @damionx7

@sudomain
Copy link

sudomain commented Sep 5, 2020

Please be on the lookout for nesting issues should you choose to do this!

What do you mean by nesting issues? Running startarch while you're already in the PRoot?

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

What do you mean by nesting issues? Running startarch while you're already in the PRoot?

This is correct, and with other programs as well that are on the PATH. Some of the programs, the Termux packages we want to use, others we do not. Like the one you mentioned startartch for there is no reason to run startartch in startartch as far as I can tell.

From what I recall of the nesting issue a short while ago, I installed a number of programs, packages and was hunting for nesting issues, which do crop up more often than not. I guess I will be hunting for some of them again soon when I can.

It's been a while

It has been a while, and you seem to have missed some of the recent great connection action:

Building Android Studio is now available as of August 2020 on smartphone with the latest commits:
[user21:33~]$ makeyay
Building and installing 'yay':

Courtesy of topic cannot build heroku-cli package with pikaur and yay:

installed successfully and is working well on TermuxArch on my arm64-v8 device

Glad that you are taking part again @sudomain!

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

depreciated

This method was recently depreciated also @sudomain:
`# [[ -d /etc/sudoers.d ]] && printf "%s\\n" "$1 ALL=(ALL) ALL" >> /etc/sudoers.d/"$1"

With this line of code:
`sed -i "s/# ALL ALL=(ALL) ALL/ALL ALL=(ALL) NOPASSWD: ALL/g" "/etc/sudoers"

Ownership issues in directory /etc/sudoers.d with this issue caused this change.

I would like to enhance both of the topics that I have mentioned. Your help and opinion is requested.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

I retested by adding $PATH: at the beginning of PATH in function _ADDbash_profile_ in file archlinuxconfig.bash. Uninstalled the Arch Linux git package:

[user11:24~]$ which git
/data/data/com.termux/files/usr/bin/git

I found no change in Termux's git's behavior when cloning in the home directory and on the SD card in Arch Linux in Termux PRoot.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

@damionx7 my next questions should be easy to answer. This is the reason why they are questions:

What is the file system type for the SD card? How can the file system type for the SD card be easily checked in Arch Linux in Termux PRoot and native Termux too?

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

actually internal storage is shown as sdcard. I don't have any external sdcard. Is df -Th the right command ?

➜  /sdcard df -Th
Filesystem                          Type      Size  Used Avail Use% Mounted on
/dev/root                           ext4      106G  101G  4.4G  96% /
/dev/block/dm-1                     ext4      992M  959M   18M  99% /vendor
tmpfs                               tmpfs     2.7G 1004K  2.7G   1% /dev
none                                tmpfs     2.7G     0  2.7G   0% /sys/fs/cgroup
/data/media                         sdcardfs  106G  101G  4.4G  96% /storage/emulated
tmpfs                               tmpfs     2.7G     0  2.7G   0% /apex
/dev/block/dm-3                     ext4      5.0M  5.0M     0 100% /apex/com.android.conscrypt
/dev/block/dm-4                     ext4      836K  808K   12K  99% /apex/com.android.tzdata
/dev/block/dm-5                     ext4      5.5M  5.5M     0 100% /apex/com.android.media
/dev/block/dm-6                     ext4       21M   21M     0 100% /apex/com.android.media.swcodec
/dev/block/loop7                    ext4      1.7M  1.7M     0 100% /apex/com.android.resolv
/dev/block/loop8                    ext4       96M   96M     0 100% /apex/com.android.runtime
/dev/block/loop9                    ext4      232K   36K  192K  16% /apex/com.android.apex.cts.shim
/dev/block/bootdevice/by-name/dsp_a ext4       59M   31M   28M  53% /vendor/dsp
tmpfs                               tmpfs     2.7G     0  2.7G   0% /vendor/etc/perf
overlay                             overlay   262M   96M  157M  38% /vendor/overlay
overlay                             overlay   262M   96M  157M  38% /system/reserve
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/xbin
/sbin/.magisk/block/data            ext4      106G  101G  4.4G  96% /system/xbin/zsh
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/etc
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/etc/permissions
/sbin/.magisk/block/data            ext4      106G  101G  4.4G  96% /system/etc/os-release
/sbin/.magisk/block/data            ext4      106G  101G  4.4G  96% /system/etc/zsh
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/etc/sysconfig
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/etc/cgroups.json
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/priv-app
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/usr/share
/sbin/.magisk/block/data            ext4      106G  101G  4.4G  96% /system/usr/share/terminfo
/sbin/.magisk/block/data            ext4      106G  101G  4.4G  96% /system/usr/share/zsh
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/bin
/sbin/.magisk/block/data            ext4      106G  101G  4.4G  96% /system/bin/tcpdump
/sbin/.magisk/block/data            ext4      106G  101G  4.4G  96% /system/bin/mdnsd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/OPDiagdataCopy
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/OPDiagnoseservice
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/adbd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/apexd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/art_apex_boot_integrity
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/ashmemd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/atrace
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/audioserver
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/auditctl
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/auto_brightness_log.sh
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/blank_screen
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/blkid
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/bootanimation
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/bootstat
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/bpfloader
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/caffe
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/cameraserver
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/charger
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/clatd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/diag_socket_log
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/dnsmasq
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/drmserver
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/dumpstate
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/dun-server
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/e2fsck
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/e2fsdroid
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/filebuilderd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/flags_health_check
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/fsck.f2fs
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/fsck_msdos
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/fsverity_init
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/gatekeeperd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/gpuservice
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/gsid
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/hwservicemanager
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/idmap
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/idmap2
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/idmap2d
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/incident
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/incident_helper
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/incidentd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/init
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/installd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/iorapd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/iw
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/keystore
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/lmkd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/logd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/lpdumpd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/make_f2fs
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mediadrmserver
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mediaextractor
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mediametrics
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mediaserver
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/migrate_legacy_obb_data.sh
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/migrate_non_exist_packages_data.sh
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mke2fs
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mmi
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mmi_diag
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/mtpd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/netd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/netutils-wrapper-1.0
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/notify_color_mode.sh
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/notify_traceur.sh
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/oemlogkit
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/perfetto
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/perfservice
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/pppd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/qvrservice
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/racoon
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/recovery-persist
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/recovery-refresh
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/resize2fs
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/rss_hwm_reset
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sarah
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sdcard
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/servicemanager
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sgdisk
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sigma_miracasthalservice
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/simpleperf_app_runner
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sload_f2fs
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/statsd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/storaged
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/surfaceflinger
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/tombstoned
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/traced
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/traced_probes
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/tune2fs
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/tzdatacheck
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/uncrypt
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/update_engine
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/update_verifier
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/usbd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/vdc
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/viewcompiler
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/vold
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/vold_prepare_subdirs
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/wait_for_keymaster
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/watchdogd
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/wfdservice
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/wificond
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/fonts
/dev/block/loop10                   ext4      262M   96M  157M  38% /system/india
overlay                             overlay   262M   96M  157M  38% /system/product/app
overlay                             overlay   262M   96M  157M  38% /system/product/priv-app
tmpfs                               tmpfs     2.7G     0  2.7G   0% /storage
➜  /sdcard df -Th | grep sdcard
/data/media                         sdcardfs  106G  101G  4.4G  96% /storage/emulated
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sdcard

@sudomain
Copy link

sudomain commented Sep 5, 2020

This is correct, and with other programs as well that are on the PATH. Some of the programs, the Termux packages we want to use, others we do not

I'd say let users configure aliases/functions to cherrypick which the versions they want, since it wont be the same for everyone. That or have startarch in a non-standard PATH location and just don't add it to Arch's PATH. This will mean hardcoding Termux's PATH to the proot bindimg which in turn means a user that's savy enough to customize their Termux PATH will also have to customize their Arch PATH.

Glad that you are taking part again

At the end of the day we're both using Arch Linux ARM. That's cool to hear about Android studio. My next phone will definitely need a larger internal storage.

I would like to enhance both of the topics that I have mentioned. Your help and opinion is requested.

Can you be more specific please?

On the topic of Android's /sdcard, this might be helpful https://android.stackexchange.com/questions/44721/the-sdcard-direcory-and-other-directory-conventions-how-is-the-android-filesys

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

What kinds of file systems are supported on Android:

So, what file system types can Android read? Android has always supported the FAT32, Ext3, and Ext4 file system formats, but external drives are often formatted in exFAT or NTFS if they're over 4GB in size or use files that are over 4GB in size.Jun 22, 2020

external sdcard. Is df -Th the right command ?

[12:03downloads]$ df -Th
df: Unknown option Th (see "df --help")
[12:03downloads]$ df -th
[12:04downloads]$ startarch l user
[user12:04~]$ cd /data/data/com.termux/files/home/storage/downloads
[user12:04downloads]$ df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/root               ext4       19G   18G  910M  96% /
tmpfs                   tmpfs     1.4G  1.8M  1.4G   1% /dev
/data/media             sdcardfs   19G   18G  910M  96% /storage/emulated
/mnt/media_rw/2A16-84BC sdcardfs  234G  232G  2.0G 100% /storage/2A16-84BC
/dev/block/dm-2         ext4      713M  247M  453M  36% /vendor
tmpfs                   tmpfs     1.4G     0  1.4G   0% /storage
[user12:04downloads]$ df -th
df: no file systems processed
[user12:04downloads]$

@damionx7 thank you for sharing; Here is what I got. The answer appears to still be enigmatic. What is the precise sdcardfs file system? I asked it to "define sdcardfs". This is still an enigma for me.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

@damionx7 the file system on your device appears to be ext4:

➜  /sdcard df -Th | grep sdcard
/data/media                         sdcardfs  106G  101G  4.4G  96% /storage/emulated
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sdcard

Is this the effect when you try these commands:

[12:30~]$ cd ~/storage/downloads/
[12:30downloads]$ touch file
[12:30downloads]$ ls -al file
-rw-rw---- 1 root everybody 0 Sep  5 12:30 file
[12:30downloads]$ chmod 777 file
[12:30downloads]$ ls -al file
-rw-rw---- 1 root everybody 0 Sep  5 12:30 file
[12:30downloads]$

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

As far as I can tell about what is happening, git thinks it can make a symlink, but it cannot. Just like this example:

[12:30downloads]$ ln -s file file.lnk
ln: failed to create symbolic link 'file.lnk': Permission denied

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

@damionx7 the file system on your device appears to be ext4:

➜  /sdcard df -Th | grep sdcard
/data/media                         sdcardfs  106G  101G  4.4G  96% /storage/emulated
/sbin/.magisk/block/system_root     ext4      3.3G  3.2G  128M  97% /system/bin/sdcard

Is this the effect when you try these commands:

[12:30~]$ cd ~/storage/downloads/
[12:30downloads]$ touch file
[12:30downloads]$ ls -al file
-rw-rw---- 1 root everybody 0 Sep  5 12:30 file
[12:30downloads]$ chmod 777 file
[12:30downloads]$ ls -al file
-rw-rw---- 1 root everybody 0 Sep  5 12:30 file
[12:30downloads]$

yes. its the same result on my device too.

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

As far as I can tell about what is happening, git thinks it can make a symlink, but it cannot. Just like this example:

[12:30downloads]$ ln -s file file.lnk
ln: failed to create symbolic link 'file.lnk': Permission denied

so maybe symlinks are not allowed on sdcardfs.

I found this https://git-annex.branchable.com/forum/Dealing_with_crippled_Android_file_system/

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

This test confirms the assumption that I had. The program git knows that it is in an environment that cannot create symlinks, and does not attempt to create them. Hence git functions as expected on external SD card:

[12:36downloads]$ cd ~/storage/external-1
[12:40external-1]$ p
/data/data/com.termux/files/home/storage/external-1
[12:41external-1]$ gcl https://github.com/SDRausty/TermuxArch
Cloning into 'TermuxArch'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 38 (delta 1), reused 20 (delta 0), pack-reused 0
Unpacking objects: 100% (38/38), 119.76 KiB | 165.00 KiB/s, done.
gcl  2.0.265: DONE 🏁

[12:41external-1]$

But git does not function as expected on internal SD card because it is not programmed for the limitations of not being able to create symlinks on ext4 file systems.

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

but why does git work in termux and not not in arch ? I mean the filesystem is same.

with termux, it is possible to use git on internal storage also.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

@damionx7 using any proot in a rooted environment is not recommended in general for many reasons. Are you aware of this?

And /sbin/.magisk/block/system_root am I correct that your device is rooted?

@damionx7
Copy link
Author

damionx7 commented Sep 5, 2020

yes it is rooted. But i dont use root with termux or proot.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

termux, it is possible to use git on internal storage also.

This will hopefully be reimplemented soon. I found the offending line of code† and the lack of corresponding support routines. This might also have devastating impact on the progress that we made so far. These support routines were dropped because they got in the way of projects we are trying to make work in our environment.

If this planned implementation does get in the way of the very recent progress we have made, hopefully there will come forth some form of implementation that will suit all the requests involved. In our case, this can probably be confined to the concerns the functioning of programs git and sudo.

† good fragments of code can morph; Why?

@damionx7 rename ~/arch/startarch then remove lines with this fragment --link2symlink from the user account lines (x2).

It looks like we are on the right track here. A little more testing , and I will let you know about a forthcoming commit. If all goes as planned setupTermuxArch re should suffice to refresh the root user's account and the user accounts as well.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

This commit adcf771 resolves the git SD card cloning error.

Using setupTermuxArch re should suffice for these changes to take effect; Enjoy!

NOTE Some of the commands now should be prefixed with sudo for them to run correctly. Other commands, such as addauser must now be run as root user to function correctly.

@SDRausty SDRausty closed this as completed Sep 5, 2020
@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

I managed to fix addauser when run from a user account. The code cd && (git clone https://aur.archlinux.org/fakeroot-tcp.git && cd fakeroot-tcp && sed -i 's/ patch/ sudo patch/g' PKGBUILD && makepkg -irs && libtool --finish /usr/lib/libfakeroot) || printf "%s\\\\n" "Continuing to build and install fakeroot-tcp: " && cd fakeroot-tcp && sed -i 's/ patch/ sudo patch/g' PKGBUILD && makepkg -is now fails too. This affects the makefakeroottcp command that is created with function _ADDmakefakeroottcp_

Needless to say, commands such as yay android studio are not that easily accessible anymore. Your help is welcome in resolving this newly arisen error that has spun off of resolving this issue at command makefakeroottcp worked well #251.

@SDRausty
Copy link
Owner

SDRausty commented Sep 5, 2020

Numerous iterations, and at that nuance iterations requiring time consuming testing have given positive results! This commit and the preceding few have helped to make script makefakeroottcp and more importantly script makeyay functional again, once more. And with git working at full throttle now, progress should continue smoothly.

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

An alias or function in bashrc/profile should be simple enough:
alias startarch='echo nested proots not supported'

Thank you for sharing @sudomain 😃 Termux PATH is implemented once more with this commit 3227adf. And the nesting solution is great!

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

do not use root with termux or proot.

@damionx7 but your system does use root. Please study the difference in our outputs when we were trying to figure out what the file system is in internal shared storage.

To my understanding, these are all little 3d printed chips that are 3d printed onto tiny napkins. Then these napkins are fused into our smartphones. For some reason the properties of this device (the non rooted Android filesystem) are hard to determine; Why is this so?

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

please correct me if i am wrong but the filesystem on /data/media is sdcardfs in both the cases

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

the filesystem on /data/media is sdcardfs

That it is. It is a virtual file system. This knowledge alone would not have brought us one step closer to the solution that we were seeking, and fortunate to find yesterday.

@damionx7 you might find it surprising that a key bit of information came from the df output your rooted smartphone revealed, an ext4 filesytem. It would not have revealed this information if it were not rooted. This information that the file system is ext4 helped in diagnosing the creation of symlinks by git issue.

I just asked it (the Android) to define sdcardfs, and then I asked it what is sdcardfs. It showed me interesting results. One of the most interesting ones is:
https://android.googlesource.com/kernel/msm/+/android-msm-wahoo-4.4-oreo-dr1/fs/sdcardfs/sdcardfs.h

One of the reasons I say this is because this document does not seem to mention the file system type that sdcardfs uses either (zero matches for ext4 and vfat):

0 ext4 filesystem can use symlinks
1 vfat filesystem cannot use symlinks

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

@SDRausty i still don't understand. Can you explain a bit more please . I don't see any difference between your filesystem and my rooted filesystem. Can you tell me which part is different and causing this issue ?

Here are your filesystem as you posted

Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/root               ext4       19G   18G  910M  96% /
tmpfs                   tmpfs     1.4G  1.8M  1.4G   1% /dev
/data/media             sdcardfs   19G   18G  910M  96% /storage/emulated
/mnt/media_rw/2A16-84BC sdcardfs  234G  232G  2.0G 100% /storage/2A16-84BC
/dev/block/dm-2         ext4      713M  247M  453M  36% /vendor
tmpfs                   tmpfs     1.4G     0  1.4G   0% /storage

and here are mine, equivalent to your mounted partitions

➜  ~ df -Th | grep /dev/root
/dev/root                           ext4      106G  102G  4.3G  96% /
➜  ~ df -Th | grep tmpfs    
tmpfs                               tmpfs     2.7G 1004K  2.7G   1% /dev
none                                tmpfs     2.7G     0  2.7G   0% /sys/fs/cgroup
tmpfs                               tmpfs     2.7G     0  2.7G   0% /apex
tmpfs                               tmpfs     2.7G     0  2.7G   0% /vendor/etc/perf
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/xbin
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/etc
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/etc/permissions
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/etc/sysconfig
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/priv-app
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/usr/share
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/bin
tmpfs                               tmpfs     2.7G     0  2.7G   0% /system/fonts
tmpfs                               tmpfs     2.7G     0  2.7G   0% /storage
➜  ~ df -Th | grep /data/media
/data/media                         sdcardfs  106G  102G  4.3G  96% /storage/emulated

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

@damionx7 your previous output has something along the line of:
➜ /sdcard df -Th | grep sdcard /data/media sdcardfs 106G 101G 4.4G 96% /storage/emulated /sbin/.magisk/block/system_root ext4 3.3G 3.2G 128M 97% /system/bin/sdcard

The fact that sdcardfs is ext4 was a crucial piece of information at the time. You can and should be able to create symlinks on ext4 filesystems. On Android this is not possible on the SD card even if it is formated as ext4.

My question at the time was, is git trying to make symlinks where it cannot? What could be confusing git to do this if this was the cause of the error? As far as I know git normally does not get confused whether it be used on vfat or ext4 filesystems. In our case git was thoroughly confused. It did not work right, and my primary question was why?

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

Thanks . But now I have 2 questions .

  1. Why does git ( in termux ) work on sdcard ( or internal storage )
  2. As I can see, Magisk has remounted only a partition /sbin/.magisk/block/system_root ext4 3.3G of size 3.3G and not whole sdcardfs. Why should it cause any problem ?

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

and also how can git be made sane in rooted system.

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

@damionx7 in the screenshots that you shared, what shell are you using?

Why does git ( in termux ) work on sdcard ( or internal storage )

[user05:26downloads]$ gcl https://github.com/SDRausty/TermuxArch
Cloning into 'TermuxArch'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 38 (delta 1), reused 20 (delta 0), pack-reused 0
Unpacking objects: 100% (38/38), 120.45 KiB | 593.00 KiB/s, done.
gcl  2.0.515: DONE 🏁
[user05:26downloads]$ which git
/usr/bin/git
[user05:26downloads]$ pacman -R git
error: you cannot perform this operation unless you are root.
[user05:26downloads]$ sudo pacman -R git
checking dependencies...
:: gettext optionally requires git: for autopoint infrastructure updates

Packages (1) git-2.28.0-1

Total Removed Size:  37.13 MiB

:: Do you want to remove these packages? [Y/n]
:: Processing package changes...
(1/1) removing git                                 [####################] 100%
:: Running post-transaction hooks...
(1/2) Reloading system manager configuration...
  Skipped: Current root is not booted.
(2/2) Arming ConditionNeedsUpdate...
[user05:27downloads]$ gcl https://github.com/BuildAPKs/buildAPKs
Cloning into 'buildAPKs'...
remote: Enumerating objects: 85, done.
remote: Counting objects: 100% (85/85), done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 85 (delta 22), reused 39 (delta 4), pack-reused 0
Unpacking objects: 100% (85/85), 53.38 KiB | 185.00 KiB/s, done.
gcl  2.0.515: DONE 🏁
[user05:27downloads]$ which git
/data/data/com.termux/files/usr/bin/git

Both git versions work in proot. The second two questions that you asked, I cannot really answer as my last rooting experience is summarized here, and was quite profound. Do you know any source code to root Android?

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

Why should it cause any problem?

You must have misunderstood me. I simply stated Magisk revealed critical information to help resolve this issue. The information it revealed is the ext4 file system handled through sdcardfs.

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

@SDRausty But git is still giving permission issue. I thought that you were saying this was due to root.

I am using zsh shell btw

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

Many thanks @SDRausty . Git now works on sdcard. but it doesnt work when i use root user. Maybe the new commits were not applied as I was using zsh.

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

Many thanks @SDRausty

You are welcome @damionx7!

This commit 68bb18d fixes what took a long time with effort to figure out and fix yesterday.

Unfortunately, this topic #251 is reopened, and this one TermuxArch/TermuxArch#22 that took many days to close will be reopened soon too if a solution is not forthcoming.

The change that helped this issue PROOTSTMNTU="${PROOTSTMNT//--link2symlink } is having a negative impact on pacman -S pkg when a package has hard links, like gcc. Advice how to please these different user requests is welcome!

Some of the possibly solutions that I have recently looked at are:

  1. create a nested command that adds this option --link2symlink
  2. create a new type of user account that has this option. One of the drawbacks I see here is how is the user going to know which one to use.
  3. adding the statement --link2symlink back again and trying to reconfigure the proot init statement

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

does not work when i use root user.

That is correct and this will not change. There are many commands the root user should avoid and git is one of those commands. If you look at the list of commands a root user should use, it makes for a very boring account. Can you explain your motivation for cloning with git with the root user account please?

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

@SDRausty I mean the default root user of TermuxArch. I do most of the work on a different account. I was just informing, I have no such use.

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

If you look at the list of commands a root user should use, it makes for a very boring account.

Can you explain your motivation for cloning with git with the root user account please?

I'll rephrase my question. Hopefully I'll be clear. Can you explain your motivation for cloning with git with the Arch Linux in Termux PRoot root user account please?

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

I have no intention of cloning with git with the Arch Linux in Termux PRoot root user account.

I just want to use git to sync some notes. It wont matter in which account I am using git. Its just that I want git to work in internal storage or sdcard.

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

This is quite an interesting issue @damionx7 and you might not see this clearly from your perspective. There is quite a bit of analogy with the saying "What came first the chicken or the egg?" and this issue.

a) you want to install packages before you can use them
b) git is one of the first packages used; Correct?
c) programs that build packages like git, where do these fit in the chicken and the egg, what came first analogy?

Here's the outcome. I know it can be improved, but at least we have something that works for everyone. To be able to use git without errors, you will want to login with a new option.

  1. create a new type of user account that has this option. One of the drawbacks I see here is how is the user going to know which one to use.

This solution has been chosen because it was easiest implement and is being tested at this moment. It would not be good for our users to lose the newly acquired ability of building Android Studio easily with the freshly working command yay. For the task you are trying to accomplish @damionx7 you will probably want to login with the new e prefix option:

[el[ogin] user|eu[ser] user [options]] Login as user [plus options]. Use 'addauser user' first to create this user and the user's home directory. This option is for working with programs that have already been installed, and for working with the 'git' command.

This is the option with option --link2symlink removed that was causing problems with git. If everything goes well your login will look startarch elogin @damionx7 something like this shortly. If you want to build packages and install packages, this is startarch login @damionx7 the option that should be used with startarch.

@damionx7
Copy link
Author

damionx7 commented Sep 6, 2020

This must have been a catch 22 situation for you.

The solution you selected is simply awesome. I really like the idea of elogin and login.

@SDRausty
Copy link
Owner

SDRausty commented Sep 6, 2020

a catch 22 situation

It still is; But the most difficult hurdle seems overcome! However, the Termux PATH had to be dropped again. There must be an easy way to add it to the new login. Termux PATH collision with gcc (clang is installed, but gcc is not) and probably more programs when using yay and makeyay was one reason. The gcc package wants the --link2symlink option to be able to install in Arch Linux in Termux PRoot.

Another one is that reimplementation was consuming a lot of time, and I was not able to reimplement it. The new login is not designed to build and install packages with yay as the --link2symlink option is not present. So collisions should be trivial, if any as this login is not designed to build and install packages with yay. @sudomain could you see how Termux PATH can be implemented in the proot init string PROOTSTMNTU and probably completely removed from the .bash_profile file.

The solution you selected is simply awesome. I really like the idea of elogin and login.

I am really glad you like it @damionx7; I spent quite a lot of time thinking about this aspect of the catch 22. Thank you very much for helping! I hope many more users will enjoy this new feature too.

@me67141
Copy link

me67141 commented Jul 29, 2021

Am having the same issue and I can even access git on termux

@me67141
Copy link

me67141 commented Jul 29, 2021

Are my details here on GitHub the same. The name I will be using is it the as git

@SDRausty
Copy link
Owner

SDRausty commented Aug 2, 2021

startarch h | grep -w git

startarch e[login|user] user login as user. Use alternate elogin and euser options to login as user. This option is preferred for working with programs that have already been installed, and for working with the 'git' command. Please use startarch c 'addauser user' first to create this user and the user's home directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants