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 ?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
ASKER
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/A BC 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.
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/A
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
Please note that I suggested the "%post --nochroot" method already in my comment #37865019 above!
Good luck!
wmp
ASKER
Thanks for your solution.
ASKER
if you don't mind can you please explain me with some example, i will be very thankful to you.