termux / proot-distro

An utility for managing installations of the Linux distributions in Termux.
GNU General Public License v3.0
1.69k stars 197 forks source link

[Bug]: Cannot run pkg command as root #359

Closed Drjacky closed 10 months ago

Drjacky commented 10 months ago

Problem description

Screenshot 2023-11-05 at 10 56 40

What steps will reproduce the bug?

Run pkg update

What is the expected behavior?

No response

Drjacky commented 10 months ago

Replace pkg with apt

TomJo2000 commented 10 months ago

This is actually intentional to save you from significant amounts of pain.

Yes you can run apt as root, but any package installed as root won't be accessible to a regular user and running apt as root may potentially overwrite files unintentionally.

sylirre commented 10 months ago

By default PRoot-Distro merges Termux environment with Debian, so you have pkg available in PATH. However due to numerous issues reported by rooted device owners, we had to restrict usage of apt/pkg when UID is 0 (root user).

So you can't use Termux apt or pkg under proot environment when the current user is root.

You need to use apt instead. Due to PATH content structure, you'll always pick the apt package manager from Debian rather than from Termux.

This issue is not a bug.