Query regarding chroot environment during linux installation

sudhirgoogle
sudhirgoogle used Ask the Experts™
on
Hello,

The following statement mention in section Kickstart installation from Redhat guide.

"The post-install script is run in a chroot environment; therefore, performing tasks such as copying scripts or RPMs from the installation media do not work."

What is the reason behind this behavior ?? why cann't we copy files in chroot environment ? we can give full path of chroot environment when coping right ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Top Expert 2013
Commented:
>> we can give full path of chroot environment when copying  <<

True, but this only comes into play when copying from outside into the chroot jail.

In your case the script runs from inside the chroot jail and thus can't see anything outside, including the installation media mount point or /dev entry.

wmp

Author

Commented:
Thanks for your quick response. Okay During the post section of the linux installation, what is the full path of the post script when it runs ?? and what is the full path of actually ' / ' directory. what is the path of mounted dvd disk?

 if you don't mind can you please explain me with some example, i will be very thankful to you.

Author

Commented:
As per my understanding during linux installation, dvd rom disc is mounted to /mnt/source and the actual ' / ' root file-system is mounted to /mnt/sysimage/.
Most Valuable Expert 2013
Top Expert 2013

Commented:
You're chrooted to /mnt/sysimage

The post-installation script is at the end of your kickstart file (the %post section).

If you have particular needs which cannot be accomplished inside the chroot environment  just add
"--nochroot" after "%post", so you won't get jailed.

%post --nochroot

To your last comment:

Yes, correct, and that's why you cant see /mnt/source, because your actual "/" is below /mnt/sysimage.

Author

Commented:
As per my understanding during linux installation, dvd rom disc is mounted to /mnt/source and the actual ' / ' root file-system is mounted to /mnt/sysimage/.

Lets say for example i have folder called ABC in top-level directory of the Linux installation DVD disc, i want that ABC folder to be copied to /opt directory at the end of the installation and i want to achieve this via kick-start % post section.

lets say i have mention following lines in my ks.cfg file

%post
cp -R /mnt/source/ABC /opt


the above command will fail during the post installation because  %post section runs in chroot environment, and /mnt/source/ABC is actually mean /mnt/sysimage/mnt/source/ABC which doesn't exist, so the copy command fails.

In this scenario we should give like this..

%post --nochroot
cp -R /mnt/source/ABC /mnt/sysimage/opt


now during post installation the command will successfully run because it runs outside of the chroot environment.

This is my understanding. correct me if i am wrong or missed something. Thanks in advance.
Most Valuable Expert 2013
Top Expert 2013

Commented:
Yes, that's all correct!

Please note that  I suggested the "%post --nochroot" method already in my comment #37865019 above!

Good luck!

wmp

Author

Commented:
Thanks for your solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial