Link to home
Start Free TrialLog in
Avatar of sudhirgoogle
sudhirgoogle

asked on

Query regarding chroot environment during linux installation

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 ?
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sudhirgoogle
sudhirgoogle

ASKER

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.
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/.
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.
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.
Yes, that's all correct!

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

Good luck!

wmp
Thanks for your solution.