isocut Usage Guide
- isocut Usage Guide
The size of an openEuler image is large, and the process of downloading or transferring an image is time-consuming. In addition, when an openEuler image is used to install the OS, all RPM packages contained in the image are installed. You cannot choose to install only the required software packages.
In some scenarios, you do not need to install the full software package provided by the image, or you need to install additional software packages. Therefore, openEuler provides an image tailoring and customization tool. You can use this tool to customize an ISO image that contains only the required RPM packages based on an openEuler image. The software packages can be the ones contained in an official ISO image or specified in addition to meet custom requirements.
This document describes how to install and use the openEuler image tailoring and customization tool.
Software and Hardware Requirements
The hardware and software requirements of the computer to make an ISO file using the openEuler tailoring and customization tool are as follows:
- The CPU architecture is AArch64 or x86_64.
- The operating system is openEuler 20.03 LTS SP3.
- You are advised to reserve at least 30 GB drive space for running the tailoring and customization tool and storing the ISO image.
The following uses openEuler 20.03 LTS SP3 on the AArch64 architecture as an example to describe how to install the ISO image tailoring and customization tool.
Ensure that openEuler 20.03 LTS SP3 has been installed on the computer.
$ cat /etc/openEuler-release openEuler release 20.03 (LTS-SP3)
Download the ISO image (must be an everything image) of the corresponding architecture and save it to any directory (it is recommended that the available space of the directory be greater than 20 GB). In this example, the ISO image is saved to the /home/isocut_iso directory.
The download address of the AArch64 image is as follows:
Note: The download address of the x86_64 image is as follows:
Create a /etc/yum.repos.d/local.repo file to configure the Yum source. The following is an example of the configuration file. baseurl is the directory for mounting the ISO image.
[local] name=local baseurl=file:///home/isocut_mount gpgcheck=0 enabled=1
Run the following command as the root user to mount the image to the /home/isocut_mount directory (ensure that the mount directory is the same as baseurl configured in the repo file) as the Yum source:
sudo mount -o loop /home/isocut_iso/openEuler-20.03-LTS-SP3-everything-aarch64-dvd.iso /home/isocut_mount
Make the Yum source take effect.
yum clean all yum makecache
Install the image tailoring and customization tool as the root user.
sudo yum install -y isocut
Run the following command as the root user to check whether the tool has been installed successfully:
$ sudo isocut -h Checking input ... usage: isocut [-h] [-t temporary_path] [-r rpm_path] source_iso dest_iso Cut openEuler iso to small one positional arguments: source_iso source iso image dest_iso destination iso image optional arguments: -h, --help show this help message and exit -t temporary_path temporary path -r rpm_path extern rpm packages path
Tailoring and Customizing an Image
This section describes how to use the image tailoring and customization tool to create an image by tailoring or adding RPM packages to an openEuler image.
isocut command to use the image tailoring and customization tool. The command format is as follows:
isocut [ –help | -h ] [ -t <temp_path> ] [ -r <rpm_path> ] < source_iso > < dest_iso >
|–help | -h||No||Queries the help information about the command.|
|-t <temp_path>||No||Specifies the temporary directory temp_path for running the tool, which is an absolute path. The default value is /tmp.|
|-r <rpm_path>||No||Specifies the path of the RPM packages to be added to the ISO image.|
|source_iso||Yes||Path and name of the ISO source image to be tailored. If no path is specified, the current path is used by default.|
|dest_iso||Yes||Specifies the path and name of the new ISO image created by the tool. If no path is specified, the current path is used by default.|
Software Package Source
The RPM packages of the new image can be:
Packages contained in an official ISO image. In this case, the RPM packages to be installed are specified in the configuration file /etc/isocut/rpmlist. The configuration format is software_package_name.architecture. For example, kernel.aarch64.
Specified in addition. In this case, the RPM packages are stored in the path specified by the
-roption when running the
isocutcommand and added to the /etc/isocut/rpmlist configuration file in the format mentioned above.
- When customizing an image, if an RPM package specified in the configuration file cannot be found, the RPM package will not be added to the image.
- If the dependency of the RPM package is incorrect, an error may be reported when running the tailoring and customization tool.
- Do not modify or delete the default configuration items in the /etc/isocut/rpmlist file.
isocutoperations require root permissions.
- The source image to be tailored can be a basic image or everything image. In this example, the basic image openEuler-20.03-LTS-SP3-aarch64-dvd.iso is used.
- In this example, assume that the new image is named new.iso and stored in the /home/result directory, the temporary directory for running the tool is /home/temp, and the additional RPM packages are stored in the /home/rpms directory.
Open the configuration file /etc/isocut/rpmlist and specify the RPM packages to be installed (from the official ISO image).
sudo vi /etc/isocut/rpmlist
Ensure that the space of the temporary directory for running the image tailoring and customization tool is greater than 8 GB. The default temporary directory is** /tmp**. You can also use the
-tparameter to specify another directory as the temporary directory. The path of the directory must be an absolute path. In this example, the /home/temp directory is used. The following command output indicates that the available drive space of the /home directory is 38 GB, which meets the requirements.
$ df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.2G 0 1.2G 0% /dev tmpfs 1.5G 0 1.5G 0% /dev/shm tmpfs 1.5G 23M 1.5G 2% /run tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup /dev/mapper/openeuler_openeuler-root 69G 2.8G 63G 5% / /dev/sda2 976M 114M 796M 13% /boot /dev/mapper/openeuler_openeuler-home 61G 21G 38G 35% /home
Tailor and customize the image.
Scenario 1: All RPM packages of the new image are from the official ISO image.
$ sudo isocut -t /home/temp /home/isocut_iso/openEuler-20.03-LTS-SP3-aarch64-dvd.iso /home/result/new.iso Checking input ... Checking user ... Checking necessary tools ... Initing workspace ... Copying basic part of iso image ... Downloading rpms ... Finish create yum conf finished Regenerating repodata ... Checking rpm deps ... Getting the description of iso image ... Remaking iso ... Adding checksum for iso ... Adding sha256sum for iso ... ISO cutout succeeded, enjoy your new image "/home/result/new.iso" isocut.lock unlocked ...
If the preceding information is displayed, the custom image new.iso is successfully created.
Scenario 2: The RPM packages of the new image are from the official ISO image and additional packages in /home/rpms.
sudo isocut -t /home/temp -r /home/rpms /home/isocut_iso/openEuler-20.03-LTS-SP3-aarch64-dvd.iso /home/result/new.iso
The System Fails to Be Installed Using an Image Tailored Based on the Default RPM Package List
When isocut is used to tailor an image, the /etc/isocut/rpmlist configuration file is used to specify the software packages to be installed.
Images of different OS versions contain different software packages. As a result, some packages may be missing during image tailoring. Therefore, the /etc/isocut/rpmlist file contains only the kernel software package by default, ensuring that the image can be successfully tailored.
The ISO image is successfully tailored using the default configuration, but fails to be installed.
An error message is displayed during the installation, indicating that packages are missing:
The ISO image tailored based on the default RPM package list lacks necessary RPM packages during installation. The missing RPM packages are displayed in the error message, and may vary depending on the version.
Add the missing packages.
- Find the missing RPM packages based on the error message.
- Add the missing RPM packages to the /etc/isocut/rpmlist configuration file.
- Tailor and install the ISO image again.
For example, if the missing packages are those in the example error message, modify the rpmlist configuration file as follows:
```shell $ cat /etc/isocut/rpmlist kernel.aarch64 lvm2.aarch64 chrony.aarch64 authselect.aarch64 shim.aarch64 efibootmgr.aarch64 grub2-efi-aa64.aarch64 dosfstools.aarch64 ```