termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
751 stars 161 forks source link

How do i automatically log into proot at termux startup ( Question ) #146

Closed xd003 closed 3 years ago

xd003 commented 3 years ago

Just as the title suggests , i just want to log into the ubuntu proot automatically at termux startup I tried appending proot-distro login ubuntu-20.04 in my .zshrc file ( i am using zsh so there's no bashrc file ) but it doesn't seem to help . Can anyone please tell the correct way to achieve this ?

ZhymabekRoman commented 3 years ago

Instead of typing proot-distro login ubuntu-20.04 every time, you can just add it to the .bashrc. You can type nano .bashrc in your home directory and then type this: proot-distro login ubuntu-20.04. If the previous method does not work, you can open the /data/data/com.termux/files/usr/bin/login file using nano, delete all file contents except first line, and add exactly on the second line proot-distro login ubuntu-20.04

xd003 commented 3 years ago

@ZhymabekRoman thanks for help Since i was using zsh as mentioned , i had .zshrc file in my home directory ( and not bashrc ) .So appending proot-distro login ubuntu-20.04 in zshrc didn't seemed to work

Although your second method of removing all content of data/data/com.termux/files/usr/bin/login except first line and appending proot login in 2nd line did worked well

Although i noticed after i open termux , it takes around 2-3 seconds to log into proot. Not really sure if this load time is normal or it should have been better

ghost commented 3 years ago

@xd003 Try specifying your proot launch command in $PREFIX/etc/profile.d

I tested it (i am using zsh just like yours) and proot-distro autostarts within zsh


Caveat: echo "proot-distro login ubuntu-20.04" > $PREFIX/etc/profile.d/proot-autostart.sh

Although in some scenarios, you may have to use emulate command as well

ZhymabekRoman commented 3 years ago

Although your second method of removing all content of data/data/com.termux/files/usr/bin/login except first line and appending proot login in 2nd line did worked well

Are you sure? Maybe you just didn't notice. This method works fine for me

xd003 commented 3 years ago

Although your second method of removing all content of data/data/com.termux/files/usr/bin/login except first line and appending proot login in 2nd line did worked well

Are you sure? Maybe you just didn't notice. This method works fine for me

I am sorry but i think there's a bit of confusion xd. I already told the second method of /usr/bin/login works . I am just saying that proot login isn't as instant or fast like loading Termux natively , it takes around 2,3 seconds. I am now beginning to beleive that's normal

xd003 commented 3 years ago

@xd003 Try specifying your proot launch command in $PREFIX/etc/profile.d

I tested it (i am using zsh just like yours) and proot-distro autostarts within zsh

Caveat: echo "proot-distro login ubuntu-20.04" > $PREFIX/etc/profile.d/proot-autostart.sh

Although in some scenarios, you may have to use emulate command as well

Thanks both of your suggestions work pretty well too. I think i will close this issue concluding that logging into proot at startup can't be as fast as loading termux natively and its bound to take 2,3 seconds