Magisk-Modules-Alt-Repo / chroot-distro

install linux distributions on android
GNU General Public License v3.0
83 stars 7 forks source link

Adb shell: uninstalling breaks at least termux #17

Closed crypto-the-great closed 3 weeks ago

crypto-the-great commented 1 month ago

I have installed fedora Linux on my moto g stylus 2021 with chroot-distro, however at the end of installing, it spat out an error "chroot: exec /bin/su no such file or directory". This same error message shows when I run the login command, when I attempted to uninstall fedora, I got endless numbers of permission denied errors speeding across my screen, after a while I ctrl + c'ed it to only find that after a restart my termux I was shown a file not found error and my only choice was to exit termux. I needed to re install termux, busybox, and chroot-distro to get it back up and running.

Dlazder commented 1 month ago

Before deleting the distribution, I can advise you to reboot the phone, and only then delete the folder. When I don't do this, my phone freezes and I have to forcefully turn off the phone. In the case of using the "chroot-distro uninstall " command, I had no problems stopping the process.

jjkola commented 1 month ago

This problem is with v1.0.0. This will be corrected with the next release which will be hopefully available this week.

Also, in your case you were quite lucky as it only broke Termux. In my case it broke the tablet and nuked the SD card, and I had to reset to factory settings to get the tablet in working condition. Fortunately the SD card was backed up so no harm done other than lost time.

crypto-the-great commented 1 month ago

In my case it broke the tablet and nuked the SD card

it WHAT, how did it get past testing? i was just about to try it again so im glad that i read this comment first, but if it is a problem with the version of chroot distro should i just install an older ver of it? or would that be worse?

jjkola commented 1 month ago

There is currently only one release which is what is available at this repo.

If you reboot the device before uninstalling then it will work correctly. The problem manifests itself when you have installed, restored, run a command or done a login before uninstalling. All of those actions will mount system mount points which in itself is not a problem as uninstall will unmount those. The problem comes from mounting /data folder to rootfs because this will create a circular reference as chroot-distro data is located under /data/local/chroot-distro. The problem can be remedied by rebooting the device or by manually unmounting data-folder from rootfs before uninstalling.

I would assume that the reason it was not found during development is that if you are using chroot-distro as magisk module then you have to constantly reboot the device during development to be able to update the script. At least I did that and it was most likely unnecessary as I could have just pushed the new script as is and use it directly given the simplicity of chroot-distro.

jjkola commented 1 month ago

And, this problem is with v1.0.0, the development version which I instructed to use does not have this problem as far as I know (I tried really hard to fix this problem). My fixes as already been incorporated into main branch so using the latest main branch commit should be safe. As soon as we (me and Yasser) get the release process hammered I think we will release a new version which should address this issue among the other fixes.

jjkola commented 1 month ago

Both of the linked PRs have changes which should help with this issue.

crypto-the-great commented 1 month ago

so sorry for the late reply i feel bad for not updating yall but after a slight scare with uninstalling fedora (after updating chroot-distro) i was able to login after running reinstall on fedora. its working right now but that "quick scare" i mentioned one sentence ago was quite strange, wondering if someone can figure this out but after trying to uninstall fedora, "find" gave an error, something about infinite loops. and after some time i decided to just restart my phone. apparently that was not the best of ideas as i did not see the usual android 11 power options put a prompt with a strange title that i cant remember as i was very concerned (mainly because of what you said about it breaking peoples phones). the prompt only had two options of shutdown and restart and my screen was occasionally flickering gray.

jjkola commented 1 month ago

No problem. Sounds strange, it should not happen anymore with the latest changes unless there is something else affecting the situation. Since there was notification about infinite loops then system mount points have not properly unmounted and more specifically /data folder has not been unmounted.

Are you sure you were using the latest development version? The easy way to identify that is whether chroot-distro install <distro> complains about grep parameters or not (in older version there is a warning).

jjkola commented 1 month ago

Reopened the issue to verify the possible problem.

crypto-the-great commented 1 month ago

hi, you were right about the whole unmounting thing as after a while of not touching termux for a while (a different project took my attention) it started having the same problems again, but all i needed to do was run chroot-distro unmount fedora and chroot-distro reinstall fedora

as for the version i am using i just installed straight from the repo with the command you gave me in the last issue to make the actual zip file so i am using the latest version of chroot-distro

crypto-the-great commented 1 month ago

IT DID IT AGAIN, ok so i was adb shell'ed into my phone and in fedora when my cable unpluged, when i went to plug it back in, adb did not see any devices, so i held down the power button to get to the shutdown menu thing and i also unpluged the cable at the same time, my phones screen then showed a box with the title "lockdown" and the usual shutdown options (shutdown and restart), the background was black and the screen was also sometimes flashing black. sorry if this post is worded badly but i wanted to get all the information down as quickly as possible before i forgot

jjkola commented 1 month ago

I have now verified that the problem is with ADB shell. I will split the issue to two separate issues as there is two different problems. First being the installing failing, and the second being that uninstall does not detect the cyclic situation.

jjkola commented 1 month ago

I have now found the reason for the issues. The reason seems to be that when mounting system mount points the code does not check if it has already been mounted, and mount command happily overrides the current mount. This leads to situation where the path has been mounted multiple times but the code assumes that there is only one mount. Thus creating a situation where the code will try to remove things from wrong place thus leading to problems. I have a fix ready for this, and will try to push it as soon as possible.