LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Arch (https://www.linuxquestions.org/questions/arch-29/)
-   -   Get into chroot and ensure Bash is behaving as it was (https://www.linuxquestions.org/questions/arch-29/get-into-chroot-and-ensure-bash-is-behaving-as-it-was-4175724379/)

BudiKusasi 04-23-2023 05:46 AM

Get into chroot and ensure Bash is behaving as it was
 
How to get into chroot while keep Bash behavior settings, and important tools else, fully working intact ?

teckk 04-23-2023 10:31 AM

Uhh what?

https://man.archlinux.org/man/arch-chroot.8
https://wiki.archlinux.org/title/Chroot

wpeckham 04-23-2023 11:24 AM

Quote:

Originally Posted by BudiKusasi (Post 6426493)
How to get into chroot while keep Bash behavior settings, and important tools else, fully working intact ?

After chroot the entire system is limited. Your running shell will continue to behave properly, but you may have access to only the external tools that you have provided to the chroot.

What are you trying to use chroot for? What is it that causes your concern?

xlfs-0.2 05-03-2023 12:59 AM

/etc

contains many shell poisons. avoid them all!

also your ~/home/name. your chroot has to specify home director for user in /etc/passwords and it must have any .bashrc in the $HOME

for chroot you may need to do this: (chroot -i should do it?)

# . /etc/profile

your system profile should NOT have even a single false statement and have 0 i mean no text output - or bash will choke and login won't be normal or even fail. The same goes for X11 startup - a fact documented (in the past) pretty good.

that will do it. assuming your chroot supports TTY color like the parent does and is basically compatible with the running kernel. (i assume it does)

# . /etc/profile

depends on your shell. chroot executes bash(1) but may not be "interactive". (you can hack if it is in /etc/profile but don't make any mistake like "making it interactive when it shouldn't be" !!!)

(for older linux not hacked ubuntu!) WHEN getty(1) activates login(1) activates bash interactive.

DO NOT TRY LOGIN IN THE CHROOT unless you know what your doing. You'll be booted out freeze your pc maybe :)

So there you go. Bash runs ". /etc/profile" (if it exists) and if interactive.

but don't hack "always interactive" you'll mess things up.

perhaps recompile chroot to have a -I interactive option.

I know: have a different BASH which is always interactive, and do

# cd /bin ; ln -sf bash_I sh

then chroot is always interactive (this assumes you have a bash binary that by name knows it's interactive - but idk if it does that)

or hack chroot to support an -I option


All times are GMT -5. The time now is 10:12 PM.