termux / proot

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

Is it possible to save file ownership in proot? #140

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello, is there a way to save file ownership in proot? something like File Metadata Store in proot just like fakeroot does

In the curiosity, is it possible to add it on proot? or other hacks so it will change the file ownership inside PRoot or any extensions into it?

ghost commented 3 years ago

Nevermind, after googling about proot ownership, i compiled it with -DUSERLAND flag when Compiling proot and it works

I have a curiosity to ask, why this feature isn't enabled by default may i ask?

SDRausty commented 3 years ago

Hi,

I have this question too, "Is it possible to save file ownership in proot?"

SDRausty commented 3 years ago

File ownership is in normal proot version not associated with files, UserLAnd version does that, however that feature is behind compile time switch (-D USERLAND, although I'm usually not testing that version)

Originally posted by @michalbednarski in https://github.com/termux/proot/issues/126#issuecomment-718899710

https://github.com/termux/proot/issues/126

ghost commented 3 years ago

@SDRausty Yes, Clone the proot git,

go to proot/src

Edit the GNUMakeFile

And add -DUSERLAND Flag to CPPFLAGS: https://github.com/termux/proot/blob/336f4787d64e377039143ad2a50139aee4e10ad4/src/GNUmakefile#L17

make V=1

And Profit.

ghost commented 3 years ago

File ownership is in normal proot version not associated with files, UserLAnd version does that, however that feature is behind compile time switch (-D USERLAND, although I'm usually not testing that version)

Originally posted by @michalbednarski in https://github.com/termux/proot/issues/126#issuecomment-718899710

https://github.com/termux/proot/issues/126

Thanks, i already saw that issue, but the ownership emulation works but not perfect

SDRausty commented 3 years ago

Emulation works well

Yes. Emulation works very well. However, QEMU user is defunct with PRoot. Please see:

https://github.com/termux/proot/issues/141

ghost commented 3 years ago

Thank you for your cooperation @SDRausty but qemu-user is not nearly perfect in proot (i eventually lost motivation when running x86 as it's super slow and causes segfaults),

As for that, system emulation is preferable (yet slow but stable than user mode in overall)

SDRausty commented 3 years ago

You are very welcome @WMCB-Tech:

super slow and causes segfaults

Speed and stability:

aThe other question is, how much faster would be to execute Linux with complete kernel on Usermode variant of Qemu on Android devices without Kqemu kernel module. If complex programmers work based on porting Qemu user mode variant to Termux would have The sense when comparing The amount ot of efford needed. Zephir will very probably know The answer, because he has ported many complex C and C++ apps to Termux. And his programmers C and C++ deep development knowledge are good to give us The best answer.

I have seen many projects, which have tried to allow Android users to use Linux. Non rooted devices have some limitations. When using cross emulated distributions, for now, it is very probably really The best option to use Proot with Qemu in visual mode as MR Rausty has implemented. It is The best compromise related to system stability and possible speed without Kqemu.

Originally posted by @JanuszChmiel in https://github.com/TermuxArch/TermuxArch/issues/34#issuecomment-748055801

Some of the segfaults appeared to be Android permission related. BTW the command mkfifo -m o+w /tmp/tmp_random was corrected and working. Do you think this could be related to newly arisen proot info: vpid 1: terminated with signal 11 #141?

SDRausty commented 3 years ago

CPPFLAGS += -DUSERLAND -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I. -I$(VPATH)

make V=1

[user15:01src]$ make CC tracee/reg.o ./tracee/reg.c: In function ‘get_systrap_size’: ./tracee/reg.c:387:28: error: ‘struct user_regs’ has no member named ‘ARM_cpsr’ 387 | if (tracee->_regs[CURRENT].ARM_cpsr & PSR_T_BIT) { | ^ ./tracee/reg.c:387:40: error: ‘PSR_T_BIT’ undeclared (first use in this function) 387 | if (tracee->_regs[CURRENT].ARM_cpsr & PSR_T_BIT) { | ^~~~~ ./tracee/reg.c:387:40: note: each undeclared identifier is reported only once for each function it appears in make: *** [GNUmakefile:192: tracee/reg.o] Error 1

ghost commented 3 years ago

@SDRausty This should be done on Termux Environment (or Termux docker image) and not inside proot, as it's patched for Termux anyway

And you should have the dependencies installed for proot build and runtime:

libtalloc, make

JanuszChmiel commented 3 years ago

Every Proot variant available on The Internet has its cons and pros.

Userland variant is not being updated so frequently as A Termux variant. For example, partial case file system insensitivity on some Huawei devices is not incorporated to The compiled Proot for Userland. It is The reason, why I like Proot Termux variant The best. Even some new memory shared functions are now directly incorporated in to Termux Proot source. Sure, we are living in a freedom world, so every one has A full freedom to experiment and even modify Proot source, compilation building scripts and build configurations. On my case, I rather let those thinks on real absolvent of informatic sciences like MR Rausty, Pliush and others are. Because Proot is not a little toy for playing.

And I also can not help myself. Proot without Qemu is still the fastest possible execution of Linux apps on every Android device. Sure. Some tasks do not require so much Cpu resources, so for some specific tasks Qemu speed is enough. But really, it is not good for running desktop environment. Or for interprocess intensive communication which AT-SPI and Orca screen reader do. But Qemu emulated distributions can be used to build some packages, to run some little server admin based tasks or for remote Github repositories administration.

SDRausty commented 3 years ago

@WMCB-Tech thank you for mentoring; the build of proot patched for Termux + compile time switch -D USERLAND went flawlessly including install 🎵 🎶 🚀 🎸

SDRausty commented 3 years ago

Userland variant is not being updated so frequently as A Termux variant

Thank you for providing input @JanuszChmiel; should the procedure of building and installing proot with the Userland variant be automated and integrated into the TermuxArch visualorca option?

JanuszChmiel commented 3 years ago

It is A good question. Do you think, that it would not be better to wait for official Proot update for Termux? If proot variant for Userland have some advantages, it would not be problém. But for my specific HUAwei 10 mate Lite I should rather use Proot for Termux. Because it support file operations also on this model. I AM afraid, that Proot variant for Userland will lack this important support, so I would had to have The files problems like before Proot update from MR Bednarski, who have solved The partial case file systém insensitivity problém on my device model. Sure, many other mobile phones may be do not have this problém with files. Proot code contain special routine which automatically decide, which work around should Proot to enable. And I must also remember on latest up to date shared memory support, which is working perfectly for Proot variant for Termux.

SDRausty commented 3 years ago

Do you think, that it would not be better to wait for official Proot update for Termux?

The command taprootuserland.bash attempts to automate building and installing proot with the -D USERLAND option enabled.

ghost commented 3 years ago

Thank you @SDRausty, but it seems Userland does not use this anymore but thanks for implementing the unused proot feature

corbinlc commented 3 years ago

We don't use it anymore in UserLAnd because it results in a significant performance hit. The average person wants the performance more than they need the real file ownership to be correct. There is probably some middle ground, but it should be optional to avoid the performance penalty when not needed.

ghost commented 3 years ago

Huh, but when i try it, it didn't cause any significant performance loss

ghost commented 3 years ago

ig this issue should be closed as i no longer use it,

JanuszChmiel commented 3 years ago

I have A last remark to this topic. Userland developers have reprogrammed Proot so it is compiled as a native .so library. Unfortunately some very useful Proot source code updates, which are The part of Proot sources for Termux have not been applied. For example, partial case file systém insensitivity or Pokedata problém in some Android kernels. I have A solution. It is possible to use Proot for Termux from Termux in this case. Because not every Android kernel and file systém suffers because of some goodly implemented routines for Proot Termux. The positive fact is, that Userland variant of Proot can be used to test file systém and mainly Android kernel compatibility for Proot routines. If file systém extraction fails, every user can have A ensurance, that some work around of Proot must be used. So his systém could be supported by Proot for Termux, but it means some penaltyes. Because it is not standard operation, it is very unlike that Android device manufacturer would give such answers before somebody would buy The Android device. If some specific sys calls are compatible with Proots. So it is always a little adventure. Buy and test.

Every programmers approach has its PROS and cons. For example, I Am using Huavei 10 Mate lite and its systém have issues with partial case file systém insensitivity, and there is also other problems. But thanks to Proot for Termux, I can run many Linux distributions. One very kind C programmer have even implemented shared memory functions and it is possible to run even this kind of apps.

Sure. Execution of Linux distributions will be always The best, if Proot do not have to execute work arounds to overcome some build in system issues. But I do not know about better solution. Because even if you Root yours device, you will share hardware and software resources between Linux distribution and Android kernel and other modules.

So Proot is according to my opinion The best possible compromise when balancing security and usability. If some user without too much knowledge would root his device, user can end with unstable systém. Especially if user would try to install some Android kernel module. I have bad experience with such experiments even while working with real Linux kernels. Modules have software relation ships between each others. The dsimilar dangerous experiments are if somebody would start to experiment with Power management and CPufreq. Proot do not allow that so Android kernel and its background Binary services have full control on Android device. So there is no big risk to overburn The board of Android device.

Because it is even possible to run such complex apps like Orca and mate desktop is, I can tell responsively, that Proot have much more PROS than cons. And advanced programmers can extend it if there is An error.

SDRausty commented 2 years ago

The command taprootuserland.bash attempts to automate building and installing proot with the -D USERLAND option enabled.

@Grimler91 @wmcbtech30 @agnostic-apollo I must ask after reviewing this issue I participated in, "Why are all my comments minimized here in this issue and elswhere?"

What is the logic here?

Grimler91 commented 2 years ago

I don't know/remember who hid comments here, most likely they were considered off-topic