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

packages that uses user doesn't work anymore after reinstalling #2080

Closed
CutieRei opened this issue May 23, 2021 · 5 comments
Closed

packages that uses user doesn't work anymore after reinstalling #2080

CutieRei opened this issue May 23, 2021 · 5 comments

Comments

@CutieRei
Copy link

CutieRei commented May 23, 2021

just a few minutes ago i was backing up my data and restoring it in a new termux installed from f-droid and after that packages that uses my user doesn't work because user u0_a615 does not exists on the packages like postgresql and such is there a way to fix this or am i supposed to drop all of my datas

@ghost
Copy link

ghost commented May 23, 2021

that packages that uses my user doesn't work because user u0_a615 does not exists

Expected behaviour. User is assigned by Android OS and there no way to avoid that. Never restore data as root and you won't have uid/gid mismatch.

Use backup/restore method exactly as in https://wiki.termux.com/wiki/Backing_up_Termux

postgresql and such is there a way to fix this or am i supposed to drop all of my datas

Postgresql database shouldn't depend on system user name. You are not providing the error messages, so it is unknown what the issue with Postgresql.

@ghost ghost closed this as completed May 23, 2021
@CutieRei
Copy link
Author

CutieRei commented May 23, 2021

i guess im gonna drop my data then, also thanks for the extra info for the user its helpful so i dont do anymore mistake except for myself. thanks for the response have a great day

@agnostic-apollo
Copy link
Member

You can try something like this to restore permissions.

@CutieRei
Copy link
Author

ill try opening it tomorrow with a vpn since my country blocks reddit for safety reason

@agnostic-apollo
Copy link
Member

agnostic-apollo commented May 23, 2021

Oh boy...

To change ownership to termux app user and restore selinux contexts for $PREFIX and $HOME, you can do something like the following from a non-root failsafe session. Note that id -u must expand in the current non-root shell, outside su root shell, to get the current/new user of termux, so don't run the following commands if you are already inside a root shell started with su/sudo. A fresh fail safe session will be a non-root shell as the current termux user.

path=/data/data/com.termux/files/usr; su -c "chown $(id -u):$(id -u) -R $path; restorecon -Rv $path"
path=/data/data/com.termux/files/home; su -c "chown $(id -u):$(id -u) -R $path; restorecon -Rv $path"

This may affect programs that require root owned files instead of termux app user owned, like ~/.ssh if you use ssh from a root shell. It would depend on your setup, we can't make guesses what may break. If messing with root, you are also less likely to get "official" support from @termux for personal issues.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants