- IBM i Chroot (version 2)
- Install
- Usage
- Install Software into Chroot
- Remove Chroot
- Advanced
- Chroot Manager
- Resources
Chroot (Change Root) is a PASE command used to change the relative root of a IBM i shell job.
The purpose of this project is to automate and simplifiy chroot environment creation.
To learn more about chroots in PASE view these resources
This project is available via RPM
yum install ibmichroot
For more information about yum read the docs
Before running chroot_setup ensure you have proper permissions first!
-
Minimum of
*IOSYSCFGto create device nodes -
*ALLOBJneeded to runyum.
Usage: chroot_setup [OPTIONS] CHROOT DIRECTORY [CHROOT TYPE]
[Options] - optional additonal arguments listed below
-v: More verbose output.
-y: Auto respond yes to the prompts.
-g: Dynamic global variables.
-i: yum install into chroot.
CHROOT DIRECTORY - is the Directory where the chroot will be created.
This parameter is required and chroot directory path must begin with /QOpenSys/
[CHROOT TYPE] - is specified by the .lst config files located within /chroot
within this project.
This parameter is optional, when undefined a chroot with minimal with includes
will be created.
Full file names are not required when specifying the [CHROOT TYPE]
- chroot_minimal.lst OR minimal will work
Creating a minimal chroot:
chroot_setup /QOpenSys/root_pathThe .lst files that start with chroot... are meant for creating chroot
environments based on specific needs.
For example, you can create a bare minimum chroot environment with
chroot_minimal.lst.
Or you could add multiple *.lst files together to create an environment with
many features.
Visit config to see an
exhaustive list of chroot_xxxx.lst files.
After Creating a chroot with minimal and includes configuration you can useyum
to install into your chroot.
It's recommended to install bash within your chroot as well. You can do so with:
yum --installroot=/QOpenSys/root_path install bashPackages such as Node.js can be installed by invoking:
yum --installroot=/QOpenSys/root_path install nodejs8As a convinence you can use -i option:
chroot_setup -i bash /QOpenSys/root_pathNote
If you plan to access DB2 from python, node.js, etc from within the chroot
iconv conversion tables provided from nls.lst is required.
chroot_setup /QOpenSys/root_path nlsRemove a chroot just like you would remove any other directory by running:
rm -r path_to_chroot🚨 WARNING: Ensure the path to the chroot is correct before
running rm. 🚨
You can pass in any named variable to chroot_setup.sh so you can have
replacement values in xxxxx.lst files.
For example:
In your custom .lst file you could have this:
:system
CHGAUT OBJ('mydir') USER(myuser) DTAAUT(*RWX) OBJAUT(*ALL) SUBTREE(*ALL)
chroot_setup -g myuser=AARON -g mydir=/QOpenSys/root_path /QOpenSys/root_path /path/to/yourCustom.lstAny instance of myuser would be interpreted as AARON when the script is run.
Same for mydir and /QOpenSys/root_path.
TODO: Document chroot_mgr.py