LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch
User Name
Password
Arch This Forum is for the discussion of Arch Linux.

Notices


Reply
  Search this Thread
Old 04-23-2023, 05:46 AM   #1
BudiKusasi
Member
 
Registered: Apr 2017
Distribution: Artix
Posts: 345

Rep: Reputation: 15
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 ?
 
Old 04-23-2023, 10:31 AM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,141
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
Uhh what?

https://man.archlinux.org/man/arch-chroot.8
https://wiki.archlinux.org/title/Chroot
 
Old 04-23-2023, 11:24 AM   #3
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,665

Rep: Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710
Quote:
Originally Posted by BudiKusasi View Post
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?
 
Old 05-03-2023, 12:59 AM   #4
xlfs-0.2
Member
 
Registered: Oct 2022
Posts: 207

Rep: Reputation: 44
/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

Last edited by xlfs-0.2; 05-03-2023 at 01:15 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] BASH - algorithm to ensure any division is even GPGAgent Programming 17 12-30-2018 09:43 AM
Bash is behaving weird inside chroot ReyJavikVI Linux From Scratch 9 08-09-2009 08:48 PM
unclear on how to ensure i get 64bit packages tseiff LinuxQuestions.org Member Intro 4 05-27-2009 06:51 PM
Does a separate boot partition ensure that grub doesn't get deleted easily? samrat_rao Linux - General 1 02-15-2009 02:24 AM
When configuring files, how do I ensure they get to the right directory? fortunekiller Slackware 7 06-15-2006 10:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration