Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]

13 Python API

Note
Note

This API documentation covers KIWI NG 9.25.12

13.1 kiwi Package

13.1.1 Submodules

13.1.2 kiwi.app Module

kiwi.app.App

Bases: object

Implements creation of task instances

Each task class implements a process method which is called when constructing an instance of App

13.1.3 kiwi.cli Module

kiwi.cli.Cli

Bases: object

Implements the main command line interface

An instance of the Cli class builds the entry point for the application and implements methods to load further command plugins which itself provides their own command line interface

kiwi.cli.Cli.get_command

Extract selected command name

Returns

command name

Return type

str

kiwi.cli.Cli.get_command_args

Extract argument dict for selected command

Returns

Contains dictionary of command arguments

{
    '--command-option': 'value'
}

Return type

dict

kiwi.cli.Cli.get_global_args

Extract argument dict for global arguments

Returns

Contains dictionary of global arguments

{
    '--global-option': 'value'
}

Return type

dict

kiwi.cli.Cli.get_servicename

Extract service name from argument parse result

Returns

service name

Return type

str

kiwi.cli.Cli.invoke_kiwicompat

Execute kiwicompat with provided legacy KIWI command line arguments

Example:

invoke_kiwicompat(
    '--build', 'description', '--type', 'vmx',
    '-d', 'destination'
)
Parameters

compat_args () – legacy kiwi command arguments

kiwi.cli.Cli.load_command

Loads task class plugin according to service and command name

Returns

loaded task module

Return type

object

kiwi.cli.Cli.show_and_exit_on_help_request

Execute man to show the selected manual page

13.1.4 kiwi.command Module

kiwi.command.Command

Bases: object

Implements command invocation

An instance of Command provides methods to invoke external commands in blocking and non blocking mode. Control of stdout and stderr is given to the caller

kiwi.command.Command.call

Execute a program and return an io file handle pair back. stdout and stderr are both on different channels. The caller must read from the output file handles in order to actually run the command. This can be done using the CommandIterator from command_process

Example:

process = Command.call(['ls', '-l'])
Parameters
  • command () – command and arguments

  • custom_env () – custom os.environ

Returns

Contains process results in command type

command(
    output='string', output_available=bool,
    error='string', error_available=bool,
    process=subprocess
)

Return type

namedtuple

kiwi.command.Command.run

Execute a program and block the caller. The return value is a hash containing the stdout, stderr and return code information. Unless raise_on_error is set to false an exception is thrown if the command exits with an error code not equal to zero

Example:

result = Command.run(['ls', '-l'])
Parameters
  • command () – command and arguments

  • custom_env () – custom os.environ

  • raise_on_error () – control error behaviour

  • stderr_to_stdout () – redirects stderr to stdout

Returns

Contains call results in command type

command(output='string', error='string', returncode=int)

Return type

namedtuple

kiwi.command.command_call_type

Bases: tuple

kiwi.command.command_call_type.error

Alias for field number 2

kiwi.command.command_call_type.error_available

Alias for field number 3

kiwi.command.command_call_type.output

Alias for field number 0

kiwi.command.command_call_type.output_available

Alias for field number 1

kiwi.command.command_call_type.process

Alias for field number 4

kiwi.command.command_type

Bases: tuple

kiwi.command.command_type.error

Alias for field number 1

kiwi.command.command_type.output

Alias for field number 0

kiwi.command.command_type.returncode

Alias for field number 2

13.1.5 kiwi.command_process Module

kiwi.command_process.CommandIterator

Bases: object

Implements an Iterator for Instances of Command

Parameters

command () – instance of subprocess

kiwi.command_process.CommandIterator.get_error_code

Provide return value from processed command

Returns

errorcode

Return type

int

kiwi.command_process.CommandIterator.get_error_output

Provide data which was sent to the stderr channel

Returns

stderr data

Return type

str

kiwi.command_process.CommandIterator.get_pid

Provide process ID of command while running

Returns

pid

Return type

int

kiwi.command_process.CommandIterator.kill

Send kill signal SIGTERM to command process

kiwi.command_process.CommandProcess

Bases: object

Implements processing of non blocking Command calls

Provides methods to iterate over non blocking instances of the Command class with and without progress information

Parameters
  • command () – instance of subprocess

  • log_topic () – topic string for logging

kiwi.command_process.CommandProcess.create_match_method

create a matcher function pointer which calls the given method as method(item_to_match, data) on dereference

Parameters

method () – function reference

Returns

function pointer

Return type

object

kiwi.command_process.CommandProcess.poll

Iterate over process, raise on error and log output

kiwi.command_process.CommandProcess.poll_and_watch

Iterate over process don’t raise on error and log stdout and stderr

kiwi.command_process.CommandProcess.poll_show_progress

Iterate over process and show progress in percent raise on error and log output

Parameters
  • items_to_complete () – all items

  • match_method () – method matching item

kiwi.command_process.CommandProcess.returncode

13.1.6 kiwi.defaults Module

kiwi.defaults.Defaults

Bases: object

Implements default values

Provides static methods for default values and state information

kiwi.defaults.Defaults.get

Implements get method for profile elements

Parameters

key () – profile keyname

Returns

key value

Return type

str

kiwi.defaults.Defaults.get_archive_image_types

Provides list of supported archive image types

Returns

archive names

Return type

list

kiwi.defaults.Defaults.get_bios_image_name

Provides bios core boot binary name

Returns

name

Return type

str

kiwi.defaults.Defaults.get_bios_module_directory_name

Provides x86 BIOS directory name which stores the pc binaries

Returns

directory name

Return type

str

kiwi.defaults.Defaults.get_boot_image_description_path

Provides the path to find custom kiwi boot descriptions

Returns

directory path

Return type

str

kiwi.defaults.Defaults.get_boot_image_strip_file

Provides the file path to bootloader strip metadata. This file contains information about the files and directories automatically striped out from the kiwi initrd

Returns

file path

Return type

str

kiwi.defaults.Defaults.get_buildservice_env_name

Provides the base name of the environment file in a buildservice worker

Returns

file basename

Return type

str

kiwi.defaults.Defaults.get_common_functions_file

Provides the file path to config functions metadata.

This file contains bash functions used for system configuration or in the boot code from the kiwi initrd

Returns

file path

Return type

str

kiwi.defaults.Defaults.get_container_base_image_tag

Provides the tag used to identify base layers during the build of derived images.

Returns

tag

Return type

str

kiwi.defaults.Defaults.get_container_compression

Provides default container compression

Returns

True

Return type

bool

kiwi.defaults.Defaults.get_container_image_types

Provides list of supported container image types

Returns

container names

Return type

list

kiwi.defaults.Defaults.get_custom_rpm_bootstrap_macro_name

Returns the rpm bootstrap macro file name created in the custom rpm macros path

Returns

filename

Return type

str

kiwi.defaults.Defaults.get_custom_rpm_image_macro_name

Returns the rpm image macro file name created in the custom rpm macros path

Returns

filename

Return type

str

kiwi.defaults.Defaults.get_custom_rpm_macros_path

Returns the custom macros directory for the rpm database.

Returns

path name

Return type

str

kiwi.defaults.Defaults.get_default_boot_mbytes

Provides default boot partition size in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_default_boot_timeout_seconds

Provides default boot timeout in seconds

Returns

seconds

Return type

int

kiwi.defaults.Defaults.get_default_bootloader

Return default bootloader name which is grub2

Returns

bootloader name

Return type

str

kiwi.defaults.Defaults.get_default_container_created_by

Provides the default ‘created by’ history entry for containers.

Returns

the specific kiwi version used for the build

Return type

str

kiwi.defaults.Defaults.get_default_container_name

Provides the default container name.

Returns

name

Return type

str

kiwi.defaults.Defaults.get_default_container_subcommand

Provides the default container subcommand.

Returns

command as a list of arguments

Return type

list

kiwi.defaults.Defaults.get_default_container_tag

Provides the default container tag.

Returns

tag

Return type

str

kiwi.defaults.Defaults.get_default_disk_start_sector

Provides the default initial disk sector for the first disk partition.

Returns

sector value

Return type

int

kiwi.defaults.Defaults.get_default_efi_boot_mbytes

Provides default EFI partition size in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_default_efi_partition_table_type

Provides the default partition table type for efi firmwares.

Returns

partition table type name

Return type

str

kiwi.defaults.Defaults.get_default_firmware

Provides default firmware for specified architecture

Parameters

arch () – machine architecture name

Returns

firmware name

Return type

str

kiwi.defaults.Defaults.get_default_inode_size

Provides default size of inodes in bytes. This is only relevant for inode based filesystems

Returns

bytesize value

Return type

int

kiwi.defaults.Defaults.get_default_legacy_bios_mbytes

Provides default size of bios_grub partition in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_default_live_iso_root_filesystem

Provides default live iso root filesystem type

Returns

filesystem name

Return type

str

kiwi.defaults.Defaults.get_default_live_iso_type

Provides default live iso union type

Returns

live iso type

Return type

str

kiwi.defaults.Defaults.get_default_package_manager

Returns the default package manager name if none is configured in the image description

Returns

package manager name

Return type

str

kiwi.defaults.Defaults.get_default_packager_tool

Provides the packager tool according to the package manager

Parameters

package_manager () – package manger name

Returns

packager tool binary name

Return type

str

kiwi.defaults.Defaults.get_default_prep_mbytes

Provides default size of prep partition in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_default_uri_type

Provides default URI type

Absolute path specifications used in the context of an URI will apply the specified default mime type

Returns

URI mime type

Return type

str

kiwi.defaults.Defaults.get_default_video_mode

Uses auto mode for default video. See get_video_mode_map for details on the value depending which bootloader is used

Returns

auto

Return type

str

kiwi.defaults.Defaults.get_default_volume_group_name

Provides default LVM volume group name

Returns

name

Return type

str

kiwi.defaults.Defaults.get_disk_format_types

Provides supported disk format types

Returns

disk types

Return type

list

kiwi.defaults.Defaults.get_disk_image_types

Provides supported disk image types

Returns

disk image type names

Return type

list

kiwi.defaults.Defaults.get_dracut_conf_name

Provides file path of dracut config file to be used with KIWI

Returns

file path name

Return type

str

kiwi.defaults.Defaults.get_ec2_capable_firmware_names

Provides list of EC2 capable firmware names. These are those for which kiwi supports the creation of disk images bootable within the Amazon EC2 public cloud

Returns

firmware names

Return type

list

kiwi.defaults.Defaults.get_efi_capable_firmware_names

Provides list of EFI capable firmware names. These are those for which kiwi supports the creation of an EFI bootable disk image

Returns

firmware names

Return type

list

kiwi.defaults.Defaults.get_efi_image_name

Provides architecture specific EFI boot binary name

Parameters

arch () – machine architecture name

Returns

name

Return type

str

kiwi.defaults.Defaults.get_efi_module_directory_name

Provides architecture specific EFI directory name which stores the EFI binaries for the desired architecture.

Parameters

arch () – machine architecture name

Returns

directory name

Return type

str

kiwi.defaults.Defaults.get_efi_vendor_directory

Provides EFI vendor directory if present

Looks up distribution specific EFI vendor directory

Parameters

root_path () – path to efi mountpoint

Returns

directory path or None

Return type

str

kiwi.defaults.Defaults.get_exclude_list_for_non_physical_devices

Provides the list of folders that are not associated with a physical device. KIWI returns the basename of the folders typically used as mountpoint for those devices.

Returns

list of file and directory names

Return type

list

kiwi.defaults.Defaults.get_exclude_list_for_removed_files_detection

Provides list of files/dirs to exclude from the removed files detection in a delta root build

kiwi.defaults.Defaults.get_exclude_list_for_root_data_sync

Provides the list of files or folders that are created by KIWI for its own purposes. Those files should be not be included in the resulting image.

Returns

list of file and directory names

Return type

list

kiwi.defaults.Defaults.get_exclude_list_from_custom_exclude_files

Provides the list of folders that are excluded by the optional metadata file image/exclude_files.yaml

Returns

list of file and directory names

Parameters

root_dir () – image root directory

Return type

list

kiwi.defaults.Defaults.get_failsafe_kernel_options

Provides failsafe boot kernel options

Returns

list of kernel options

['option=value', 'option']

Return type

list

kiwi.defaults.Defaults.get_filesystem_image_types

Provides list of supported filesystem image types

Returns

filesystem names

Return type

list

kiwi.defaults.Defaults.get_firmware_types

Provides supported architecture specific firmware types

Returns

firmware types per architecture

Return type

dict

kiwi.defaults.Defaults.get_grub_basic_modules

Provides list of basic grub modules

Parameters

multiboot () – grub multiboot mode

Returns

list of module names

Return type

list

kiwi.defaults.Defaults.get_grub_bios_core_loader

Provides grub bios image

Searches distribution specific locations to find the core bios image below the given root path

Parameters

root_path () – image root path

Returns

file path or None

Return type

str

kiwi.defaults.Defaults.get_grub_bios_modules

Provides list of grub bios modules

Parameters

multiboot () – grub multiboot mode

Returns

list of module names

Return type

list

kiwi.defaults.Defaults.get_grub_boot_directory_name

Provides grub2 data directory name in boot/ directory

Depending on the distribution the grub2 boot path could be either boot/grub2 or boot/grub. The method will decide for the correct base directory name according to the name pattern of the installed grub2 tools

Returns

directory basename

Return type

str

kiwi.defaults.Defaults.get_grub_efi_font_directory

Provides distribution specific EFI font directory used with grub.

Parameters

root_path () – image root path

Returns

file path or None

Return type

str

kiwi.defaults.Defaults.get_grub_efi_modules

Provides list of grub efi modules

Parameters

multiboot () – grub multiboot mode

Returns

list of module names

Return type

list

kiwi.defaults.Defaults.get_grub_ofw_modules

Provides list of grub ofw modules (ppc)

Returns

list of module names

Return type

list

kiwi.defaults.Defaults.get_grub_path

Provides grub path to given search file

Depending on the distribution grub could be installed below a grub2 or grub directory. grub could also reside in /usr/lib as well as in /usr/share. Therefore this information needs to be dynamically looked up

Parameters
  • root_path () – root path to start the lookup from

  • filename () – filename to search

  • raise_on_error () – raise on not found, defaults to True

The method returns the path to the given grub search file. By default it raises a KiwiBootLoaderGrubDataError exception if the file could not be found in any of the search locations. If raise_on_error is set to False and no file could be found the function returns None

Returns

filepath

Return type

str

kiwi.defaults.Defaults.get_grub_s390_modules

Provides list of grub ofw modules (s390)

Returns

list of module names

Return type

list

kiwi.defaults.Defaults.get_imported_root_image

Provides the path to an imported root system image

If the image description specified a derived_from attribute the file from this attribute is copied into the root_dir using the name as provided by this method

Parameters

root_dir () – image root directory

Returns

file path name

Return type

str

kiwi.defaults.Defaults.get_install_volume_id

Provides default value for ISO volume ID for install media

Returns

name

Return type

str

kiwi.defaults.Defaults.get_iso_boot_path

Provides arch specific relative path to boot files on kiwi iso filesystems

Returns

relative path name

Return type

str

kiwi.defaults.Defaults.get_iso_tool_category

Provides default iso tool category

Returns

name

Return type

str

kiwi.defaults.Defaults.get_isolinux_bios_grub_loader

Return name of eltorito grub image used as isolinux loader in BIOS mode if isolinux.bin should not be used

Returns

file base name

Return type

str

kiwi.defaults.Defaults.get_kis_image_types

Provides supported kis image types

Returns

kis image type names

Return type

list

kiwi.defaults.Defaults.get_live_dracut_modules_from_flag

Provides flag_name to dracut modules name map

Depending on the value of the flag attribute in the KIWI image description specific dracut modules need to be selected

Returns

dracut module names as list

Return type

list

kiwi.defaults.Defaults.get_live_image_types

Provides supported live image types

Returns

live image type names

Return type

list

kiwi.defaults.Defaults.get_live_iso_persistent_boot_options

Provides list of boot options passed to the dracut kiwi-live module to setup persistent writing

Returns

list of boot options

Return type

list

kiwi.defaults.Defaults.get_luks_key_length

Provides key length to use for random luks keys

kiwi.defaults.Defaults.get_lvm_overhead_mbytes

Provides empiric LVM overhead size in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_min_partition_mbytes

Provides default minimum partition size in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_min_volume_mbytes

Provides default minimum LVM volume size in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_mok_manager

Provides Mok Manager file path

Searches distribution specific locations to find the Mok Manager EFI binary

Parameters

root_path () – image root path

Returns

file path or None

Return type

str

kiwi.defaults.Defaults.get_obs_api_server_url

Provides the default API server url to access the public open buildservice API

Returns

url path

Return type

str

kiwi.defaults.Defaults.get_obs_download_server_url

Provides the default download server url hosting the public open buildservice repositories

Returns

url path

Return type

str

kiwi.defaults.Defaults.get_oci_archive_tool

Provides the default OCI archive tool name.

Returns

name

Return type

str

kiwi.defaults.Defaults.get_part_mapper_tool

Provides the default partition mapper tool name.

Returns

name

Return type

str

kiwi.defaults.Defaults.get_platform_name

Provides the machine architecture name as used by KIWI

This is the architecture name as it is returned by ‘uname -m’ with one exception for the 32bit x86 architecture which is handled as ‘ix86’ in general

Returns

architecture name

Return type

str

kiwi.defaults.Defaults.get_preparer

Provides ISO preparer name

Returns

name

Return type

str

kiwi.defaults.Defaults.get_profile_file

Return name of profile file for given root directory

kiwi.defaults.Defaults.get_publisher

Provides ISO publisher name

Returns

name

Return type

str

kiwi.defaults.Defaults.get_recovery_spare_mbytes

Provides spare size of recovery partition in mbytes

Returns

mbsize value

Return type

int

kiwi.defaults.Defaults.get_removed_files_name

Provides base file name to store removed files in a delta root build

kiwi.defaults.Defaults.get_schema_file

Provides file path to kiwi RelaxNG schema

Returns

file path

Return type

str

kiwi.defaults.Defaults.get_shared_cache_location

Provides the shared cache location

This is a directory which shares data from the image buildsystem host with the image root system. The location is returned as an absolute path stripped off by the leading ‘/’. This is because the path is transparently used on the host /<cache-dir> and inside of the image imageroot/<cache-dir>

Returns

directory path

Return type

str

kiwi.defaults.Defaults.get_shim_loader

Provides shim loader file path

Searches distribution specific locations to find shim.efi below the given root path

Parameters

root_path () – image root path

Returns

shim_loader_type | None

Return type

NamedTuple

kiwi.defaults.Defaults.get_shim_vendor_directory

Provides shim vendor directory

Searches distribution specific locations to find shim.efi below the given root path and return the directory name to the file found

Parameters

root_path () – image root path

Returns

directory path or None

Return type

str

kiwi.defaults.Defaults.get_signed_grub_loader

Provides shim signed grub loader file path

Searches distribution specific locations to find a grub EFI binary within the given root path

Parameters

root_path () – image root path

Returns

grub_loader_type | None

Return type

NamedTuple

kiwi.defaults.Defaults.get_snapper_config_template_file

Provides the default configuration template file for snapper. The location in etc/ are preferred over files in usr/

Returns

file path

Return type

str

kiwi.defaults.Defaults.get_solvable_location

Provides the directory to store SAT solvables for repositories. The solvable files are used to perform package dependency and metadata resolution

Returns

directory path

Return type

str

kiwi.defaults.Defaults.get_swapsize_mbytes

Provides swapsize in MB

kiwi.defaults.Defaults.get_sync_options

Provides list of default data sync options

Returns

list of rsync options

Return type

list

kiwi.defaults.Defaults.get_syslinux_modules

Returns list of syslinux modules to include on ISO images that boots via isolinux

Returns

base file names

Return type

list

kiwi.defaults.Defaults.get_syslinux_search_paths

syslinux is packaged differently between distributions. This method returns a list of directories to search for syslinux data

Returns

directory names

Return type

list

kiwi.defaults.Defaults.get_temp_location

Provides the base temp directory location

This is the directory used to store any temporary files and directories created by kiwi during runtime

Returns

directory path

Return type

str

kiwi.defaults.Defaults.get_unsigned_grub_loader

Provides unsigned grub efi loader file path

Searches distribution specific locations to find a distro grub EFI binary within the given root path

Parameters

root_path () – image root path

Returns

file path or None

Return type

str

kiwi.defaults.Defaults.get_vagrant_config_virtualbox_guest_additions

Provides the default value for vagrantconfig.virtualbox_guest_additions_present

Returns

whether guest additions are expected to be present in the vagrant box

Return type

bool

kiwi.defaults.Defaults.get_vendor_grubenv
kiwi.defaults.Defaults.get_video_mode_map

Provides video mode map

Assign a tuple to each kernel vesa hex id for each of the supported bootloaders

Returns

video type map

{'kernel_hex_mode': video_type(grub2='mode', isolinux='mode')}

Return type

dict

kiwi.defaults.Defaults.get_volume_id

Provides default value for ISO volume ID

Returns

name

Return type

str

kiwi.defaults.Defaults.get_xsl_stylesheet_file

Provides the file path to the KIWI XSLT style sheets

Returns

file path

Return type

str

kiwi.defaults.Defaults.get_xz_compression_options

Provides compression options for the xz compressor

Returns

Contains list of options

['--option=value']

Return type

list

kiwi.defaults.Defaults.is_buildservice_worker

Checks if build host is an open buildservice machine

The presence of /.buildenv on the build host indicates we are building inside of the open buildservice

Returns

True if obs worker, else False

Return type

bool

kiwi.defaults.Defaults.is_x86_arch

Checks if machine architecture is x86 based

Any arch that matches 32bit and 64bit x86 architecture causes the method to return True. Anything else will cause the method to return False

Return type

bool

kiwi.defaults.Defaults.project_file

Provides the python module base directory search path

The method uses the resource_filename method to identify files and directories from the application

Parameters

filename () – relative project file

Returns

absolute file path name

Return type

str

kiwi.defaults.Defaults.set_custom_runtime_config_file

Sets the runtime config file once

Parameters

filename () – a file path name

kiwi.defaults.Defaults.set_platform_name

Sets the platform architecture once

Parameters

name () – an architecture name

kiwi.defaults.Defaults.set_shared_cache_location

Sets the shared cache location once

Parameters

location () – a location path

kiwi.defaults.Defaults.set_temp_location

Sets the temp directory location once

Parameters

location () – a location path

kiwi.defaults.Defaults.to_profile

Implements method to add list of profile keys and their values to the specified instance of a Profile class

Parameters

profile () – Profile instance

kiwi.defaults.grub_loader_type

Bases: tuple

kiwi.defaults.grub_loader_type.binaryname

Alias for field number 1

kiwi.defaults.grub_loader_type.filename

Alias for field number 0

kiwi.defaults.shim_loader_type

Bases: tuple

kiwi.defaults.shim_loader_type.binaryname

Alias for field number 1

kiwi.defaults.shim_loader_type.filename

Alias for field number 0

kiwi.defaults.unit_type

Bases: tuple

kiwi.defaults.unit_type.byte

Alias for field number 0

kiwi.defaults.unit_type.gb

Alias for field number 3

kiwi.defaults.unit_type.kb

Alias for field number 1

kiwi.defaults.unit_type.mb

Alias for field number 2

13.1.7 kiwi.exceptions Module

kiwi.exceptions.KiwiAnyMarkupPluginError

Bases: KiwiError

Exception raised if the python anymarkup module failed to load.

kiwi.exceptions.KiwiArchiveSetupError

Bases: KiwiError

Exception raised if an unsupported image archive type is used.

kiwi.exceptions.KiwiArchiveTarError

Bases: KiwiError

Exception raised if impossible to determine which tar command version is installed on the underlying system

kiwi.exceptions.KiwiBootImageSetupError

Bases: KiwiError

Exception raised if an unsupported initrd system type is used.

kiwi.exceptions.KiwiBootLoaderConfigSetupError

Bases: KiwiError

Exception raised if a configuration for an unsupported bootloader is requested.

kiwi.exceptions.KiwiBootLoaderGrubDataError

Bases: KiwiError

Exception raised if no grub installation was found.

kiwi.exceptions.KiwiBootLoaderGrubFontError

Bases: KiwiError

Exception raised if no grub unicode font was found.

kiwi.exceptions.KiwiBootLoaderGrubInstallError

Bases: KiwiError

Exception raised if grub install to master boot record has failed.

kiwi.exceptions.KiwiBootLoaderGrubModulesError

Bases: KiwiError

Exception raised if the synchronisation of modules from the grub installation to the boot space has failed.

kiwi.exceptions.KiwiBootLoaderGrubPlatformError

Bases: KiwiError

Exception raised if an attempt was made to use grub on an unsupported platform.

kiwi.exceptions.KiwiBootLoaderGrubSecureBootError

Bases: KiwiError

Exception raised if the Microsoft signed shim loader or grub2 loader could not be found in the image root system

kiwi.exceptions.KiwiBootLoaderInstallSetupError

Bases: KiwiError

Exception raised if an installation for an unsupported bootloader is requested.

kiwi.exceptions.KiwiBootLoaderTargetError

Bases: KiwiError

Exception raised if the target to read the bootloader path from is not a disk or an iso image.

kiwi.exceptions.KiwiBootLoaderZiplInstallError

Bases: KiwiError

Exception raised if the installation of zipl has failed.

kiwi.exceptions.KiwiBootLoaderZiplPlatformError

Bases: KiwiError

Exception raised if a configuration for an unsupported zipl architecture is requested.

kiwi.exceptions.KiwiBootLoaderZiplSetupError

Bases: KiwiError

Exception raised if the data set to configure the zipl bootloader is incomplete.

kiwi.exceptions.KiwiBootStrapPhaseFailed

Bases: KiwiError

Exception raised if the bootstrap phase of the system prepare command has failed.

kiwi.exceptions.KiwiBuildahError

Bases: KiwiError

Exception raised on inconsistent buildah class calls

kiwi.exceptions.KiwiBundleError

Bases: KiwiError

Exception raised if the system bundle command has failed.

kiwi.exceptions.KiwiCommandCapabilitiesError

Bases: KiwiError

Exception is raised when some the CommandCapabilities methods fails, usually meaning there is some issue trying to parse some command output.

kiwi.exceptions.KiwiCommandError

Bases: KiwiError

Exception raised if an external command called via a Command instance has returned with an exit code != 0 or could not be called at all.

kiwi.exceptions.KiwiCommandNotFound

Bases: KiwiError

Exception raised if any executable command cannot be found in the evironment PATH variable.

kiwi.exceptions.KiwiCommandNotLoaded

Bases: KiwiError

Exception raised if a kiwi command task module could not be loaded.

kiwi.exceptions.KiwiCompatError

Bases: KiwiError

Exception raised if the given kiwi compatibility command line could not be understood by the compat option parser.

kiwi.exceptions.KiwiCompressionFormatUnknown

Bases: KiwiError

Exception raised if the compression format of the data could not be detected.

kiwi.exceptions.KiwiConfigFileFormatNotSupported

Bases: KiwiError

Exception raised if kiwi description file format is not supported.

kiwi.exceptions.KiwiConfigFileNotFound

Bases: KiwiError

Exception raised if no kiwi XML description was found.

kiwi.exceptions.KiwiContainerBuilderError

Bases: KiwiError

Exception is raised when something fails during a container image build procedure.

kiwi.exceptions.KiwiContainerImageSetupError

Bases: KiwiError

Exception raised if an attempt to create a container instance for an unsupported container type is performed.

kiwi.exceptions.KiwiContainerSetupError

Bases: KiwiError

Exception raised if an error in the creation of the container archive happened.

kiwi.exceptions.KiwiCredentialsError

Bases: KiwiError

Exception raised if required credentials information is missing

kiwi.exceptions.KiwiCustomPartitionConflictError

Bases: KiwiError

Exception raised if the entry in a custom partition setup conflicts with an existing partition table layout setting

kiwi.exceptions.KiwiDataStructureError

Bases: KiwiError

Exception raised if the XML description failed to parse the data structure.

kiwi.exceptions.KiwiDebootstrapError

Bases: KiwiError

Exception raised if not enough user data to call debootstrap were provided or the debootstrap has failed.

kiwi.exceptions.KiwiDecodingError

Bases: KiwiError

Exception is raised on decoding literals failure

kiwi.exceptions.KiwiDescriptionInvalid

Bases: KiwiError

Exception raised if the XML description failed to validate the XML schema.

kiwi.exceptions.KiwiDeviceProviderError

Bases: KiwiError

Exception raised if a storage provide is asked for its managed device but no such device exists.

kiwi.exceptions.KiwiDiskBootImageError

Bases: KiwiError

Exception raised if a kiwi boot image does not provide the requested data, e.g kernel, or hypervisor files.

kiwi.exceptions.KiwiDiskFormatSetupError

Bases: KiwiError

Exception raised if an attempt was made to create a disk format instance of an unsupported disk format.

kiwi.exceptions.KiwiDiskGeometryError

Bases: KiwiError

Exception raised if the disk geometry (partition table) could not be read or evaluated against their expected geometry and capabilities.

kiwi.exceptions.KiwiDistributionNameError

Bases: KiwiError

Exception raised if the distribution name could not be found. The information is extracted from the boot attribute of the XML description. If no boot attribute is present or does not match the naming conventions the exception is raised.

kiwi.exceptions.KiwiError

Bases: Exception

Base class to handle all known exceptions

Specific exceptions are implemented as sub classes of KiwiError

Attributes

Parameters

message () – Exception message text

kiwi.exceptions.KiwiExtensionError

Bases: KiwiError

Exception raised if an extension section of the same namespace is used multiple times as toplevel section within the extension section. Each extension must have a single toplevel entry point qualified by its namespace

kiwi.exceptions.KiwiFileAccessError

Bases: KiwiError

Exception raised if accessing a file or its metadata failed

kiwi.exceptions.KiwiFileNotFound

Bases: KiwiError

Exception raised if the requested file could not be found.

kiwi.exceptions.KiwiFileSystemSetupError

Bases: KiwiError

Exception raised if an attempt was made to build an unsupported or unspecified filesystem.

kiwi.exceptions.KiwiFileSystemSyncError

Bases: KiwiError

Exception raised if the data sync from the system into the loop mounted filesystem image failed.

kiwi.exceptions.KiwiFormatSetupError

Bases: KiwiError

Exception raised if the requested disk format could not be created.

kiwi.exceptions.KiwiHelpNoCommandGiven

Bases: KiwiError

Exception raised if the request for the help page is executed without a command to show the help for.

kiwi.exceptions.KiwiImageResizeError

Bases: KiwiError

Exception raised if the request to resize a disk image failed. Reasons could be a missing raw disk reference or a wrong size specification.

kiwi.exceptions.KiwiImportDescriptionError

Bases: KiwiError

Exception raised if the XML description data and scripts could not be imported into the root of the image.

kiwi.exceptions.KiwiIncludFileNotFoundError

Bases: KiwiError

Exception raised if the file reference in an <include> statement could not be found

kiwi.exceptions.KiwiInstallBootImageError

Bases: KiwiError

Exception raised if the required files to boot an installation image could not be found, e.g kernel or hypervisor.

kiwi.exceptions.KiwiInstallMediaError

Bases: KiwiError

Exception raised if a request for an installation media is made but the system image type is not an oem type.

kiwi.exceptions.KiwiInstallPhaseFailed

Bases: KiwiError

Exception raised if the install phase of a system prepare command has failed.

kiwi.exceptions.KiwiIsoLoaderError

Bases: KiwiError

Exception raised if no isolinux loader file could be found.

kiwi.exceptions.KiwiIsoMetaDataError

Bases: KiwiError

Exception raised if an inconsistency in the ISO header was found such like invalid eltorito specification or a broken path table.

kiwi.exceptions.KiwiIsoToolError

Bases: KiwiError

Exception raised if an iso helper tool such as isoinfo could not be found on the build system.

kiwi.exceptions.KiwiKernelLookupError

Bases: KiwiError

Exception raised if the search for the kernel image file failed

kiwi.exceptions.KiwiKisBootImageError

Bases: KiwiError

Exception raised if a required boot file e.g the kernel could not be found in the process of building a kis image.

kiwi.exceptions.KiwiLiveBootImageError

Bases: KiwiError

Exception raised if an attempt was made to use an unsupported live iso type.

kiwi.exceptions.KiwiLoadCommandUndefined

Bases: KiwiError

Exception raised if no command is specified for a given service on the commandline.

kiwi.exceptions.KiwiLogFileSetupFailed

Bases: KiwiError

Exception raised if the log file could not be created.

kiwi.exceptions.KiwiLogSocketSetupFailed

Bases: KiwiError

Exception raised if the Unix Domain log socket could not be created.

kiwi.exceptions.KiwiLoopSetupError

Bases: KiwiError

Exception raised if not enough user data to create a loop device is specified.

kiwi.exceptions.KiwiLuksSetupError

Bases: KiwiError

Exception raised if not enough user data is provided to setup the luks encryption on the given device.

kiwi.exceptions.KiwiMappedDeviceError

Bases: KiwiError

Exception raised if the device to become mapped does not exist.

kiwi.exceptions.KiwiMarkupConversionError

Bases: KiwiError

Exception raised if the markup format conversion is not possible.

kiwi.exceptions.KiwiMountKernelFileSystemsError

Bases: KiwiError

Exception raised if a kernel filesystem such as proc or sys could not be mounted.

kiwi.exceptions.KiwiMountSharedDirectoryError

Bases: KiwiError

Exception raised if the host <-> image shared directory could not be mounted.

kiwi.exceptions.KiwiNotImplementedError

Bases: KiwiError

Exception raised if a functionality is not yet implemented.

kiwi.exceptions.KiwiOCIArchiveToolError

Bases: KiwiError

Exception raised if the requested OCI archive tool is not supported

kiwi.exceptions.KiwiOffsetError

Bases: KiwiError

Exception raised if the offset for a seek operation does not match the expected data to write

kiwi.exceptions.KiwiPackageManagerSetupError

Bases: KiwiError

Exception raised if an attempt was made to create a package manager instance for an unsupported package manager.

kiwi.exceptions.KiwiPackagesDeletePhaseFailed

Bases: KiwiError

Exception raised if the packages deletion phase in system prepare fails.

kiwi.exceptions.KiwiPartitionTooSmallError

Bases: KiwiError

Exception raised if the specified partition size is smaller than the required bytes to store the data

kiwi.exceptions.KiwiPartitionerGptFlagError

Bases: KiwiError

Exception raised if an attempt was made to set an unknown partition flag for an entry in the GPT table.

kiwi.exceptions.KiwiPartitionerMsDosFlagError

Bases: KiwiError

Exception raised if an attempt was made to set an unknown partition flag for an entry in the MSDOS table.

kiwi.exceptions.KiwiPartitionerSetupError

Bases: KiwiError

Exception raised if an attempt was made to create an instance of a partitioner for an unsupporte partitioner.

kiwi.exceptions.KiwiPrivilegesError

Bases: KiwiError

Exception raised if root privileges are required but not granted.

kiwi.exceptions.KiwiProfileNotFound

Bases: KiwiError

Exception raised if a specified profile does not exist in the XML configuration.

kiwi.exceptions.KiwiRaidSetupError

Bases: KiwiError

Exception raised if invalid or not enough user data is provided to create a raid array on the specified storage device.

kiwi.exceptions.KiwiRepositorySetupError

Bases: KiwiError

Exception raised if an attempt was made to create an instance of a repository for an unsupported package manager.

kiwi.exceptions.KiwiRequestError

Bases: KiwiError

Exception raised if a package request could not be processed by the corresponding package manager instance.

kiwi.exceptions.KiwiRequestedTypeError

Bases: KiwiError

Exception raised if an attempt was made to build an image for an unsupported image type.

kiwi.exceptions.KiwiResizeRawDiskError

Bases: KiwiError

Exception raised if an attempt was made to resize the image disk to a smaller size than the current one. Simply shrinking a disk image file is not possible without data corruption because the partitions were setup to use the entire disk geometry as it fits into the file. A successful shrinking operation would require the filesystems and the partition table to be reduced which is not done by the provided simple storage resize method. In addition without the user overwriting the disk size in the XML setup, kiwi will calculate the minimum required size in order to store the data. Thus in almost all cases it will not be possible to store the data in a smaller disk.

kiwi.exceptions.KiwiResultError

Bases: KiwiError

Exception raised if the image build result pickle information could not be created or loaded.

kiwi.exceptions.KiwiRootDirExists

Bases: KiwiError

Exception raised if the specified image root directory already exists and should not be re-used.

kiwi.exceptions.KiwiRootImportError

Bases: KiwiError

Exception is raised when something fails during the root import procedure.

kiwi.exceptions.KiwiRootInitCreationError

Bases: KiwiError

Exception raised if the initialization of a new image root directory has failed.

kiwi.exceptions.KiwiRpmDirNotRemoteError

Bases: KiwiError

Exception raised if the provided rpm-dir repository is not local

kiwi.exceptions.KiwiRuntimeConfigFileError

Bases: KiwiError

Exception raised if the provided custom runtime config file could not be found

kiwi.exceptions.KiwiRuntimeConfigFormatError

Bases: KiwiError

Exception raised if the expected format in the yaml KIWI runtime config file does not match

kiwi.exceptions.KiwiRuntimeError

Bases: KiwiError

Exception raised if a runtime check has failed.

kiwi.exceptions.KiwiSatSolverJobError

Bases: KiwiError

Exception raised if a sat solver job can not be done, e.g because the requested package or collection does not exist in the registered repository metadata

kiwi.exceptions.KiwiSatSolverJobProblems

Bases: KiwiError

Exception raised if the sat solver operations returned with solver problems e.g package conflicts

kiwi.exceptions.KiwiSatSolverPluginError

Bases: KiwiError

Exception raised if the python solv module failed to load. The solv module is provided by SUSE’s rpm package python-solv and provides a python binding to the libsolv C library

kiwi.exceptions.KiwiSchemaImportError

Bases: KiwiError

Exception raised if the schema file could not be read by lxml.RelaxNG.

kiwi.exceptions.KiwiScriptFailed

Bases: KiwiError

Exception raised if a user script returned with an exit code != 0.

kiwi.exceptions.KiwiSetupIntermediateConfigError

Bases: KiwiError

Exception raised if the setup of the temporary image system configuration for the duration of the build process has failed.

kiwi.exceptions.KiwiShellVariableValueError

Bases: KiwiError

Exception raised if a given python value cannot be converted into a string representation for use in shell scripts

kiwi.exceptions.KiwiSizeError

Bases: KiwiError

Exception is raised when the convertion from a given size in string format to a number.

kiwi.exceptions.KiwiSolverRepositorySetupError

Bases: KiwiError

Exception raised if the repository type is not supported for the creation of a SAT solvable

kiwi.exceptions.KiwiSystemDeletePackagesFailed

Bases: KiwiError

Exception raised if the deletion of a package has failed in the corresponding package manager instance.

kiwi.exceptions.KiwiSystemInstallPackagesFailed

Bases: KiwiError

Exception raised if the installation of a package has failed in the corresponding package manager instance.

kiwi.exceptions.KiwiSystemUpdateFailed

Bases: KiwiError

Exception raised if the package upgrade has failed in the corresponding package manager instance.

kiwi.exceptions.KiwiTargetDirectoryNotFound

Bases: KiwiError

Exception raised if the specified target directory to store the image results was not found.

kiwi.exceptions.KiwiTemplateError

Bases: KiwiError

Exception raised if the substitution of variables in a configuration file template has failed.

kiwi.exceptions.KiwiTypeNotFound

Bases: KiwiError

Exception raised if no build type was found in the XML description.

kiwi.exceptions.KiwiUmountBusyError

Bases: KiwiError

Exception raised if the attempt to umount a resource has failed

kiwi.exceptions.KiwiUnknownServiceName

Bases: KiwiError

Exception raised if an unknown service name was provided on the commandline.

kiwi.exceptions.KiwiUriOpenError

Bases: KiwiError

Exception raised if the urllib urlopen request has failed

kiwi.exceptions.KiwiUriStyleUnknown

Bases: KiwiError

Exception raised if an unsupported URI style was used in the source definition of a repository.

kiwi.exceptions.KiwiUriTypeUnknown

Bases: KiwiError

Exception raised if the protocol type of an URI is unknown in the source definition of a repository.

kiwi.exceptions.KiwiValidationError

Bases: KiwiError

Exception raised if the XML validation against the schema has failed.

kiwi.exceptions.KiwiVhdTagError

Bases: KiwiError

Exception raised if the GUID tag is not provided in the expected format.

kiwi.exceptions.KiwiVolumeGroupConflict

Bases: KiwiError

Exception raised if the requested LVM volume group already is in use on the build system.

kiwi.exceptions.KiwiVolumeManagerSetupError

Bases: KiwiError

Exception raised if the preconditions for volume mangement support are not met or an attempt was made to create an instance of a volume manager for an unsupported volume management system.

kiwi.exceptions.KiwiVolumeRootIDError

Bases: KiwiError

Exception raised if the root volume can not be found. This concept currently exists only for the btrfs subvolume system.

kiwi.exceptions.KiwiVolumeTooSmallError

Bases: KiwiError

Exception raised if the specified volume size is smaller than the required bytes to store the data

13.1.8 kiwi.firmware Module

kiwi.firmware.FirmWare

Bases: object

Implements firmware specific methods

According to the selected firmware some parameters in a disk image changes. This class provides methods to provide firmware dependant information

  • param object xml_state

    instance of XMLState

kiwi.firmware.FirmWare.bios_mode

Check if BIOS mode is requested

Returns

True or False

Return type

bool

kiwi.firmware.FirmWare.ec2_mode

Check if EC2 mode is requested

Returns

True or False

Return type

bool

kiwi.firmware.FirmWare.efi_mode

Check if EFI mode is requested

Returns

The requested EFI mode or None if no EFI mode requested

Return type

str

kiwi.firmware.FirmWare.get_efi_partition_size

Size of EFI partition. Returns 0 if no such partition is needed

Returns

mbsize value

Return type

int

kiwi.firmware.FirmWare.get_legacy_bios_partition_size

Size of legacy bios_grub partition if legacy BIOS mode is required. Returns 0 if no such partition is needed

Returns

mbsize value

Return type

int

kiwi.firmware.FirmWare.get_partition_table_type

Provides partition table type according to architecture and firmware

Returns

partition table name

Return type

str

kiwi.firmware.FirmWare.get_prep_partition_size

Size of Prep partition if OFW mode is requested. Returns 0 if no such partition is needed

Returns

mbsize value

Return type

int

kiwi.firmware.FirmWare.legacy_bios_mode

Check if the legacy boot from BIOS systems should be activated

Returns

True or False

Return type

bool

kiwi.firmware.FirmWare.ofw_mode

Check if OFW mode is requested

Returns

True or False

Return type

bool

kiwi.firmware.FirmWare.opal_mode

Check if Opal mode is requested

Returns

True or False

Return type

bool

13.1.9 kiwi.help Module

kiwi.help.Help

Bases: object

Implements man page help for kiwi commands

Each kiwi command implements their own manual page, which is shown if the positional argument ‘help’ is passed to the command.

kiwi.help.Help.show

Call man to show the command specific manual page

All kiwi commands store their manual page in the section ‘8’ of the man system. The calling process is replaced by the man process

Parameters

command () – man page name

13.1.10 kiwi.kiwi Module

kiwi.kiwi.extras

Overwritten method from docopt

Shows our own usage message for -h|–help

Parameters
  • help () – indicate to show help

  • version () – version string

  • options () –

list of option tuples

[option(name='name', value='value')]
Parameters

doc () – docopt doc string

kiwi.kiwi.main

kiwi - main application entry point

Initializes a global log object and handles all errors of the application. Every known error is inherited from KiwiError, everything else is passed down until the generic Exception which is handled as unexpected error including the python backtrace

kiwi.kiwi.usage

Instead of the docopt way to show the usage information we provide a kiwi specific usage information. The usage data now always consists out of:

  1. the generic call kiwi-ng [global options] service <command> [<args>]

  2. the command specific usage defined by the docopt string short form by default, long form with -h | –help

  3. the global options

Parameters

command_usage () – usage data

13.1.11 kiwi.logger Module

kiwi.logger.Logger

Bases: Logger

Extended logging facility based on Python logging

Parameters

name () – name of the logger

kiwi.logger.Logger.getLogFlags

Return logging flags

Returns

Dictionary with flags and their activation status

Return type

dict

kiwi.logger.Logger.getLogLevel

Return currently used log level

Returns

log level number

Return type

int

kiwi.logger.Logger.get_logfile

Return file path name of logfile

Returns

file path

Return type

str

kiwi.logger.Logger.progress

Custom progress log information. progress information is intentionally only logged to stdout and will bypass any handlers. We don’t want this information to show up in the log file

Parameters
  • current () – current item

  • total () – total number of items

  • prefix () – prefix name

  • bar_length () – length of progress bar

kiwi.logger.Logger.setLogFlag

Set logging flag for further properties of the logging facility Available flags are:

  • run-scripts-in-screen

Parameters

flag () – name

kiwi.logger.Logger.setLogLevel

Set custom log level for all console handlers

Parameters

level () – log level number

kiwi.logger.Logger.set_color_format

Set color format for all console handlers

kiwi.logger.Logger.set_log_socket

Set log socket handler

Parameters

filename () – UDS socket file path. Note if there is no server listening on the socket the log handler setup will fail

kiwi.logger.Logger.set_logfile

Set logfile handler

Parameters

filename () – logfile file path

13.1.12 kiwi.logger_color_formatter Module

kiwi.logger_color_formatter.ColorFormatter

Bases: Formatter

Extended standard logging Formatter

Extended format supporting text with color metadata

Example:

ColorFormatter(message_format, '%H:%M:%S')
kiwi.logger_color_formatter.ColorFormatter.format

Creates a logging Formatter with support for color messages

Parameters

record () – logging message record

Returns

result from format_message

Return type

str

kiwi.logger_color_formatter.ColorMessage

Bases: object

Implements color messages for Python logging facility

Has to implement the format_message method to serve as message formatter

kiwi.logger_color_formatter.ColorMessage.format_message

Message formatter with support for embedded color sequences

The Message is allowed to contain the following color metadata:

  • $RESET, reset to no color mode

  • $BOLD, bold

  • $COLOR, color the following text

  • $LIGHTCOLOR, light color the following text

The color of the message depends on the level and is defined in the ColorMessage constructor

Parameters
  • level () – color level name

  • message () – text

Returns

color message with escape sequences

Return type

str

13.1.13 kiwi.logger_filter Module

kiwi.logger_filter.DebugFilter

Bases: Filter

Extended standard debug logging Filter

kiwi.logger_filter.DebugFilter.filter

Only messages with record level DEBUG can pass for messages with another level an extra handler is used

Parameters

record () – logging message record

Returns

True|False

Return type

bool

kiwi.logger_filter.ErrorFilter

Bases: Filter

Extended standard error logging Filter

kiwi.logger_filter.ErrorFilter.filter

Only messages with record level DEBUG can pass for messages with another level an extra handler is used

Parameters

record () – logging message record

Returns

True|False

Return type

bool

kiwi.logger_filter.InfoFilter

Bases: Filter

Extended standard logging Filter

kiwi.logger_filter.InfoFilter.filter

Only messages with record level INFO can pass for messages with another level an extra handler is used

Parameters

record () – logging message record

Returns

True|False

Return type

bool

kiwi.logger_filter.LoggerSchedulerFilter

Bases: Filter

Extended standard logging Filter

kiwi.logger_filter.LoggerSchedulerFilter.filter

Messages from apscheduler scheduler instances are filtered out They conflict with console progress information

Parameters

record () – logging message record

Returns

True|False

Return type

bool

kiwi.logger_filter.WarningFilter

Bases: Filter

Extended standard warning logging Filter

kiwi.logger_filter.WarningFilter.filter

Only messages with record level WARNING can pass for messages with another level an extra handler is used

Parameters

record () – logging message record

Returns

True|False

Return type

bool

13.1.14 kiwi.mount_manager Module

kiwi.mount_manager.MountManager

Bases: object

Implements methods for mounting, umounting and mount checking

If a MountManager instance is used to mount a device the caller must care for the time when umount needs to be called. The class does not automatically release the mounted device, which is intentional

  • param string device

    device node name

  • param string mountpoint

    mountpoint directory name

  • param dict attributes

    optional attributes to store

kiwi.mount_manager.MountManager.bind_mount

Bind mount the device to the mountpoint

kiwi.mount_manager.MountManager.get_attributes

Return attributes dict for this mount manager

kiwi.mount_manager.MountManager.is_mounted

Check if mounted

Returns

True or False

Return type

bool

kiwi.mount_manager.MountManager.mount

Standard mount the device to the mountpoint

Parameters

options () – mount options

kiwi.mount_manager.MountManager.overlay_mount
kiwi.mount_manager.MountManager.tmpfs_mount

tmpfs mount the device to the mountpoint

kiwi.mount_manager.MountManager.umount

Umount by the mountpoint directory

Wait up to 10sec trying to umount. If the resource stays busy the call will raise an exception unless raise_on_busy is set to False. In case the umount failed and raise_on_busy is set to False, the method returns False to indicate the error condition.

Returns

True or False

Return type

bool

kiwi.mount_manager.MountManager.umount_lazy

Umount by the mountpoint directory in lazy mode

Release the mount in any case, however the time when the mounted resource is released by the kernel depends on when the resource enters the non busy state

13.1.15 kiwi.path Module

kiwi.path.Path

Bases: object

Directory path helpers

kiwi.path.Path.access

Check whether path can be accessed with the given mode.

Parameters
  • path () – The path that should be checked for access.

  • mode () – Which access mode should be checked. This value must be a bit-wise or of one or more of the following constants: os.F_OK (note that this one is zero), os.X_OK, os.R_OK and os.W_OK

  • kwargs – further keyword arguments are forwarded to os.access()

Returns

Boolean value whether this access mode is allowed

Return type

bool

Raises
kiwi.path.Path.create

Create path and all sub directories to target

Parameters

path () – path name

kiwi.path.Path.move_to_root

Change the given path elements to a new root directory

Parameters
  • root () – the root path to trim

  • elements () – list of path names

Returns

changed elements

Return type

list

kiwi.path.Path.rebase_to_root

Include the root prefix for the given paths elements

Parameters
  • root () – the new root path

  • elements () – list of path names

Returns

changed elements

Return type

list

kiwi.path.Path.remove

Delete empty path, causes an error if target is not empty

Parameters

path () – path name

kiwi.path.Path.remove_hierarchy

Recursively remove an empty path and its sub directories starting at a given root directory. Ignore non empty or protected paths and leave them untouched

Parameters
  • root () – start at directory

  • path () – path name below root

kiwi.path.Path.rename

Move path from cur name to new name

Parameters
  • cur () – current path name

  • new () – new path name

kiwi.path.Path.sort_by_hierarchy

Sort given list of path names by their hierachy in the tree

Example:

result = Path.sort_by_hierarchy(['/var/lib', '/var'])
Parameters

path_list () – list of path names

Returns

hierachy sorted path_list

Return type

list

kiwi.path.Path.which

Lookup file name in PATH

Parameters
  • filename () – file base name

  • alternative_lookup_paths () – list of additional lookup paths

  • custom_env () – a custom os.environ

  • access_mode () – one of the os access modes or a combination of them (os.R_OK, os.W_OK and os.X_OK). If the provided access mode does not match the file is considered not existing

  • root_dir () – the root path to look at

Returns

absolute path to file or None

Return type

str

kiwi.path.Path.wipe

Delete path and all contents

Parameters

path () – path name

13.1.16 kiwi.privileges Module

kiwi.privileges.Privileges

Bases: object

Implements check for root privileges

kiwi.privileges.Privileges.check_for_root_permissions

Check if we are effectively root on the system. If not an exception is thrown

Returns

True or raise an Exception

Return type

bool

13.1.17 kiwi.runtime_checker Module

kiwi.runtime_checker.RuntimeChecker

Bases: object

Implements build consistency checks at runtime

kiwi.runtime_checker.RuntimeChecker.check_appx_naming_conventions_valid

When building wsl images there are some naming conventions that must be fulfilled to run the container on Microsoft Windows

kiwi.runtime_checker.RuntimeChecker.check_architecture_supports_iso_firmware_setup

For creating ISO images a different bootloader setup is performed depending on the configured firmware. If the firmware is set to bios, isolinux is used and that limits the architecture to x86 only. In any other case the appliance configured bootloader is used. This check examines if the host architecture is supported with the configured firmware on request of an ISO image.

kiwi.runtime_checker.RuntimeChecker.check_boot_description_exists

If a kiwi initrd is used, a lookup to the specified boot description is done and fails early if it does not exist

kiwi.runtime_checker.RuntimeChecker.check_consistent_kernel_in_boot_and_system_image

If a kiwi initrd is used, the kernel used to build the kiwi initrd and the kernel used in the system image must be the same in order to avoid an inconsistent boot setup

kiwi.runtime_checker.RuntimeChecker.check_container_tool_chain_installed

When creating container images the specific tools are used in order to import and export OCI or Docker compatible images. This check searches for those tools to be installed in the build system and fails if it can’t find them

kiwi.runtime_checker.RuntimeChecker.check_dracut_module_for_disk_oem_in_package_list

OEM images if configured to use dracut as initrd system requires the KIWI provided dracut-kiwi-oem-repart module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

kiwi.runtime_checker.RuntimeChecker.check_dracut_module_for_disk_overlay_in_package_list

Disk images configured to use a root filesystem overlay requires the KIWI provided kiwi-overlay dracut module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

kiwi.runtime_checker.RuntimeChecker.check_dracut_module_for_live_iso_in_package_list

Live ISO images uses a dracut initrd to boot and requires the KIWI provided kiwi-live dracut module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

kiwi.runtime_checker.RuntimeChecker.check_dracut_module_for_oem_install_in_package_list

OEM images if configured to use dracut as initrd system and configured with one of the installiso, installstick or installpxe attributes requires the KIWI provided dracut-kiwi-oem-dump module to be installed at the time dracut is called. Thus this runtime check examines if the required package is part of the package list in the image description.

kiwi.runtime_checker.RuntimeChecker.check_dracut_module_versions_compatible_to_kiwi

KIWI images which makes use of kiwi dracut modules has to use module versions compatible with the version of this KIWI builder code base. This is important to avoid inconsistencies between the way how kiwi includes its own dracut modules and former version of those dracut modules which could be no longer compatible with the builder. Therefore this runtime check maintains a min_version constraint for which we know this KIWI builder to be compatible with.

kiwi.runtime_checker.RuntimeChecker.check_efi_mode_for_disk_overlay_correctly_setup

Disk images configured to use a root filesystem overlay only supports the standard EFI mode and not secure boot. That’s because the shim setup performs changes to the root filesystem which can not be applied during the bootloader setup at build time because at that point the root filesystem is a read-only squashfs source.

kiwi.runtime_checker.RuntimeChecker.check_image_include_repos_publicly_resolvable

Verify that all repos marked with the imageinclude attribute can be resolved into a http based web URL

kiwi.runtime_checker.RuntimeChecker.check_image_type_unique

Verify that the selected image type is unique within the range of the configured types and profiles.

kiwi.runtime_checker.RuntimeChecker.check_image_version_provided

Kiwi requires a <version> element to be specified as part of at least one <preferences> section.

kiwi.runtime_checker.RuntimeChecker.check_include_references_unresolvable

Raise for still included <include> statements as not resolvable. The KIWI XSLT processing replaces the specified include directive(s) with the given file reference(s). If this action did not happen for example on nested includes, it can happen that they stay in the document as sort of waste.

kiwi.runtime_checker.RuntimeChecker.check_initrd_selection_required

If the boot attribute is used without selecting kiwi as the initrd_system, the setting of the boot attribute will not have any effect. We assume that configurations which explicitly specify the boot attribute wants to use the custom kiwi initrd system and not dracut.

kiwi.runtime_checker.RuntimeChecker.check_luksformat_options_valid

Options set via the luksformat element are passed along to the cryptsetup tool. Only options that are known to the tool should be allowed. Thus this runtime check looks up the provided option names if they exist in the cryptsetup version used on the build host

kiwi.runtime_checker.RuntimeChecker.check_mediacheck_installed

If the image description enables the mediacheck attribute the required tools to run this check must be installed on the image build host

kiwi.runtime_checker.RuntimeChecker.check_partuuid_persistency_type_used_with_mbr

The devicepersistency setting by-partuuid can only be used in combination with a partition table type that supports UUIDs. In any other case Linux creates artificial values for PTUUID and PARTUUID from the disk signature which can change without touching the actual partition table. We consider this unsafe and only allow the use of by-partuuid in combination with partition tables that actually supports it properly.

kiwi.runtime_checker.RuntimeChecker.check_repositories_configured

Verify that there are repositories configured

kiwi.runtime_checker.RuntimeChecker.check_swap_name_used_with_lvm

The optional oem-swapname is only effective if used together with the LVM volume manager. A name for the swap space can only be set if it is created as a LVM volume. In any other case the name does not apply to the system

kiwi.runtime_checker.RuntimeChecker.check_syslinux_installed_if_isolinux_is_used

ISO images that are configured to use isolinux requires the host to provide a set of syslinux binaries.

kiwi.runtime_checker.RuntimeChecker.check_target_directory_not_in_shared_cache

The target directory must be outside of the kiwi shared cache directory in order to avoid busy mounts because kiwi bind mounts the cache directory into the image root tree to access host caching information

Parameters

target_dir () – path name

kiwi.runtime_checker.RuntimeChecker.check_volume_label_used_with_lvm

The optional volume label in a systemdisk setup is only effective if the LVM, logical volume manager system is used. In any other case where the filesystem itself offers volume management capabilities there are no extra filesystem labels which can be applied per volume

kiwi.runtime_checker.RuntimeChecker.check_volume_setup_defines_multiple_fullsize_volumes

The volume size specification ‘all’ makes this volume to take the rest space available on the system. It’s only allowed to specify one all size volume

kiwi.runtime_checker.RuntimeChecker.check_volume_setup_defines_reserved_labels
kiwi.runtime_checker.RuntimeChecker.check_volume_setup_has_no_root_definition

The root volume in a systemdisk setup is handled in a special way. It is not allowed to setup a custom name or mountpoint for the root volume. Therefore the size of the root volume can be setup via the @root volume name. This check looks up the volume setup and searches if there is a configuration for the ‘/’ mountpoint which would cause the image build to fail

kiwi.runtime_checker.RuntimeChecker.check_xen_uniquely_setup_as_server_or_guest

If the image is classified to be used as Xen image, it can be either a Xen Server(dom0) or a Xen guest. The image configuration is checked if the information uniquely identifies the image as such

kiwi.runtime_checker.dracut_module_type

Bases: tuple

kiwi.runtime_checker.dracut_module_type.min_version

Alias for field number 1

kiwi.runtime_checker.dracut_module_type.package

Alias for field number 0

13.1.18 kiwi.runtime_config Module

kiwi.runtime_config.RuntimeConfig

Bases: object

Implements reading of runtime configuration file:

  1. Check for –config provided from the CLI

  2. ~/.config/kiwi/config.yml

  3. /etc/kiwi.yml

The KIWI runtime configuration file is a yaml formatted file containing information to control the behavior of the tools used by KIWI.

Parameters

reread () – reread runtime config

kiwi.runtime_config.RuntimeConfig.get_bundle_compression

Return boolean value to express if the image bundle should contain XZ compressed image results or not.

bundle:
  • compress: true|false

If compression of image build results is activated the size of the bundle is smaller and the download speed increases. However the image must be uncompressed before use

If no compression is explicitly configured, the provided default value applies

Parameters

default () – Default value

Returns

True or False

Return type

bool

kiwi.runtime_config.RuntimeConfig.get_container_compression

Return compression for container images

container:
  • compress: xz|none|true|false

if no or invalid configuration data is provided, the default compression from the Defaults class is returned

Returns

True or False

Return type

bool

kiwi.runtime_config.RuntimeConfig.get_credentials_verification_metadata_signing_key_file

Return verification metadata signing key file, used for signature creation of rootfs verification metadata:

credentials:
  • verification_metadata_signing_key_file: …

There is no default value for this setting available

Returns

file path name or ‘’

Return type

str

kiwi.runtime_config.RuntimeConfig.get_disabled_runtime_checks

Returns disabled runtime checks. Checks can be disabled with:

runtime_checks:
  • disable: check_container_tool_chain_installed

if the provided string does not match any RuntimeChecker method it is just ignored.

kiwi.runtime_config.RuntimeConfig.get_iso_tool_category

Return tool category which should be used to build iso images

iso:
  • tool_category: xorriso

if no or invalid configuration exists the default tool category from the Defaults class is returned

Returns

A name

Return type

str

kiwi.runtime_config.RuntimeConfig.get_mapper_tool

Return partition mapper tool

mapper:
  • part_mapper: partx

if no configuration exists the default tool from the Defaults class is returned

Returns

A name

Return type

str

kiwi.runtime_config.RuntimeConfig.get_max_size_constraint

Returns the maximum allowed size of the built image. The value is returned in bytes and it is specified in build_constraints element with the max_size attribute. The value can be specified in bytes or it can be specified with m=MB or g=GB.

build_constraints:
  • max_size: 700m

if no configuration exists None is returned

Returns

byte value or None

Return type

int

kiwi.runtime_config.RuntimeConfig.get_obs_api_credentials

Return OBS API credentials if configured:

obs:
  • user:
    • user_name: user_credentials

Returns

List of Dicts with credentials per user

Return type

list

kiwi.runtime_config.RuntimeConfig.get_obs_api_server_url

Return URL of buildservice API server in:

obs:
  • api_url: …

if no configuration exists the API server from the Defaults class is returned

Returns

URL type data

Return type

str

kiwi.runtime_config.RuntimeConfig.get_obs_download_server_url

Return URL of buildservice download server in:

obs:
  • download_url: …

if no configuration exists the downloadserver from the Defaults class is returned

Returns

URL type data

Return type

str

kiwi.runtime_config.RuntimeConfig.get_oci_archive_tool

Return OCI archive tool which should be used on creation of container archives for OCI compliant images, e.g docker

oci:
  • archive_tool: umoci

if no configuration exists the default tool from the Defaults class is returned

Returns

A name

Return type

str

kiwi.runtime_config.RuntimeConfig.get_package_changes

Return boolean value to express if the image build and bundle should contain a .changes file. The .changes file contains the package changelog information from all packages installed into the image.

bundle:
  • has_package_changes: true|false

By default the creation is switched on. When building in the Open Build Service the default is switched off because obs provides a .report file containing the same information.

Parameters

default () – Default value

Returns

True or False

Return type

bool

kiwi.runtime_config.RuntimeConfig.get_xz_options

Return list of XZ compression options in:

xz:
  • options: …

if no configuration exists None is returned

Returns

Contains list of options

['--option=value']

Return type

list

kiwi.runtime_config.RuntimeConfig.is_obs_public

Check if the buildservice configuration is public or private in:

obs:
  • public: true|false

if no configuration exists we assume to be public

Returns

True or False

Return type

bool

13.1.19 kiwi.version Module

Global version information used in kiwi and the package

13.1.20 kiwi.xml_description Module

kiwi.xml_description.XMLDescription

Bases: object

Implements data management for the image description

Supported description markup languages are XML, YAML, JSON and INI. The provided input file is converted into XML, transformed to the current RelaxNG schema via XSLT and validated against this result.

  • XSLT Style Sheet processing to apply on this version of kiwi

  • Schema Validation based on RelaxNG schema

  • Loading XML data into internal data structures

Attributes

Parameters
  • description () – path to description file

  • derived_from () – path to base description file

kiwi.xml_description.XMLDescription.get_extension_xml_data

Return the xml etree parse result for the specified extension namespace

Parameters

namespace_name () – name of the extension namespace

Returns

result of etree.parse

Return type

object

kiwi.xml_description.XMLDescription.load

Read XML description, validate it against the schema and the schematron rules and pass it to the autogenerated(generateDS) parser.

Returns

instance of XML toplevel domain (image)

Return type

object

13.1.21 kiwi.xml_state Module

kiwi.xml_state.XMLState

Bases: object

Implements methods to get stateful information from the XML data

Parameters
  • xml_data () – parse result from XMLDescription.load()

  • profiles () – list of used profiles

  • build_type () – build <type> section reference

kiwi.xml_state.XMLState.add_container_config_label

Adds a new label in the containerconfig section, if a label with the same name is already defined in containerconfig it gets overwritten by this method.

Parameters
  • label_name () – the string representing the label name

  • value () – the value of the label

kiwi.xml_state.XMLState.add_repository

Add a new repository section at the end of the list

Parameters
  • repo_source () – repository URI

  • repo_type () – type name defined by schema

  • repo_alias () – alias name

  • repo_prio () – priority number, package manager specific

  • repo_imageinclude () – setup repository inside of the image

  • repo_package_gpgcheck () – enable/disable package gpg checks

  • repo_signing_keys () – list of signing key file names

  • components () – component names for debian repos

  • distribution () – base distribution name for debian repos

  • repo_gpgcheck () – enable/disable repo gpg checks

kiwi.xml_state.XMLState.copy_bootdelete_packages

Copy packages marked as bootdelete to the packages type=delete section in the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_bootincluded_archives

Copy archives marked as bootinclude to the packages type=bootstrap section in the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_bootincluded_packages

Copy packages marked as bootinclude to the packages type=bootstrap section in the target xml state. The package will also be removed from the packages type=delete section in the target xml state if present there

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_bootloader_section

Copy bootloader section from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_build_type_attributes

Copy specified attributes from this build type section to the target xml state build type section

Parameters
  • attribute_names () – type section attributes

  • target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_displayname

Copy image displayname from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_drivers_sections

Copy drivers sections from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_machine_section

Copy machine sections from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_name

Copy image name from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_oemconfig_section

Copy oemconfig sections from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_preferences_subsections

Copy subsections of the preferences sections, matching given section names, from this xml state to the target xml state

Parameters
  • section_names () – preferences subsection names

  • target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_repository_sections

Copy repository sections from this xml state to the target xml state

Parameters
  • target_state () – XMLState instance

  • wipe () – delete all repos in target prior to copy

kiwi.xml_state.XMLState.copy_strip_sections

Copy strip sections from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.copy_systemdisk_section

Copy systemdisk sections from this xml state to the target xml state

Parameters

target_state () – XMLState instance

kiwi.xml_state.XMLState.delete_repository_sections

Delete all repository sections matching configured profiles

kiwi.xml_state.XMLState.delete_repository_sections_used_for_build

Delete all repository sections used to build the image matching configured profiles

kiwi.xml_state.XMLState.get_archives_target_dirs

Dict of archive names and target dirs for packages section(s), if any :return: archive names and its target dir :rtype: dict

kiwi.xml_state.XMLState.get_bootloader_config_options

List of custom options used in the bootloader configuration

kiwi.xml_state.XMLState.get_bootloader_install_options

List of custom options used in the bootloader installation

kiwi.xml_state.XMLState.get_bootloader_options

List of custom options used in the process to run bootloader setup workloads

kiwi.xml_state.XMLState.get_bootloader_shim_options

List of custom options used in the process to setup secure boot

kiwi.xml_state.XMLState.get_bootstrap_archives

List of archive names from the type=”bootstrap” packages section(s)

Returns

archive names

Return type

list

kiwi.xml_state.XMLState.get_bootstrap_archives_target_dirs

Dict of archive names and target dirs from the type=”bootstrap” packages section(s) :return: archive names and its target dir :rtype: dict

kiwi.xml_state.XMLState.get_bootstrap_collection_type

Collection type for packages sections matching type=”bootstrap”

Returns

collection type name

Return type

str

kiwi.xml_state.XMLState.get_bootstrap_collections

List of collection names from the packages sections matching type=”bootstrap”

Returns

collection names

Return type

list

kiwi.xml_state.XMLState.get_bootstrap_package_name

bootstrap_package name from type=”bootstrap” packages section

Returns

bootstrap_package name

Return type

str

kiwi.xml_state.XMLState.get_bootstrap_packages

List of package names from the type=”bootstrap” packages section(s)

The list gets the selected package manager appended if there is a request to install packages inside of the image via a chroot operation

Parameters

plus_packages () – list of additional packages

Returns

package names

Return type

list

kiwi.xml_state.XMLState.get_bootstrap_packages_sections

List of packages sections matching type=”bootstrap”

Returns

list of <packages> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_bootstrap_products

List of product names from the packages sections matching type=”bootstrap”

Returns

product names

Return type

list

kiwi.xml_state.XMLState.get_build_type_bootloader_console

Return bootloader console setting for selected build type

Returns

console string

Return type

str

kiwi.xml_state.XMLState.get_build_type_bootloader_name

Return bootloader name for selected build type

Returns

bootloader name

Return type

str

kiwi.xml_state.XMLState.get_build_type_bootloader_section

First bootloader section from the build type section

Returns

<bootloader> section reference

Return type

xml_parse::bootloader

kiwi.xml_state.XMLState.get_build_type_bootloader_serial_line_setup

Return bootloader serial line setup parameters for the selected build type

Returns

serial line setup

Return type

str

kiwi.xml_state.XMLState.get_build_type_bootloader_settings_section

First bootloadersettings section from the build type bootloader section

Returns

<bootloadersettings> section reference

Return type

xml_parse::bootloadersettings

kiwi.xml_state.XMLState.get_build_type_bootloader_targettype

Return bootloader target type setting. Only relevant for the zipl bootloader because zipl is installed differently depending on the storage target it runs later

Returns

target type string

Return type

str

kiwi.xml_state.XMLState.get_build_type_bootloader_timeout

Return bootloader timeout setting for selected build type

Returns

timeout string

Return type

str

kiwi.xml_state.XMLState.get_build_type_bootloader_timeout_style

Return bootloader timeout style setting for selected build type

Returns

timeout_style string

Return type

str

kiwi.xml_state.XMLState.get_build_type_bootloader_use_disk_password

Indicate whether the bootloader configuration should use the password protecting the encrypted root volume.

Returns

True|False

Return type

bool

kiwi.xml_state.XMLState.get_build_type_bundle_format

Return bundle_format for build type

The bundle_format string is validated against the available name tags from kiwi.system.result::result_name_tags.

Returns

bundle format string

Return type

str

kiwi.xml_state.XMLState.get_build_type_containerconfig_section

First containerconfig section from the build type section

Returns

<containerconfig> section reference

Return type

xml_parse::containerconfig

kiwi.xml_state.XMLState.get_build_type_format_options

Disk format options returned as a dictionary

Returns

format options

Return type

dict

kiwi.xml_state.XMLState.get_build_type_machine_section

First machine section from the build type section

Returns

<machine> section reference

Return type

xml_parse::machine

kiwi.xml_state.XMLState.get_build_type_name

Default build type name

Returns

Content of image attribute from build type

Return type

str

kiwi.xml_state.XMLState.get_build_type_oemconfig_section

First oemconfig section from the build type section

Returns

<oemconfig> section reference

Return type

xml_parse::oemconfig

kiwi.xml_state.XMLState.get_build_type_partitions_section

First partitions section from the build type section

Returns

<partitions> section reference

Return type

xml_parse::partitions

kiwi.xml_state.XMLState.get_build_type_size

Size information from the build type section. If no unit is set the value is treated as mbytes

Parameters

include_unpartitioned () – sets if the unpartitioned area should be included in the computed size or not

Returns

mbytes

Return type

int

kiwi.xml_state.XMLState.get_build_type_spare_part_fs_attributes

Build type specific list of filesystem attributes applied to the spare partition.

Returns

list of strings or empty list

Return type

list

kiwi.xml_state.XMLState.get_build_type_spare_part_size

Size information for the spare_part size from the build type. If no unit is set the value is treated as mbytes

Returns

mbytes

Return type

int

kiwi.xml_state.XMLState.get_build_type_system_disk_section

First system disk section from the build type section

Returns

<systemdisk> section reference

Return type

xml_parse::systemdisk

kiwi.xml_state.XMLState.get_build_type_unpartitioned_bytes

Size of the unpartitioned area for image in megabytes

Returns

mbytes

Return type

int

kiwi.xml_state.XMLState.get_build_type_vagrant_config_section

First vagrantconfig section from the build type section

Returns

<vagrantconfig> section reference

Return type

xml_parse::vagrantconfig

kiwi.xml_state.XMLState.get_build_type_vmconfig_entries

List of vmconfig-entry section values from the first machine section in the build type section

Returns

<vmconfig_entry> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_build_type_vmdisk_section

First vmdisk section from the first machine section in the build type section

Returns

<vmdisk> section reference

Return type

xml_parse::vmdisk

kiwi.xml_state.XMLState.get_build_type_vmdvd_section

First vmdvd section from the first machine section in the build type section

Returns

<vmdvd> section reference

Return type

xml_parse::vmdvd

kiwi.xml_state.XMLState.get_build_type_vmnic_entries

vmnic section(s) from the first machine section in the build type section

Returns

list of <vmnic> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_collection_modules

Dict of collection modules to enable and/or disable

Returns

Dict of the form:

{
    'enable': [
        "module:stream", "module"
    ],
    'disable': [
        "module"
    ]
}

Return type

dict

kiwi.xml_state.XMLState.get_collection_type

Collection type from packages sections matching given section type.

If no collection type is specified the default collection type is set to: onlyRequired

Parameters

section_type () – type name from packages section

Returns

collection type name

Return type

str

kiwi.xml_state.XMLState.get_collections

List of collection names from the packages sections matching type=section_type and type=build_type

Returns

collection names

Return type

list

kiwi.xml_state.XMLState.get_container_config

Dictionary of containerconfig information

Takes attributes and subsection data from the selected <containerconfig> section and stores it in a dictionary

kiwi.xml_state.XMLState.get_derived_from_image_uri

Uri object of derived image if configured

Specific image types can be based on a master image. This method returns the location of this image when configured in the XML description

Returns

Instance of Uri

Return type

object

kiwi.xml_state.XMLState.get_description_section

The description section

Returns

description_type tuple providing the elements author contact and specification

Return type

tuple

kiwi.xml_state.XMLState.get_disk_start_sector

First disk sector number to be used by the first disk partition.

Returns

number

Return type

int

kiwi.xml_state.XMLState.get_distribution_name_from_boot_attribute

Extract the distribution name from the boot attribute of the build type section.

If no boot attribute is configured or the contents does not match the kiwi defined naming schema for boot image descriptions, an exception is thrown

Returns

lowercase distribution name

Return type

str

kiwi.xml_state.XMLState.get_drivers_list

List of driver names from all drivers sections matching configured profiles

Returns

driver names

Return type

list

kiwi.xml_state.XMLState.get_fs_create_option_list

List of root filesystem creation options

The list contains elements with the information from the fscreateoptions attribute string that got split into its substring components

Returns

list with create options

Return type

list

kiwi.xml_state.XMLState.get_fs_mount_option_list

List of root filesystem mount options

The list contains one element with the information from the fsmountoptions attribute. The value there is passed along to the -o mount option

Returns

max one element list with mount option string

Return type

list

kiwi.xml_state.XMLState.get_image_packages_sections

List of packages sections matching type=”image”

Returns

list of <packages> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_image_version

Image version from preferences section.

Multiple occurences of version in preferences sections are not forbidden, however only the first version found defines the final image version

Returns

Content of <version> section

Return type

str

kiwi.xml_state.XMLState.get_include_section_reference_file_names

List of all <include> section file name references

Returns

List[str]

Return type

list

kiwi.xml_state.XMLState.get_initrd_system

Name of initrd system to use

Depending on the image type a specific initrd system is either pre selected or free of choice according to the XML type setup.

Returns

‘dracut’, ‘kiwi’ or ‘none’

Return type

str

kiwi.xml_state.XMLState.get_installmedia_initrd_modules

Gets the list of modules to append in installation initrds

Returns

a list of dracut module names

Return type

list

kiwi.xml_state.XMLState.get_locale

Gets list of locale names if configured. Takes the first locale setup from the existing preferences sections into account.

Returns

List of names or None

Return type

list|None

kiwi.xml_state.XMLState.get_luks_credentials

Return key or passphrase credentials to open the luks pool

Returns

data

Return type

str

kiwi.xml_state.XMLState.get_luks_format_options

Return list of luks format options

Returns

list of options

Return type

list

kiwi.xml_state.XMLState.get_oemconfig_oem_multipath_scan

State value to activate multipath maps. Returns a boolean value if specified or False

Returns

Content of <oem-multipath-scan> section value

Return type

bool

kiwi.xml_state.XMLState.get_oemconfig_oem_resize

State value to activate/deactivate disk resize. Returns a boolean value if specified or True to set resize on by default

Returns

Content of <oem-resize> section value

Return type

bool

kiwi.xml_state.XMLState.get_oemconfig_oem_systemsize

State value to retrieve root partition size

Returns

Content of <oem-systemsize> section value

Return type

int

kiwi.xml_state.XMLState.get_oemconfig_swap_mbytes

Return swapsize in MB if requested or None

Operates on the value of oem-swap and if set to true returns the given size or the default value.

Returns

Content of <oem-swapsize> section value or default

Return type

int

kiwi.xml_state.XMLState.get_oemconfig_swap_name

Return the swap space name

Operates on the value of oem-swapname and if set returns the configured name or the default name: LVSwap

The name of the swap space is used only if the image is configured to use the LVM volume manager. In this case swap is a volume and the volume takes a name. In any other case the given name will have no effect.

Returns

Content of <oem-swapname> section value or default

Return type

str

kiwi.xml_state.XMLState.get_package_manager

Get configured package manager from selected preferences section

Returns

Content of the <packagemanager> section

Return type

str

kiwi.xml_state.XMLState.get_package_sections

List of package sections from the given packages sections. Each list element contains a tuple with the <package> section reference and the <packages> section this package belongs to

If a package entry specfies an architecture, it is only taken if the host architecture matches the configured architecture

Parameters

packages_sections () – <packages>

Returns

Contains list of package_type tuples

[package_type(packages_section=object, package_section=object)]

Return type

list

kiwi.xml_state.XMLState.get_packages_sections

List of packages sections matching given section type(s)

Parameters

section_types () – type name(s) from packages sections

Returns

list of <packages> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_partitions

Dictionary of configured partitions.

Each entry in the dict references a ptable_entry_type Each key in the dict references the name of the partition entry as handled by KIWI

Returns

Contains dict of ptable_entry_type tuples

{
    'NAME': ptable_entry_type(
        mbsize=int,
        clone=int,
        partition_name=str,
        partition_type=str,
        mountpoint=str,
        filesystem=str
    )
}

Return type

dict

kiwi.xml_state.XMLState.get_preferences_sections

All preferences sections for the selected profiles that match the host architecture

Returns

list of <preferences> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_products

List of product names from the packages sections matching type=section_type and type=build_type

Parameters

section_type () – type name from packages section

Returns

product names

Return type

list

kiwi.xml_state.XMLState.get_release_version

Get configured release version from selected preferences section

Returns

Content of the <release-version> section or ‘’

Return type

str

kiwi.xml_state.XMLState.get_repositories_signing_keys

Get list of signing keys specified on the repositories

kiwi.xml_state.XMLState.get_repository_sections

List of all repository sections matching configured profiles

Returns

<repository> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_repository_sections_used_for_build

List of all repositorys sections used to build the image and matching configured profiles.

Returns

<repository> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_repository_sections_used_in_image

List of all repositorys sections to be configured in the resulting image matching configured profiles.

Returns

<repository> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_root_filesystem_uuid

Return preserved UUID

kiwi.xml_state.XMLState.get_root_partition_uuid

Return preserved PARTUUID

kiwi.xml_state.XMLState.get_rpm_check_signatures

Gets the rpm-check-signatures configuration flag. Returns False if not present.

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.get_rpm_excludedocs

Gets the rpm-excludedocs configuration flag. Returns False if not present.

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.get_rpm_locale

Gets list of locale names to filter out by rpm if rpm-locale-filtering is switched on the the list always contains: [POSIX, C, C.UTF-8] and is extended by the optionaly configured locale

Returns

List of names or None

Return type

list|None

kiwi.xml_state.XMLState.get_rpm_locale_filtering

Gets the rpm-locale-filtering configuration flag. Returns False if not present.

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.get_strip_files_to_delete

Items to delete from strip section

Returns

item names

Return type

list

kiwi.xml_state.XMLState.get_strip_libraries_to_keep

Libraries to keep from strip section

Returns

librarie names

Return type

list

kiwi.xml_state.XMLState.get_strip_list

List of strip names matching the given section type and profiles

Parameters

section_type () – type name from packages section

Returns

strip names

Return type

list

kiwi.xml_state.XMLState.get_strip_tools_to_keep

Tools to keep from strip section

Returns

tool names

Return type

list

kiwi.xml_state.XMLState.get_system_archives

List of archive names from the packages sections matching type=”image” and type=build_type

Returns

archive names

Return type

list

kiwi.xml_state.XMLState.get_system_archives_target_dirs

Dict of archive names and its target dir from the packages sections matching type=”image” and type=build_type :return: archive names and its target dir :rtype: dict

kiwi.xml_state.XMLState.get_system_collection_type

Collection type for packages sections matching type=”image”

Returns

collection type name

Return type

str

kiwi.xml_state.XMLState.get_system_collections

List of collection names from the packages sections matching type=”image”

Returns

collection names

Return type

list

kiwi.xml_state.XMLState.get_system_ignore_packages

List of ignore package names from the packages sections matching type=”image” and type=build_type

Returns

package names

Return type

list

kiwi.xml_state.XMLState.get_system_packages

List of package names from the packages sections matching type=”image” and type=build_type

Returns

package names

Return type

list

kiwi.xml_state.XMLState.get_system_products

List of product names from the packages sections matching type=”image”

Returns

product names

Return type

list

kiwi.xml_state.XMLState.get_to_become_deleted_packages

List of package names from the type=”delete” or type=”uninstall” packages section(s)

Parameters

force () – return “delete” type if True, “uninstall” type otherwise

Returns

package names

Return type

list

kiwi.xml_state.XMLState.get_user_groups

List of group names matching specified user

Each entry in the list is the name of a group and optionally its group ID separated by a colon, that the specified user belongs to. The first item in the list is the login or primary group. The list will be empty if no groups are specified in the description file.

Returns

groups data for the given user

Return type

list

kiwi.xml_state.XMLState.get_users

List of configured users.

Each entry in the list is a single xml_parse::user instance.

Returns

list of <user> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_users_sections

All users sections for the selected profiles

Returns

list of <users> section reference(s)

Return type

list

kiwi.xml_state.XMLState.get_vagrant_config_virtualbox_guest_additions

Attribute virtualbox_guest_additions_present from the first vagrantconfig section.

Returns

True|False

Return type

bool

kiwi.xml_state.XMLState.get_volume_group_name

Volume group name from selected <systemdisk> section

Returns

volume group name

Return type

str

kiwi.xml_state.XMLState.get_volume_management

Provides information which volume management system is used

Returns

name of volume manager

Return type

str

kiwi.xml_state.XMLState.get_volumes

List of configured systemdisk volumes.

Each entry in the list is a tuple with the following information

  • name: name of the volume

  • size: size of the volume

  • realpath: system path to lookup volume data. If no mountpoint is set the volume name is used as data path.

  • mountpoint: volume mount point and volume data path

  • fullsize: takes all space True|False

  • attributes: list of volume attributes handled via chattr

Returns

Contains list of volume_type tuples

[
    volume_type(
        name=volume_name,
        parent=volume_parent,
        size=volume_size,
        realpath=path,
        mountpoint=path,
        fullsize=True,
        label=volume_label,
        attributes=['no-copy-on-write'],
        is_root_volume=True|False
    )
]

Return type

list

kiwi.xml_state.XMLState.is_xen_guest

Check if build type setup specifies a Xen Guest (domX) The check is based on the architecture, the firmware and xen_loader configuration values:

  • We only support Xen setup on the x86_64 architecture

  • Firmware pointing to ec2 means the image is targeted to run in Amazon EC2 which is a Xen guest

  • Machine setup with a xen_loader attribute also indicates a Xen guest target

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.is_xen_server

Check if build type domain setup specifies a Xen Server (dom0)

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.package_matches_host_architecture

Tests if the given package section is applicable for the current host architecture. If no architecture is specified within the section it is considered as a match returning True.

Note: The XML section pointer must provide an arch attribute

Parameters

section – XML section object

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.preferences_matches_host_architecture

Tests if the given preferences section is applicable for the current host architecture. If no architecture is specified within the section it is considered as a match returning True.

Note: The XML section pointer must provide an arch attribute

Parameters

section – XML section object

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.profile_matches_host_architecture

Tests if the given profile section is applicable for the current host architecture. If no architecture is specified within the section it is considered as a match returning True.

Note: The XML section pointer must provide an arch attribute

Parameters

section – XML section object

Returns

True or False

Return type

bool

kiwi.xml_state.XMLState.resolve_this_path

Resolve any this:// repo source path into the path representing the target inside of the image description directory

kiwi.xml_state.XMLState.set_container_config_tag

Set new tag name in containerconfig section

In order to set a new tag value an existing containerconfig and tag setup is required

Parameters

tag () – tag name

kiwi.xml_state.XMLState.set_derived_from_image_uri

Set derived_from attribute to a new value

In order to set a new value the derived_from attribute must be already present in the image configuration

Parameters

uri () – URI

kiwi.xml_state.XMLState.set_repository

Overwrite repository data of the first repository

Parameters
  • repo_source () – repository URI

  • repo_type () – type name defined by schema

  • repo_alias () – alias name

  • repo_prio () – priority number, package manager specific

  • repo_imageinclude () – setup repository inside of the image

  • repo_package_gpgcheck () – enable/disable package gpg checks

  • repo_signing_keys () – list of signing key file names

  • components () – component names for debian repos

  • distribution () – base distribution name for debian repos

  • repo_gpgcheck () – enable/disable repo gpg checks

kiwi.xml_state.XMLState.set_root_filesystem_uuid

Store UUID provided in uuid as state information

Parameters

uuid () – UUID

kiwi.xml_state.XMLState.set_root_partition_uuid

Store PARTUUID provided in uuid as state information

Parameters

uuid () – PARTUUID

kiwi.xml_state.description_type

Bases: tuple

kiwi.xml_state.description_type.author

Alias for field number 0

kiwi.xml_state.description_type.contact

Alias for field number 1

kiwi.xml_state.description_type.specification

Alias for field number 2

kiwi.xml_state.package_type

Bases: tuple

kiwi.xml_state.package_type.package_section

Alias for field number 1

kiwi.xml_state.package_type.packages_section

Alias for field number 0

kiwi.xml_state.size_type

Bases: tuple

kiwi.xml_state.size_type.additive

Alias for field number 1

kiwi.xml_state.size_type.mbytes

Alias for field number 0

kiwi.xml_state.volume_type

Bases: tuple

kiwi.xml_state.volume_type.attributes

Alias for field number 7

kiwi.xml_state.volume_type.fullsize

Alias for field number 5

kiwi.xml_state.volume_type.is_root_volume

Alias for field number 8

kiwi.xml_state.volume_type.label

Alias for field number 6

kiwi.xml_state.volume_type.mountpoint

Alias for field number 4

kiwi.xml_state.volume_type.name

Alias for field number 0

kiwi.xml_state.volume_type.parent

Alias for field number 1

kiwi.xml_state.volume_type.realpath

Alias for field number 3

kiwi.xml_state.volume_type.size

Alias for field number 2

13.1.22 Module Contents

13.2 kiwi.archive Package

13.2.1 Submodules

13.2.2 kiwi.archive.cpio Module

kiwi.archive.cpio.ArchiveCpio

Bases: object

Extraction/Creation of cpio archives

Parameters

filename () – filename to use for archive extraction or creation

kiwi.archive.cpio.ArchiveCpio.create

Create cpio archive

Parameters
  • source_dir () – data source directory

  • exclude () – list of excluded items

kiwi.archive.cpio.ArchiveCpio.extract

Extract cpio archive contents

Parameters

dest_dir () – target data directory

13.2.3 kiwi.archive.tar Module

kiwi.archive.tar.ArchiveTar

Bases: object

Extraction/Creation of tar archives

The tarfile python module is not used by that class, since it does not provide support for some relevant features in comparison to the GNU tar command (e.g. numeric-owner). Moreover tarfile lacks support for xz compression under Python v2.7.

Parameters
  • filename () – filename to use for archive extraction or creation

  • create_from_file_list () – use file list not entire directory to create the archive

  • file_list () – list of files and directorie names to archive

kiwi.archive.tar.ArchiveTar.append_files

Append files to an already existing uncompressed tar archive

Parameters
  • source_dir () – data source directory

  • files_to_append () – list of items to append

  • options () – custom options

kiwi.archive.tar.ArchiveTar.create

Create uncompressed tar archive

Parameters
  • source_dir () – data source directory

  • exclude () – list of excluded items

  • options () – custom creation options

kiwi.archive.tar.ArchiveTar.create_gnu_gzip_compressed

Create gzip compressed tar archive

Parameters
  • source_dir () – data source directory

  • exclude () – list of excluded items

kiwi.archive.tar.ArchiveTar.create_xz_compressed

Create XZ compressed tar archive

Parameters
  • source_dir () – data source directory

  • exclude () – list of excluded items

  • options () – custom tar creation options

  • xz_options () – custom xz compression options

kiwi.archive.tar.ArchiveTar.extract

Extract tar archive contents

Parameters

dest_dir () – target data directory

13.2.4 Module Contents

13.3 kiwi.boot.image Package

13.3.1 Submodules

13.3.2 kiwi.boot.image.base Module

kiwi.boot.image.base.BootImageBase

Bases: object

Base class for boot image(initrd) task

kiwi.boot.image.base.BootImageBase.cleanup

Cleanup temporary boot image data if any

kiwi.boot.image.base.BootImageBase.create_initrd

Implements creation of the initrd

Parameters

Implementation in specialized boot image class

kiwi.boot.image.base.BootImageBase.get_boot_description_directory

Provide path to the boot image XML description

Returns

path name

Return type

str

kiwi.boot.image.base.BootImageBase.get_boot_names

Provides kernel and initrd names for the boot image

Returns

Contains boot_names_type tuple

boot_names_type(
    kernel_name='INSTALLED_KERNEL',
    initrd_name='DRACUT_OUTPUT_NAME',
    kernel_version='KERNEL_VERSION',
    kernel_filename='KERNEL_FILE_NAME'
)

Return type

kiwi.boot.image.base.boot_names_type

kiwi.boot.image.base.BootImageBase.has_initrd_support

Indicates if this instance supports actual creation of an initrd

The method needs to be overwritten by the subclass implementing preparation and creation of an initrd

kiwi.boot.image.base.BootImageBase.import_system_description_elements

Copy information from the system image relevant to create the boot image to the boot image state XML description

kiwi.boot.image.base.BootImageBase.include_file

Include file to boot image

For kiwi boot images this is done by adding package or archive definitions with the bootinclude attribute. Thus for kiwi boot images the method is a noop

Parameters
  • filename () – file path name

  • install_media () – include also for installation media initrd

kiwi.boot.image.base.BootImageBase.include_module

Include module to boot image

For kiwi boot no modules configuration is required. Thus in such a case this method is a noop.

Parameters
  • module () – module to include

  • install_media () – include the module for install initrds

kiwi.boot.image.base.BootImageBase.is_prepared

Check if initrd system is prepared.

Returns

True or False

Return type

bool

kiwi.boot.image.base.BootImageBase.load_boot_xml_description

Load the boot image description referenced by the system image description boot attribute

kiwi.boot.image.base.BootImageBase.omit_module

Omit module to boot image

For kiwi boot no modules configuration is required. Thus in such a case this method is a noop.

Parameters
  • module () – module to omit

  • install_media () – omit the module for install initrds

kiwi.boot.image.base.BootImageBase.post_init

Post initialization method

Implementation in specialized boot image class

kiwi.boot.image.base.BootImageBase.prepare

Prepare new root system to create initrd from. Implementation is only needed if there is no other root system available

Implementation in specialized boot image class

kiwi.boot.image.base.BootImageBase.set_static_modules

Set static modules list for boot image

For kiwi boot no modules configuration is required. Thus in such a case this method is a noop.

Parameters
  • modules () – list of modules to include

  • install_media () – lists the modules for install initrds

kiwi.boot.image.base.BootImageBase.write_system_config_file

Writes relevant boot image configuration into configuration file that will be part of the system image.

This is used to configure any further boot image rebuilds after deployment. For instance, initrds recreated on kernel update.

For kiwi boot no specific configuration is required for initrds recreation, thus this method is a noop in that case.

Parameters
  • config () – dictonary including configuration parameters

  • config_file () – configuration file to write

kiwi.boot.image.base.boot_names_type

Bases: tuple

kiwi.boot.image.base.boot_names_type.initrd_name

Alias for field number 1

kiwi.boot.image.base.boot_names_type.kernel_filename

Alias for field number 3

kiwi.boot.image.base.boot_names_type.kernel_name

Alias for field number 0

kiwi.boot.image.base.boot_names_type.kernel_version

Alias for field number 2

13.3.3 kiwi.boot.image.dracut Module

kiwi.boot.image.dracut.BootImageDracut

Bases: BootImageBase

Implements creation of dracut boot(initrd) images.

kiwi.boot.image.dracut.BootImageDracut.create_initrd

Create kiwi .profile environment to be included in dracut initrd. Call dracut as chroot operation to create the initrd and move the result into the image build target directory

Parameters
kiwi.boot.image.dracut.BootImageDracut.has_initrd_support

This instance supports initrd preparation and creation

kiwi.boot.image.dracut.BootImageDracut.include_file

Include file to dracut boot image

Parameters
  • filename () – file path name

  • install_media () – unused

kiwi.boot.image.dracut.BootImageDracut.include_module

Include module to dracut boot image

Parameters
  • module () – module to include

  • install_media () – unused

kiwi.boot.image.dracut.BootImageDracut.omit_module

Omit module to dracut boot image

Parameters
  • module () – module to omit

  • install_media () – unused

kiwi.boot.image.dracut.BootImageDracut.post_init

Post initialization method

Initialize empty list of dracut caller options

kiwi.boot.image.dracut.BootImageDracut.prepare

Prepare dracut caller environment

  • Setup machine_id(s) to be generic and rebuild by dracut on boot

kiwi.boot.image.dracut.BootImageDracut.set_static_modules

Set static dracut modules list for boot image

Parameters
  • modules () – list of the modules to include

  • install_media () – unused

kiwi.boot.image.dracut.BootImageDracut.write_system_config_file

Writes modules configuration into a dracut configuration file.

Parameters
  • config () – a dictionary containing the modules to add and omit

  • conf_file () – configuration file to write

13.3.4 kiwi.boot.image.builtin_kiwi Module

kiwi.boot.image.builtin_kiwi.BootImageKiwi

Bases: BootImageBase

Implements preparation and creation of kiwi boot(initrd) images

The kiwi initrd is a customized first boot initrd which allows to control the first boot an appliance. The kiwi initrd replaces itself after first boot by the result of dracut.

kiwi.boot.image.builtin_kiwi.BootImageKiwi.cleanup

Cleanup temporary boot image data if any

kiwi.boot.image.builtin_kiwi.BootImageKiwi.create_initrd

Create initrd from prepared boot system tree and compress the result

Parameters
kiwi.boot.image.builtin_kiwi.BootImageKiwi.has_initrd_support

This instance supports initrd preparation and creation

kiwi.boot.image.builtin_kiwi.BootImageKiwi.post_init

Post initialization method

Creates custom directory to prepare the boot image root filesystem which is a separate image to create the initrd from

kiwi.boot.image.builtin_kiwi.BootImageKiwi.prepare

Prepare new root system suitable to create a kiwi initrd from it

13.3.5 Module Contents

kiwi.boot.image.BootImage

Bases: object

BootImge Factory

Parameters
  • xml_state () – Instance of XMLState

  • target_dir () – target dir to store the initrd

  • root_dir () – system image root directory

  • signing_keys () – list of package signing keys

kiwi.boot.image.BootImage.new

13.4 kiwi.bootloader.config Package

13.4.1 Submodules

13.4.2 kiwi.bootloader.config.base Module

kiwi.bootloader.config.base.BootLoaderConfigBase

Bases: object

Base class for bootloader configuration

Parameters
  • xml_state () – instance of XMLState

  • root_dir () – root directory path name

  • custom_args () – custom bootloader arguments dictionary

kiwi.bootloader.config.base.BootLoaderConfigBase.create_efi_path

Create standard EFI boot directory structure

Parameters

in_sub_dir () – toplevel directory

Returns

Full qualified EFI boot path

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.failsafe_boot_entry_requested

Check if a failsafe boot entry is requested

Returns

True or False

Return type

bool

kiwi.bootloader.config.base.BootLoaderConfigBase.get_boot_cmdline

Boot commandline arguments passed to the kernel

Parameters
  • boot_device () – boot device node. If no extra boot device exists then boot device equals root device. In case of an overlay setup the boot device equals the readonly root device

  • write_device () – optional overlay write device node

Returns

kernel boot arguments

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.get_boot_path

Bootloader lookup path on boot device

If the bootloader reads the data it needs to boot, it does that from the configured boot device. Depending if that device is an extra boot partition or the root partition or or based on a non standard filesystem like a btrfs snapshot, the path name varies

Parameters

target () – target name: disk|iso

Returns

path name

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.get_boot_theme

Bootloader Theme name

Returns

theme name

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.get_boot_timeout_seconds

Bootloader timeout in seconds

If no timeout is specified the default timeout applies

Returns

timeout seconds

Return type

int

kiwi.bootloader.config.base.BootLoaderConfigBase.get_continue_on_timeout

Check if the boot should continue after boot timeout or not

Returns

True or False

Return type

bool

kiwi.bootloader.config.base.BootLoaderConfigBase.get_gfxmode

Graphics mode according to bootloader target

Bootloaders which support a graphics mode can be configured to run graphics in a specific resolution and colors. There is no standard for this setup which causes kiwi to create a mapping from the kernel vesa mode number to the corresponding bootloader graphics mode setup

Parameters

target () – bootloader name

Returns

boot graphics mode

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.get_install_image_boot_default

Provide the default boot menu entry identifier for install images

The install image can be configured to provide more than one boot menu entry. Menu entries configured are:

  • [0] Boot From Hard Disk

  • [1] Install

  • [2] Failsafe Install

The installboot attribute controlls which of these are used by default. If not specified the boot from hard disk entry will be the default. Depending on the specified loader type either an entry number or name will be returned.

Parameters

loader () – bootloader name

Returns

menu name or id

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.get_menu_entry_install_title

Prefixed menu entry title for install images

If no displayname is specified in the image description, the menu title is constructed from the image name

Returns

title text

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.get_menu_entry_title

Prefixed menu entry title

If no displayname is specified in the image description, the menu title is constructed from the image name and build type

Parameters

plain () – indicate to add built type into title text

Returns

title text

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.post_init

Post initialization method

Store custom arguments by default

Parameters

custom_args () – custom bootloader arguments

kiwi.bootloader.config.base.BootLoaderConfigBase.quote_title

Quote special characters in the title name

Not all characters can be displayed correctly in the bootloader environment. Therefore a quoting is required

Parameters

name () – title name

Returns

quoted text

Return type

str

kiwi.bootloader.config.base.BootLoaderConfigBase.setup_disk_boot_images

Create bootloader images for disk boot

Some bootloaders requires to build a boot image the bootloader can load from a specific offset address or from a standardized path on a filesystem.

Parameters
  • boot_uuid () – boot device UUID

  • lookup_path () – custom module lookup path

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.setup_disk_image_config

Create boot config file to boot from disk.

Parameters
  • boot_uuid () – boot device UUID

  • root_uuid () – root device UUID

  • hypervisor () – hypervisor name

  • kernel () – kernel name

  • initrd () – initrd name

  • boot_options () – custom options dictionary required to setup the bootloader. The scope of the options covers all information needed to setup and configure the bootloader and gets effective in the individual implementation. boot_options should not be mixed up with commandline options used at boot time. This information is provided from the get_*_cmdline methods. The contents of the dictionary can vary between bootloaders or even not be needed

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.setup_install_boot_images

Create bootloader images for ISO boot an install media

Parameters
  • mbrid () – mbrid file name on boot device

  • lookup_path () – custom module lookup path

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.setup_install_image_config

Create boot config file to boot from install media in EFI mode.

Parameters
  • mbrid () – mbrid file name on boot device

  • hypervisor () – hypervisor name

  • kernel () – kernel name

  • initrd () – initrd name

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.setup_live_boot_images

Create bootloader images for ISO boot a live ISO image

Parameters
  • mbrid () – mbrid file name on boot device

  • lookup_path () – custom module lookup path

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.setup_live_image_config

Create boot config file to boot live ISO image in EFI mode.

Parameters
  • mbrid () – mbrid file name on boot device

  • hypervisor () – hypervisor name

  • kernel () – kernel name

  • initrd () – initrd name

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.setup_sysconfig_bootloader

Create or update etc/sysconfig/bootloader by parameters required according to the bootloader setup

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.write

Write config data to config file.

Implementation in specialized bootloader class required

kiwi.bootloader.config.base.BootLoaderConfigBase.write_meta_data

Write bootloader setup meta data files

Parameters
  • root_device () – root device node

  • write_device () – overlay root write device node

  • boot_options () – kernel options as string

Implementation in specialized bootloader class optional

13.4.3 kiwi.bootloader.config.grub2 Module

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2

Bases: BootLoaderConfigBase

grub2 bootloader configuration.

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.post_init

grub2 post initialization method

Parameters

custom_args () –

Contains grub config arguments

{'grub_directory_name': 'grub|grub2'}

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.setup_disk_boot_images

Create/Provide grub2 boot images and metadata

In order to boot from the disk grub2 modules, images and theme data needs to be created and provided at the correct place in the filesystem

Parameters
  • boot_uuid () – boot device UUID

  • lookup_path () – custom module lookup path

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.setup_disk_image_config

Create grub2 config file to boot from disk using grub2-mkconfig

Parameters
  • boot_uuid () – unused

  • root_uuid () – unused

  • hypervisor () – unused

  • kernel () – unused

  • initrd () – unused

  • boot_options () –

options dictionary that has to contain the root and boot device and optional volume configuration. KIWI has to mount the system prior to run grub2-mkconfig.

{
    'root_device': string,
    'boot_device': string,
    'efi_device': string,
    'system_volumes':
        volume_manager_instance.get_volumes(),
    'system_root_volume':
        volume_manager_instance.get_root_volume_name()
}
kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.setup_install_boot_images

Create/Provide grub2 boot images and metadata

In order to boot from the ISO grub2 modules, images and theme data needs to be created and provided at the correct place on the iso filesystem

Parameters
  • mbrid () – mbrid file name on boot device

  • lookup_path () – custom module lookup path

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.setup_install_image_config

Create grub2 config file to boot from an ISO install image

Parameters
  • mbrid () – mbrid file name on boot device

  • hypervisor () – hypervisor name

  • kernel () – kernel name

  • initrd () – initrd name

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.setup_live_boot_images

Create/Provide grub2 boot images and metadata

Calls setup_install_boot_images because no different action required

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.setup_live_image_config

Create grub2 config file to boot a live media ISO image

Parameters
  • mbrid () – mbrid file name on boot device

  • hypervisor () – hypervisor name

  • kernel () – kernel name

  • initrd () – initrd name

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.write

Write bootloader configuration

  • writes grub.cfg template by KIWI if template system is used

  • creates an embedded fat efi image for EFI ISO boot

kiwi.bootloader.config.grub2.BootLoaderConfigGrub2.write_meta_data

Write bootloader setup meta data files

  • cmdline arguments initialization

  • etc/default/grub setup file

  • etc/default/zipl2grub.conf.in (s390 only)

  • etc/sysconfig/bootloader

Parameters
  • root_device () – root device node

  • write_device () – overlay root write device node

  • boot_options () – kernel options as string

  • iso_boot () – indicate target is an ISO

13.4.4 kiwi.bootloader.config.isolinux Module

kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux

Bases: BootLoaderConfigBase

isolinux bootloader configuration.

kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux.post_init

isolinux post initialization method

Parameters

custom_args () – custom isolinux config arguments

kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux.setup_install_boot_images

Provide isolinux boot metadata

No extra boot images must be created for isolinux

Parameters
  • mbrid () – unused

  • lookup_path () – unused

kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux.setup_install_image_config

Create isolinux.cfg in memory from a template suitable to boot from an ISO image in BIOS boot mode

Parameters
  • mbrid () – mbrid file name on boot device

  • hypervisor () – hypervisor name

  • kernel () – kernel name

  • initrd () – initrd name

kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux.setup_live_boot_images

Provide isolinux boot metadata

No extra boot images must be created for isolinux

Parameters
  • mbrid () – unused

  • lookup_path () – unused

kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux.setup_live_image_config

Create isolinux.cfg in memory from a template suitable to boot a live system from an ISO image in BIOS boot mode

Parameters
  • mbrid () – mbrid file name on boot device

  • hypervisor () – hypervisor name

  • kernel () – kernel name

  • initrd () – initrd name

kiwi.bootloader.config.isolinux.BootLoaderConfigIsoLinux.write

Write isolinux.cfg and isolinux.msg file

13.4.5 Module Contents

kiwi.bootloader.config.BootLoaderConfig

Bases: object

BootLoaderConfig factory

Parameters
  • name () – bootloader name

  • xml_state () – instance of XMLState

  • root_dir () – root directory path name

  • custom_args () – custom bootloader config arguments dictionary

kiwi.bootloader.config.BootLoaderConfig.new

13.5 kiwi.bootloader.install Package

13.5.1 Submodules

13.5.2 kiwi.bootloader.install.base Module

kiwi.bootloader.install.base.BootLoaderInstallBase

Bases: object

Base class for bootloader installation on device

Parameters
  • root_dir () – root directory path name

  • device_provider () – instance of DeviceProvider

  • custom_args () – custom arguments dictionary

kiwi.bootloader.install.base.BootLoaderInstallBase.install

Install bootloader on self.device

Implementation in specialized bootloader install class required

kiwi.bootloader.install.base.BootLoaderInstallBase.install_required

Check if bootloader needs to be installed

Implementation in specialized bootloader install class required

kiwi.bootloader.install.base.BootLoaderInstallBase.post_init

Post initialization method

Store custom arguments by default

Parameters

custom_args () – custom bootloader arguments

kiwi.bootloader.install.base.BootLoaderInstallBase.secure_boot_install

Run shim-install in self.device for secure boots

Implementation in specialized bootloader install class required

13.5.3 kiwi.bootloader.install.grub2 Module

kiwi.bootloader.install.grub2.BootLoaderInstallGrub2

Bases: BootLoaderInstallBase

grub2 bootloader installation

kiwi.bootloader.install.grub2.BootLoaderInstallGrub2.install

Install bootloader on disk device

kiwi.bootloader.install.grub2.BootLoaderInstallGrub2.install_required

Check if grub2 has to be installed

Take architecture and firmware setup into account to check if bootloader code in a boot record is required

Returns

True or False

Return type

bool

kiwi.bootloader.install.grub2.BootLoaderInstallGrub2.post_init

grub2 post initialization method

Parameters

custom_args () –

Contains custom grub2 bootloader arguments

{
    'target_removable': bool,
    'system_volumes': list_of_volumes,
    'system_root_volume': root volume name if required
    'firmware': FirmWare_instance,
    'efi_device': string,
    'boot_device': string,
    'root_device': string
}

kiwi.bootloader.install.grub2.BootLoaderInstallGrub2.secure_boot_install

Run shim-install in self.device for secure boots

Implementation in specialized bootloader install class required

kiwi.bootloader.install.grub2.BootLoaderInstallGrub2.set_disk_password

13.5.4 Module Contents

kiwi.bootloader.install.BootLoaderInstall

Bases: object

BootLoaderInstall Factory

Parameters
  • name () – bootloader name

  • root_dir () – root directory path name

  • device_provider () – instance of DeviceProvider

  • custom_args () – custom arguments dictionary

kiwi.bootloader.install.BootLoaderInstall.new

13.6 kiwi.bootloader Package

13.6.1 Module Contents

13.7 kiwi.bootloader.template Package

13.7.1 Submodules

13.7.2 kiwi.bootloader.template.grub2 Module

kiwi.bootloader.template.grub2.BootLoaderTemplateGrub2

Bases: object

grub2 configuraton file templates

kiwi.bootloader.template.grub2.BootLoaderTemplateGrub2.get_install_template

Bootloader configuration template for install media

Parameters
  • failsafe () – with failsafe true|false

  • hybrid () – with hybrid true|false

  • terminal () – output terminal name

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.grub2.BootLoaderTemplateGrub2.get_iso_template

Bootloader configuration template for live ISO media

Parameters
  • failsafe () – with failsafe true|false

  • hybrid () – with hybrid true|false

  • terminal () – output terminal name

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.grub2.BootLoaderTemplateGrub2.get_multiboot_install_template

Bootloader configuration template for install media with hypervisor, e.g Xen dom0

Parameters
  • failsafe () – with failsafe true|false

  • terminal () – output terminal name

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.grub2.BootLoaderTemplateGrub2.get_multiboot_iso_template

Bootloader configuration template for live ISO media with hypervisor, e.g Xen dom0

Parameters
  • failsafe () – with failsafe true|false

  • terminal () – output terminal name

Returns

instance of Template

Return type

Template

13.7.3 kiwi.bootloader.template.isolinux Module

kiwi.bootloader.template.isolinux.BootLoaderTemplateIsoLinux

Bases: object

isolinux configuraton file templates

kiwi.bootloader.template.isolinux.BootLoaderTemplateIsoLinux.get_install_message_template

Bootloader template for text message file in install mode. isolinux displays this as menu if no graphics mode can be initialized

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.isolinux.BootLoaderTemplateIsoLinux.get_install_template

Bootloader configuration template for install media

Parameters
  • failsafe () – with failsafe true|false

  • with_theme () – with graphics theme true|false

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.isolinux.BootLoaderTemplateIsoLinux.get_message_template

Bootloader template for text message file. isolinux displays this as menu if no graphics mode can be initialized

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.isolinux.BootLoaderTemplateIsoLinux.get_multiboot_install_template

Bootloader configuration template for install media with hypervisor, e.g Xen dom0

Parameters
  • failsafe () – with failsafe true|false

  • with_theme () – with graphics theme true|false

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.isolinux.BootLoaderTemplateIsoLinux.get_multiboot_template

Bootloader configuration template for live media with hypervisor, e.g Xen dom0

Parameters
  • failsafe () – with failsafe true|false

  • with_theme () – with graphics theme true|false

Returns

instance of Template

Return type

Template

kiwi.bootloader.template.isolinux.BootLoaderTemplateIsoLinux.get_template

Bootloader configuration template for live media

Parameters
  • failsafe () – with failsafe true|false

  • with_theme () – with graphics theme true|false

Returns

instance of Template

Return type

Template

13.7.4 Module Contents

13.8 kiwi.boot Package

13.8.1 Module Contents

13.9 kiwi.builder Package

13.9.1 Submodules

13.9.2 kiwi.builder.archive Module

kiwi.builder.archive.ArchiveBuilder

Bases: object

Root archive image builder

Parameters
  • xml_state () – Instance of XMLState

  • target_dir () – target directory path name

  • root_dir () – root directory path name

  • custom_args () – Custom processing arguments defined as hash keys: * xz_options: string of XZ compression parameters

kiwi.builder.archive.ArchiveBuilder.create

Create a root archive tarball

Build a simple XZ compressed root tarball from the image root tree

Image types which triggers this builder are:

  • image=”tbz”

  • image=”cpio”

Returns

result

Return type

instance of Result

13.9.3 kiwi.builder.container Module

kiwi.builder.container.ContainerBuilder

Bases: object

Container image builder

Parameters
  • xml_state () – Instance of XMLState

  • target_dir () – target directory path name

  • root_dir () – root directory path name

  • custom_args () – Custom processing arguments defined as hash keys: * xz_options: string of XZ compression parameters

kiwi.builder.container.ContainerBuilder.create

Builds a container image which is usually a data archive including container specific metadata.

Image types which triggers this builder are:

  • image=”docker”

  • image=”oci”

  • image=”appx”

Returns

result

Return type

instance of Result

13.9.4 kiwi.builder.disk Module

kiwi.builder.disk.DiskBuilder

Bases: object

Disk image builder

Parameters
  • xml_state () – Instance of XMLState

  • target_dir () – Target directory path name

  • root_dir () – Root directory path name

  • custom_args () – Custom processing arguments defined as hash keys: * signing_keys: list of package signing keys * xz_options: string of XZ compression parameters

kiwi.builder.disk.DiskBuilder.append_unpartitioned_space

Extends the raw disk if an unpartitioned area is specified

kiwi.builder.disk.DiskBuilder.create

Build a bootable disk image and optional installation image The installation image is a bootable hybrid ISO image which embeds the disk image and an image installer

Image types which triggers this builder are:

  • image=”oem”

Returns

result

Return type

instance of Result

kiwi.builder.disk.DiskBuilder.create_disk

Build a bootable raw disk image

Raises
Returns

result

Return type

instance of Result

kiwi.builder.disk.DiskBuilder.create_disk_format

Create a bootable disk format from a previously created raw disk image

Parameters

result_instance () – instance of Result

Returns

updated result_instance

Return type

instance of Result

kiwi.builder.disk.DiskBuilder.create_install_media

Build an installation image. The installation image is a bootable hybrid ISO image which embeds the raw disk image and an image installer

Parameters

result_instance () – instance of Result

Returns

updated result_instance with installation media

Return type

instance of Result

13.9.5 kiwi.builder.filesystem Module

kiwi.builder.filesystem.FileSystemBuilder

Bases: object

Filesystem image builder

Parameters
  • xml_state () – Instance of XMLState

  • target_dir () – target directory path name

  • root_dir () – root directory path name

  • custom_args () – Custom processing arguments defined as hash keys: * None

kiwi.builder.filesystem.FileSystemBuilder.create

Build a mountable filesystem image

Image types which triggers this builder are:

  • image=”ext2”

  • image=”ext3”

  • image=”ext4”

  • image=”btrfs”

  • image=”xfs”

Returns

result

Return type

instance of Result

13.9.6 kiwi.builder.install Module

kiwi.builder.install.InstallImageBuilder

Bases: object

Installation image builder

Parameters
  • xml_state () – instance of XMLState

  • root_dir () – system image root directory

  • target_dir () – target directory path name

  • boot_image_task () – instance of BootImage

  • custom_args () – Custom processing arguments defined as hash keys: * xz_options: string of XZ compression parameters

kiwi.builder.install.InstallImageBuilder.create_install_iso

Create an install ISO from the disk_image as hybrid ISO bootable via legacy BIOS, EFI and as disk from Stick

Image types which triggers this builder are:

  • installiso=”true|false”

  • installstick=”true|false”

kiwi.builder.install.InstallImageBuilder.create_install_pxe_archive

Create an oem install tar archive suitable for installing a disk image via the network using the PXE boot protocol. The archive contains:

  • The raw system image xz compressed

  • The raw system image checksum metadata file

  • The append file template for the boot server

  • The system image initrd for kexec

  • The install initrd

  • The kernel

Image types which triggers this builder are:

  • installpxe=”true|false”

13.9.7 kiwi.builder.live Module

kiwi.builder.live.LiveImageBuilder

Bases: object

Live image builder

Parameters
  • xml_state () – instance of XMLState

  • target_dir () – target directory path name

  • root_dir () – root directory path name

  • custom_args () – Custom processing arguments

kiwi.builder.live.LiveImageBuilder.create

Build a bootable hybrid live ISO image

Image types which triggers this builder are:

  • image=”iso”

Raises

kiwi.exceptions.KiwiLiveBootImageError – if no kernel or hipervisor is found in boot image tree

Returns

result

Return type

instance of Result

13.9.8 kiwi.builder.kis Module

kiwi.builder.kis.KisBuilder

Bases: object

Filesystem based image builder.

Parameters
  • xml_state () – instance of XMLState

  • target_dir () – target directory path name

  • root_dir () – system image root directory

  • custom_args () – Custom processing arguments defined as hash keys: * signing_keys: list of package signing keys * xz_options: string of XZ compression parameters

kiwi.builder.kis.KisBuilder.create

Build a component image consisting out of a boot image(initrd) plus its appropriate kernel files and the root filesystem image with a checksum.

Image types which triggers this builder are:

  • image=”kis”

  • image=”pxe”

Raises

kiwi.exceptions.KiwiKisBootImageError – if no kernel or hipervisor is found in boot image tree

Returns

result

Return type

instance of Result

13.9.9 Module Contents

kiwi.builder.ImageBuilder

Bases: object

Image builder factory

kiwi.builder.ImageBuilder.new

13.10 kiwi.container Package

13.10.1 Submodules

13.10.2 kiwi.container.oci Module

kiwi.container.oci.ContainerImageOCI

Bases: ContainerImageBase

Create oci container from a root directory

Parameters
  • root_dir () – root directory path name

  • custom_args () –

Custom processing arguments defined as hash keys:

Example

{
    'container_name': 'name',
    'container_tag': '1.0',
    'additional_names': ['current', 'foobar'],
    'entry_command': ['/bin/bash', '-x'],
    'entry_subcommand': ['ls', '-l'],
    'maintainer': 'tux',
    'user': 'root',
    'workingdir': '/root',
    'expose_ports': ['80', '42'],
    'volumes': ['/var/log', '/tmp'],
    'environment': {'PATH': '/bin'},
    'labels': {'name': 'value'},
    'history': {
        'created_by': 'some explanation here',
        'comment': 'some comment here',
        'author': 'tux'
    }
}
kiwi.container.oci.ContainerImageOCI.create

Create compressed oci system container tar archive

Parameters
  • filename () – archive file name

  • base_image () – archive used as a base image

  • ensure_empty_tmpdirs () – exclude system tmp directories

  • compress_archive () – compress container archive

kiwi.container.oci.OciConfig

Bases: TypedDict

kiwi.container.oci.OciConfig.additional_names
kiwi.container.oci.OciConfig.container_name
kiwi.container.oci.OciConfig.container_tag
kiwi.container.oci.OciConfig.entry_command
kiwi.container.oci.OciConfig.entry_subcommand
kiwi.container.oci.OciConfig.environment
kiwi.container.oci.OciConfig.expose_ports
kiwi.container.oci.OciConfig.history
kiwi.container.oci.OciConfig.labels
kiwi.container.oci.OciConfig.maintainer
kiwi.container.oci.OciConfig.user
kiwi.container.oci.OciConfig.volumes
kiwi.container.oci.OciConfig.workingdir

13.10.3 Module Contents

kiwi.container.ContainerImage

Bases: object

Container Image factory

Parameters
  • name () – container system name

  • root_dir () – root directory path name

  • custom_args () – custom arguments

kiwi.container.ContainerImage.new

13.11 kiwi.container.setup Package

13.11.1 Submodules

13.11.2 kiwi.container.setup.base Module

kiwi.container.setup.base.ContainerSetupBase

Bases: object

Base class for setting up the root system to create a container image from for e.g docker. The methods here are generic to linux systems following the FHS standard and modern enough e.g based on systemd

Attributes

  • root_dir

    root directory path name

  • custom_args

    dict of custom arguments

kiwi.container.setup.base.ContainerSetupBase.deactivate_bootloader_setup

Container bootloader setup

Tell the system there is no bootloader configuration it needs to care for. A container does not boot

kiwi.container.setup.base.ContainerSetupBase.deactivate_root_filesystem_check

Container filesystem check setup

The root filesystem of a container could be an overlay or a mapped device. In any case it should not be checked for consistency as this is should be done by the container infrastructure

kiwi.container.setup.base.ContainerSetupBase.deactivate_systemd_service

Container system services setup

Init systems among others also controls services which starts at boot time. A container does not really boot. Thus some services needs to be deactivated

Parameters

name () – systemd service name

kiwi.container.setup.base.ContainerSetupBase.get_container_name

Container name

Returns

name

Return type

str

kiwi.container.setup.base.ContainerSetupBase.post_init

Post initialization method

Implementation in specialized container setup class

Parameters

custom_args () – unused

kiwi.container.setup.base.ContainerSetupBase.setup

Setup container metadata

Implementation in specialized bootloader class required

kiwi.container.setup.base.ContainerSetupBase.setup_root_console

Container console setup

/dev/console should be allowed to login by root

13.11.3 kiwi.container.setup.docker Module

kiwi.container.setup.docker.ContainerSetupDocker

Bases: ContainerSetupOCI

Docker container setup

13.11.4 Module Contents

kiwi.container.setup.ContainerSetup

Bases: object

container setup factory

kiwi.container.setup.ContainerSetup.new

13.12 kiwi.filesystem Package

13.12.1 Submodules

13.12.2 kiwi.filesystem.base Module

kiwi.filesystem.base.FileSystemBase

Bases: object

Implements base class for filesystem interface

Parameters
  • device_provider () – Instance of a class based on DeviceProvider required for filesystems which needs a block device for creation. In most cases the DeviceProvider is a LoopDevice

  • root_dir () – root directory path name

  • custom_args () – custom filesystem arguments

kiwi.filesystem.base.FileSystemBase.create_on_device

Create filesystem on block device

Implement in specialized filesystem class for filesystems which requires a block device for creation, e.g ext4.

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – UUID name

kiwi.filesystem.base.FileSystemBase.create_on_file

Create filesystem from root data tree

Implement in specialized filesystem class for filesystems which requires a data tree for creation, e.g squashfs.

Parameters
  • filename () – result file path name

  • label () – label name

  • exclude () – list of exclude dirs/files

kiwi.filesystem.base.FileSystemBase.create_verification_metadata

Write verification block at the end of the device

Parameters

device_node () – Target device node, if not specified the root device from this instance is used

kiwi.filesystem.base.FileSystemBase.create_verity_layer

Create veritysetup on device

Parameters
  • block () – Number of blocks to use for veritysetup. If not specified the entire root device is used

  • filename () – Target filename to use for VeritySetup. If not specified the filename or block special provided at object construction time is used

kiwi.filesystem.base.FileSystemBase.get_mountpoint

Provides mount point directory

Effective use of the directory is guaranteed only after sync_data

Returns

directory path name

Return type

string

kiwi.filesystem.base.FileSystemBase.mount

Mount the filesystem

kiwi.filesystem.base.FileSystemBase.post_init

Post initialization method

Store dictionary of custom arguments if not empty. This overrides the default custom argument hash

Parameters

custom_args () –

custom arguments

{
    'create_options': ['option'],
    'mount_options': ['option'],
    'meta_data': {
        'key': 'value'
    }
}

kiwi.filesystem.base.FileSystemBase.set_uuid

Create new random filesystem UUID

Implement in specialized filesystem class for filesystems which supports the concept of an UUID and allows to change it

kiwi.filesystem.base.FileSystemBase.sync_data

Copy root data tree into filesystem

Parameters

exclude () – list of exclude dirs/files

kiwi.filesystem.base.FileSystemBase.umount

Umounts the filesystem in case it is mounted, does nothing otherwise

13.12.3 kiwi.filesystem.btrfs Module

kiwi.filesystem.btrfs.FileSystemBtrfs

Bases: FileSystemBase

Implements creation of btrfs filesystem

kiwi.filesystem.btrfs.FileSystemBtrfs.create_on_device

Create btrfs filesystem on block device

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – UUID name

kiwi.filesystem.btrfs.FileSystemBtrfs.set_uuid

Create new random filesystem UUID

13.12.4 kiwi.filesystem.clicfs Module

kiwi.filesystem.clicfs.FileSystemClicFs

Bases: FileSystemBase

Implements creation of clicfs filesystem

kiwi.filesystem.clicfs.FileSystemClicFs.create_on_file

Create clicfs filesystem from data tree

There is no label which could be set for clicfs thus this parameter is not used

There is no option to exclude data from clicfs thus this parameter is not used

Parameters
  • filename () – result file path name

  • label () – unused

  • exclude () – unused

kiwi.filesystem.clicfs.FileSystemClicFs.post_init

Post initialization method

Initialize temporary container_dir directory to store clicfs embeded filesystem

Parameters

custom_args () – unused

13.12.5 kiwi.filesystem.ext2 Module

kiwi.filesystem.ext2.FileSystemExt2

Bases: FileSystemBase

Implements creation of ext2 filesystem

kiwi.filesystem.ext2.FileSystemExt2.create_on_device

Create ext2 filesystem on block device

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – UUID name

kiwi.filesystem.ext2.FileSystemExt2.set_uuid

Create new random filesystem UUID

13.12.6 kiwi.filesystem.ext3 Module

kiwi.filesystem.ext3.FileSystemExt3

Bases: FileSystemBase

Implements creation of ext3 filesystem

kiwi.filesystem.ext3.FileSystemExt3.create_on_device

Create ext3 filesystem on block device

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – UUID name

kiwi.filesystem.ext3.FileSystemExt3.set_uuid

Create new random filesystem UUID

13.12.7 kiwi.filesystem.ext4 Module

kiwi.filesystem.ext4.FileSystemExt4

Bases: FileSystemBase

Implements creation of ext4 filesystem

kiwi.filesystem.ext4.FileSystemExt4.create_on_device

Create ext4 filesystem on block device

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – UUID name

kiwi.filesystem.ext4.FileSystemExt4.set_uuid

Create new random filesystem UUID

13.12.8 kiwi.filesystem.fat16 Module

kiwi.filesystem.fat16.FileSystemFat16

Bases: FileSystemBase

Implements creation of fat16 filesystem

kiwi.filesystem.fat16.FileSystemFat16.create_on_device

Create fat16 filesystem on block device

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – Volume Label, there is no real UUID on fat

kiwi.filesystem.fat16.FileSystemFat16.set_uuid

Create new random filesystem UUID

13.12.9 kiwi.filesystem.fat32 Module

kiwi.filesystem.fat32.FileSystemFat32

Bases: FileSystemBase

Implements creation of fat32 filesystem

kiwi.filesystem.fat32.FileSystemFat32.create_on_device

Create fat32 filesystem on block device

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – Volume Label, there is no real UUID on fat

kiwi.filesystem.fat32.FileSystemFat32.set_uuid

Create new random filesystem UUID

13.12.10 kiwi.filesystem.isofs Module

kiwi.filesystem.isofs.FileSystemIsoFs

Bases: FileSystemBase

Implements creation of iso filesystem

kiwi.filesystem.isofs.FileSystemIsoFs.create_on_file

Create iso filesystem from data tree

There is no label which could be set for iso filesystem thus this parameter is not used

Parameters
  • filename () – result file path name

  • label () – unused

  • exclude () – unused

13.12.11 kiwi.filesystem.setup Module

kiwi.filesystem.setup.FileSystemSetup

Bases: object

Implement filesystem setup methods

Methods from this class provides information from the root directory required before building a filesystem image

Parameters
  • xml_state () – Instance of XMLState

  • root_dir () – root directory path

kiwi.filesystem.setup.FileSystemSetup.get_size_mbytes

Precalculate the requires size in mbytes to store all data from the root directory in the requested filesystem. Return the configured value if present, if not return the calculated result

Parameters

filesystem () – name

Returns

mbytes

Return type

int

13.12.12 kiwi.filesystem.squashfs Module

kiwi.filesystem.squashfs.FileSystemSquashFs

Bases: FileSystemBase

Implements creation of squashfs filesystem

kiwi.filesystem.squashfs.FileSystemSquashFs.create_on_file

Create squashfs filesystem from data tree

There is no label which could be set for squashfs thus this parameter is not used

Parameters
  • filename () – result file path name

  • label () – unused

  • exclude () – list of exclude dirs/files

13.12.13 kiwi.filesystem.xfs Module

kiwi.filesystem.xfs.FileSystemXfs

Bases: FileSystemBase

Implements creation of xfs filesystem

kiwi.filesystem.xfs.FileSystemXfs.create_on_device

Create xfs filesystem on block device

Parameters
  • label () – label name

  • size () – size value, can also be counted from the end via -X The value is interpreted in units of: unit

  • unit () – unit name. Default unit is set to: defaults.UNIT.kb

  • uuid () – UUID name

kiwi.filesystem.xfs.FileSystemXfs.set_uuid

Create new random filesystem UUID

13.12.14 Module Contents

kiwi.filesystem.FileSystem

Bases: object

FileSystem factory

Parameters
  • name () – filesystem name

  • device_provider () – Instance of DeviceProvider

  • root_dir () – root directory path name

  • custom_args () – dict of custom filesystem arguments

kiwi.filesystem.FileSystem.new

13.13 kiwi.iso_tools Package

13.13.1 Submodules

13.13.2 kiwi.iso_tools.base Module

kiwi.iso_tools.base.IsoToolsBase

Bases: object

Base Class for Parameter API for iso creation tools

kiwi.iso_tools.base.IsoToolsBase.add_efi_loader_parameters

Add ISO creation parameters to embed the EFI loader

Implementation in specialized tool class

kiwi.iso_tools.base.IsoToolsBase.create_iso

Create iso file

Implementation in specialized tool class

Parameters
  • filename () – unused

  • hidden_files () – unused

kiwi.iso_tools.base.IsoToolsBase.get_tool_name

Return caller name for iso creation tool

Implementation in specialized tool class

Returns

tool name

Return type

str

kiwi.iso_tools.base.IsoToolsBase.has_iso_hybrid_capability

Indicate if the iso tool has the capability to embed a partition table into the iso such that it can be used as both; an iso and a disk

Implementation in specialized tool class

kiwi.iso_tools.base.IsoToolsBase.init_iso_creation_parameters

Create a set of standard parameters for the main isolinux loader

Implementation in specialized tool class

Parameters

custom_args () – unused

kiwi.iso_tools.base.IsoToolsBase.list_iso

List contents of an ISO image

Parameters

isofile () – unused

kiwi.iso_tools.base.IsoToolsBase.setup_media_loader_directory

13.13.3 kiwi.iso_tools.xorriso Module

kiwi.iso_tools.xorriso.IsoToolsXorrIso

Bases: IsoToolsBase

xorriso wrapper class

Implementation of Parameter API for iso creation tools using the libburnia project. Addressed here is the tool xorriso

kiwi.iso_tools.xorriso.IsoToolsXorrIso.add_efi_loader_parameters

Add ISO creation parameters to embed the EFI loader

In order to boot the ISO from EFI, the EFI binary is added as alternative loader to the ISO creation parameter list. The EFI binary must be included into a fat filesystem in order to become recognized by the firmware. For details about this file refer to _create_embedded_fat_efi_image() from bootloader/config/grub2.py

kiwi.iso_tools.xorriso.IsoToolsXorrIso.create_iso

Creates the iso file with the given filename using xorriso

Parameters
  • filename () – output filename

  • hidden_files () – list of hidden files

kiwi.iso_tools.xorriso.IsoToolsXorrIso.get_tool_name

Lookup xorriso in search path

Raises

kiwi.exceptions.KiwiIsoToolError – if xorriso tool is not found

Returns

xorriso tool path

Return type

str

kiwi.iso_tools.xorriso.IsoToolsXorrIso.has_iso_hybrid_capability

Indicate if the iso tool has the capability to embed a partition table into the iso such that it can be used as both; an iso and a disk

Returns

True or False

Return type

bool

kiwi.iso_tools.xorriso.IsoToolsXorrIso.init_iso_creation_parameters

Create a set of standard parameters

Parameters

custom_args () – custom ISO meta data

13.13.4 kiwi.iso_tools.iso Module

kiwi.iso_tools.iso.Iso

Bases: object

Implements helper methods around the creation of ISO filesystems

kiwi.iso_tools.iso.Iso.set_media_tag

Include checksum tag in the ISO so it can be verified with the mediacheck program.

Parameters

isofile () – path to the ISO file

kiwi.iso_tools.iso.Iso.setup_isolinux_boot_path

Write the base boot path into the isolinux loader binary

Raises

kiwi.exceptions.KiwiIsoLoaderError – if loader/isolinux.bin is not found

13.13.5 Module Contents

kiwi.iso_tools.IsoTools

Bases: object

IsoTools factory

kiwi.iso_tools.IsoTools.new

13.14 kiwi.package_manager Package

13.14.1 Submodules

13.14.2 kiwi.package_manager.base Module

kiwi.package_manager.base.PackageManagerBase

Bases: object

Implements base class for Package Management

Parameters
  • repository () – instance of Repository

  • root_dir () – root directory path name

  • package_requests () – list of packages to install or delete

  • collection_requests () – list of collections to install

  • product_requests () – list of products to install

kiwi.package_manager.base.PackageManagerBase.clean_leftovers

Cleans package manager related data not needed in the resulting image such as custom macros

Implementation in specialized package manager class

kiwi.package_manager.base.PackageManagerBase.cleanup_requests

Cleanup request queues

kiwi.package_manager.base.PackageManagerBase.database_consistent
kiwi.package_manager.base.PackageManagerBase.dump_reload_package_database
kiwi.package_manager.base.PackageManagerBase.get_error_details

Provide further error details

In case the package manager call failed this method will return package manager specific error information if there is any

Returns

further error data as str or empty str

Return type

str

kiwi.package_manager.base.PackageManagerBase.has_failed

Evaluate given result return code

Any returncode != 0 is considered an error unless overwritten in specialized package manager class

Parameters

returncode () – return code number

Returns

True|False

Return type

boolean

kiwi.package_manager.base.PackageManagerBase.match_package_deleted

Match expression to indicate a package has been deleted

Implementation in specialized package manager class

Parameters
  • package_name () – unused

  • package_manager_output () – unused

Returns

True|False

Return type

bool

kiwi.package_manager.base.PackageManagerBase.match_package_installed

Match expression to indicate a package has been installed

Implementation in specialized package manager class

Parameters
  • package_name () – unused

  • package_manager_output () – unused

Returns

True|False

Return type

bool

kiwi.package_manager.base.PackageManagerBase.post_init

Post initialization method

Implementation in specialized package manager class

Parameters

custom_args () – unused

kiwi.package_manager.base.PackageManagerBase.post_process_delete_requests

Process extra code required after deleting packages

Implementation in specialized package manager class

kiwi.package_manager.base.PackageManagerBase.post_process_install_requests_bootstrap

Process extra code required after bootstrapping

Implementation in specialized package manager class

kiwi.package_manager.base.PackageManagerBase.process_delete_requests

Process package delete requests (chroot)

Implementation in specialized package manager class

Parameters

force () – unused

kiwi.package_manager.base.PackageManagerBase.process_install_requests

Process package install requests for image phase (chroot)

Implementation in specialized package manager class

kiwi.package_manager.base.PackageManagerBase.process_install_requests_bootstrap

Process package install requests for bootstrap phase (no chroot)

Implementation in specialized package manager class

kiwi.package_manager.base.PackageManagerBase.process_only_required

Setup package processing only for required packages

Implementation in specialized package manager class

Setup package processing to also include recommended dependencies

Implementation in specialized package manager class

kiwi.package_manager.base.PackageManagerBase.request_collection

Queue a package collection

Implementation in specialized package manager class

Parameters

name () – unused

kiwi.package_manager.base.PackageManagerBase.request_package

Queue a package request

Implementation in specialized package manager class

Parameters

name () – unused

kiwi.package_manager.base.PackageManagerBase.request_package_exclusion

Queue a package exclusion(skip) request

Implementation in specialized package manager class

Parameters

name () – unused

kiwi.package_manager.base.PackageManagerBase.request_package_lock
kiwi.package_manager.base.PackageManagerBase.request_product

Queue a product request

Implementation in specialized package manager class

Parameters

name () – unused

kiwi.package_manager.base.PackageManagerBase.setup_repository_modules

Setup repository modules and streams

Implementation in specialized package manager class

Parameters

collection_modules () – unused

kiwi.package_manager.base.PackageManagerBase.update

Process package update requests (chroot)

Implementation in specialized package manager class

13.14.3 kiwi.package_manager.dnf4 Module

kiwi.package_manager.dnf4.PackageManagerDnf4

Bases: PackageManagerBase

*Implements base class for installation/deletion of packages and collections using dnf*

Parameters
  • dnf_args () – dnf arguments from repository runtime configuration

  • command_env () – dnf command environment from repository runtime configuration

kiwi.package_manager.dnf4.PackageManagerDnf4.clean_leftovers

Cleans package manager related data not needed in the resulting image such as custom macros

kiwi.package_manager.dnf4.PackageManagerDnf4.match_package_deleted

Match expression to indicate a package has been deleted

Parameters
  • package_name () – package_name

  • package_manager_output () – dnf status line

Returns

True|False

Return type

bool

kiwi.package_manager.dnf4.PackageManagerDnf4.match_package_installed

Match expression to indicate a package has been installed

This match for the package to be installed in the output of the dnf command is not 100% accurate. There might be false positives due to sub package names starting with the same base package name

Parameters
  • package_name () – package_name

  • package_manager_output () – dnf status line

Returns

True|False

Return type

bool

kiwi.package_manager.dnf4.PackageManagerDnf4.post_init

Post initialization method

Parameters

custom_args () – custom dnf arguments

kiwi.package_manager.dnf4.PackageManagerDnf4.post_process_install_requests_bootstrap

Move the rpm database to the place as it is expected by the rpm package installed during bootstrap phase

Parameters
  • root_bind () – unused

  • delta_root () – unused

kiwi.package_manager.dnf4.PackageManagerDnf4.process_delete_requests

Process package delete requests (chroot)

Parameters

force () – force deletion: true|false

Raises

kiwi.exceptions.KiwiRequestError – if none of the packages to delete is installed.

Returns

process results in command type

Return type

namedtuple

kiwi.package_manager.dnf4.PackageManagerDnf4.process_install_requests

Process package install requests for image phase (chroot)

Returns

process results in command type

Return type

namedtuple

kiwi.package_manager.dnf4.PackageManagerDnf4.process_install_requests_bootstrap

Process package install requests for bootstrap phase (no chroot)

Parameters
  • root_bind () – unused

  • bootstrap_package () – unused

Returns

process results in command type

Return type

namedtuple

kiwi.package_manager.dnf4.PackageManagerDnf4.process_only_required

Setup package processing only for required packages

Setup package processing to also include recommended dependencies.

kiwi.package_manager.dnf4.PackageManagerDnf4.request_collection

Queue a collection request

Parameters

name () – dnf group ID name

kiwi.package_manager.dnf4.PackageManagerDnf4.request_package

Queue a package request

Parameters

name () – package name

kiwi.package_manager.dnf4.PackageManagerDnf4.request_package_exclusion

Queue a package exclusion(skip) request

Parameters

name () – package name

kiwi.package_manager.dnf4.PackageManagerDnf4.request_product

Queue a product request

There is no product definition in the fedora repo data

Parameters

name () – unused

kiwi.package_manager.dnf4.PackageManagerDnf4.setup_repository_modules

Setup repository modules and streams

Parameters

collection_modules () –

Expect dict of the form:

{
    'enable': [
        "module:stream", "module"
    ],
    'disable': [
        "module"
    ]
}

kiwi.package_manager.dnf4.PackageManagerDnf4.update

Process package update requests (chroot)

Returns

process results in command type

Return type

namedtuple

13.14.4 kiwi.package_manager.zypper Module

kiwi.package_manager.zypper.PackageManagerZypper

Bases: PackageManagerBase

Implements Installation/Deletion of packages/collections with zypper

Parameters
  • zypper_args () – zypper arguments from repository runtime configuration

  • command_env () – zypper command environment from repository runtime configuration

kiwi.package_manager.zypper.PackageManagerZypper.clean_leftovers

Cleans package manager related data not needed in the resulting image such as custom macros

kiwi.package_manager.zypper.PackageManagerZypper.has_failed

Evaluate given result return code

In zypper any return code == 0 or >= 100 is considered success. Any return code different from 0 and < 100 is treated as an error we care for. Return codes >= 100 indicates an issue like ‘new kernel needs reboot of the system’ or similar which we don’t care in the scope of image building

Parameters

returncode () – return code number

Returns

True|False

Return type

boolean

kiwi.package_manager.zypper.PackageManagerZypper.match_package_deleted

Match expression to indicate a package has been deleted

Parameters
  • package_name () – package_name

  • package_manager_output () – zypper status line

Returns

True|False

Return type

bool

kiwi.package_manager.zypper.PackageManagerZypper.match_package_installed

Match expression to indicate a package has been installed

This match for the package to be installed in the output of the zypper command is not 100% accurate. There might be false positives due to sub package names starting with the same base package name

Parameters
  • package_name () – package_name

  • package_manager_output () – zypper status line

Returns

True|False

Return type

bool

kiwi.package_manager.zypper.PackageManagerZypper.post_init

Post initialization method

Store custom zypper arguments

Parameters

custom_args () – custom zypper arguments

kiwi.package_manager.zypper.PackageManagerZypper.post_process_install_requests_bootstrap

Move the rpm database to the place as it is expected by the rpm package installed during bootstrap phase

Parameters
  • root_bind () – unused

  • delta_root () – unused

kiwi.package_manager.zypper.PackageManagerZypper.process_delete_requests

Process package delete requests (chroot)

Parameters

force () – force deletion: true|false

Raises

kiwi.exceptions.KiwiRequestError – if none of the packages to delete is installed

Returns

process results in command type

Return type

namedtuple

kiwi.package_manager.zypper.PackageManagerZypper.process_install_requests

Process package install requests for image phase (chroot)

Returns

process results in command type

Return type

namedtuple

kiwi.package_manager.zypper.PackageManagerZypper.process_install_requests_bootstrap

Process package install requests for bootstrap phase (no chroot)

Parameters
  • root_bind () – unused

  • bootstrap_package () – unused

Returns

process results in command type

Return type

namedtuple

kiwi.package_manager.zypper.PackageManagerZypper.process_only_required

Setup package processing only for required packages

Setup package processing to also include recommended dependencies.

kiwi.package_manager.zypper.PackageManagerZypper.request_collection

Queue a collection request

Parameters

name () – zypper pattern name

kiwi.package_manager.zypper.PackageManagerZypper.request_package

Queue a package request

Parameters

name () – package name

kiwi.package_manager.zypper.PackageManagerZypper.request_package_exclusion

Queue a package exclusion(skip) request

Parameters

name () – package name

kiwi.package_manager.zypper.PackageManagerZypper.request_product

Queue a product request

Parameters

name () – zypper product name

kiwi.package_manager.zypper.PackageManagerZypper.setup_repository_modules

Repository modules not supported for zypper. The method does nothing in this scope

Parameters

collection_modules () – unused

kiwi.package_manager.zypper.PackageManagerZypper.update

Process package update requests (chroot)

Returns

process results in command type

Return type

namedtuple

13.14.5 Module Contents

kiwi.package_manager.PackageManager

Bases: object

Package manager factory

Parameters
  • repository () – instance of Repository

  • package_manager () – package manager name

  • custom_args () – custom package manager arguments list

Raises

kiwi.exceptions.KiwiPackageManagerSetupError – if the requested package manager type is not supported

Returns

package manager

Return type

PackageManagerBase subclass

kiwi.package_manager.PackageManager.new

13.15 kiwi.partitioner Package

13.15.1 Submodules

13.15.2 kiwi.partitioner.base Module

kiwi.partitioner.base.PartitionerBase

Bases: object

Base class for partitioners

kiwi.partitioner.base.PartitionerBase.create

Create partition

Implementation in specialized partitioner class

Parameters
  • name () – unused

  • mbsize () – unused

  • type_name () – unused

  • flags () – unused

kiwi.partitioner.base.PartitionerBase.get_id

Current partition number

Zero indicates no partition has been created so far

Returns

partition number

Return type

int

kiwi.partitioner.base.PartitionerBase.post_init

Post initialization method

Implementation in specialized partitioner class

kiwi.partitioner.base.PartitionerBase.resize_table

Resize partition table

Parameters

entries () – unused

kiwi.partitioner.base.PartitionerBase.set_flag

Set partition flag

Implementation in specialized partitioner class

Parameters
  • partition_id () – unused

  • flag_name () – unused

kiwi.partitioner.base.PartitionerBase.set_hybrid_mbr

Turn partition table into hybrid table if supported

Implementation in specialized partitioner class

kiwi.partitioner.base.PartitionerBase.set_mbr

Turn partition table into MBR (msdos table)

Implementation in specialized partitioner class

kiwi.partitioner.base.PartitionerBase.set_start_sector

Set start sector of first partition as configured

Parameters

start_sector () – unused

Does nothing by default

13.15.3 kiwi.partitioner.dasd Module

kiwi.partitioner.dasd.PartitionerDasd

Bases: PartitionerBase

Implements DASD partition setup

kiwi.partitioner.dasd.PartitionerDasd.create

Create DASD partition

Parameters
  • name () – partition name

  • mbsize () – partition size

  • type_name () – unused

  • flags () – unused

kiwi.partitioner.dasd.PartitionerDasd.post_init

Post initialization method

Setup fdasd partition type/flag map

kiwi.partitioner.dasd.PartitionerDasd.resize_table

Resize partition table

Nothing to be done here for DASD devices

Parameters

entries () – unused

13.15.4 kiwi.partitioner.gpt Module

kiwi.partitioner.gpt.PartitionerGpt

Bases: PartitionerBase

Implements GPT partition setup

kiwi.partitioner.gpt.PartitionerGpt.create

Create GPT partition

Parameters
  • name () – partition name

  • mbsize () – partition size

  • type_name () – partition type

  • flags () – additional flags

kiwi.partitioner.gpt.PartitionerGpt.post_init

Post initialization method

Setup gdisk partition type/flag map

kiwi.partitioner.gpt.PartitionerGpt.resize_table

Resize partition table

Parameters

entries () – number of default entries

kiwi.partitioner.gpt.PartitionerGpt.set_flag

Set GPT partition flag

Parameters
  • partition_id () – partition number

  • flag_name () – name from flag map

kiwi.partitioner.gpt.PartitionerGpt.set_hybrid_mbr

Turn partition table into hybrid GPT/MBR table

kiwi.partitioner.gpt.PartitionerGpt.set_mbr

Turn partition table into MBR (msdos table)

13.15.5 kiwi.partitioner.msdos Module

kiwi.partitioner.msdos.PartitionerMsDos

Bases: PartitionerBase

Implement old style msdos partition setup

kiwi.partitioner.msdos.PartitionerMsDos.create

Create msdos partition

Parameters
  • name () – partition name

  • mbsize () – partition size

  • type_name () – partition type

  • flags () – additional flags

kiwi.partitioner.msdos.PartitionerMsDos.post_init

Post initialization method

Setup sfdisk partition type/flag map

kiwi.partitioner.msdos.PartitionerMsDos.resize_table

Resize partition table

Nothing to be done here for msdos table

Parameters

entries () – unused

kiwi.partitioner.msdos.PartitionerMsDos.set_flag

Set msdos partition flag

Parameters
  • partition_id () – partition number

  • flag_name () – name from flag map

kiwi.partitioner.msdos.PartitionerMsDos.set_start_sector

Set start sector of first partition as configured. fdisk and friends are not able to work correctly if the start sector of the first partition is any different from 2048.

Parameters

start_sector () – sector size

13.15.6 Module Contents

kiwi.partitioner.Partitioner

Bases: object

Partitioner factory

Parameters
  • table_type () – Table type name

  • storage_provider () – Instance of class based on DeviceProvider

  • start_sector () – sector number

  • extended_layout () – support extended layout for msdos table

kiwi.partitioner.Partitioner.new

13.16 kiwi.repository Package

13.16.1 Submodules

13.16.2 kiwi.repository.base Module

kiwi.repository.base.RepositoryBase

Bases: object

Implements base class for package manager repository handling

Attributes

Parameters
  • root_bind () – instance of RootBind

  • root_dir () – root directory path name

  • shared_location () – shared directory between image root and build system root

kiwi.repository.base.RepositoryBase.add_repo

Add repository

Implementation in specialized repository class

Parameters
  • name () – unused

  • uri () – unused

  • repo_type () – unused

  • prio () – unused

  • dist () – unused

  • components () – unused

  • user () – unused

  • secret () – unused

  • credentials_file () – unused

  • repo_gpgcheck () – unused

  • pkg_gpgcheck () – unused

  • sourcetype () – unused

  • use_for_bootstrap () – unused

  • customization_script () – unused

kiwi.repository.base.RepositoryBase.cleanup_unused_repos

Cleanup/Delete unused repositories

Only configured repositories according to the image configuration are allowed to be active when building

Implementation in specialized repository class

kiwi.repository.base.RepositoryBase.delete_all_repos

Delete all repositories

Implementation in specialized repository class

kiwi.repository.base.RepositoryBase.delete_repo

Delete repository

Implementation in specialized repository class

Parameters

name () – unused

kiwi.repository.base.RepositoryBase.delete_repo_cache

Delete repository cache

Implementation in specialized repository class

Parameters

name () – unused

kiwi.repository.base.RepositoryBase.import_trusted_keys

Imports trusted keys into the image

Implementation in specialized repository class

Parameters

signing_keys () – list of the key files to import

kiwi.repository.base.RepositoryBase.post_init

Post initialization method

Implementation in specialized repository class

Parameters

custom_args () – unused

kiwi.repository.base.RepositoryBase.run_repo_customize

Run an optional customization script

Parameters
  • script_path () – unused

  • repo_file () – unused

kiwi.repository.base.RepositoryBase.runtime_config

Repository runtime configuration and environment

Implementation in specialized repository class

kiwi.repository.base.RepositoryBase.setup_package_database_configuration

Setup package database configuration

Implementation in specialized repository class

kiwi.repository.base.RepositoryBase.use_default_location

Call repository operations with default repository manager setup

Implementation in specialized repository class

13.16.3 kiwi.repository.dnf4 Module

kiwi.repository.dnf4.RepositoryDnf4

Bases: RepositoryBase

Implements repository handling for dnf package manager

Parameters
  • shared_dnf_dir () – shared directory between image root and build system root

  • runtime_dnf_config_file () – dnf runtime config file name

  • command_env () – customized os.environ for dnf

  • runtime_dnf_config () – instance of ConfigParser

kiwi.repository.dnf4.RepositoryDnf4.add_repo

Add dnf repository

Parameters
  • name () – repository base file name

  • uri () – repository URI

  • repo_type () – repostory type name

  • prio () – dnf repostory priority

  • dist () – unused

  • components () – unused

  • user () – unused

  • secret () – unused

  • credentials_file () – unused

  • repo_gpgcheck () – enable repository signature validation

  • pkg_gpgcheck () – enable package signature validation

  • sourcetype () – source type, one of ‘baseurl’, ‘metalink’ or ‘mirrorlist’

  • use_for_bootstrap () – unused

  • customization_script () – custom script called after the repo file was created

kiwi.repository.dnf4.RepositoryDnf4.cleanup_unused_repos

Delete unused dnf repositories

Repository configurations which are not used for this build must be removed otherwise they are taken into account for the package installations

kiwi.repository.dnf4.RepositoryDnf4.delete_all_repos

Delete all dnf repositories

kiwi.repository.dnf4.RepositoryDnf4.delete_repo

Delete dnf repository

Parameters

name () – repository base file name

kiwi.repository.dnf4.RepositoryDnf4.delete_repo_cache

Delete dnf repository cache

The cache data for each repository is stored in a directory and additional files all starting with the repository name. The method glob deletes all files and directories matching the repository name followed by any characters to cleanup the cache information

Parameters

name () – repository name

kiwi.repository.dnf4.RepositoryDnf4.import_trusted_keys

Imports trusted keys into the image

Parameters

signing_keys () – list of the key files to import

kiwi.repository.dnf4.RepositoryDnf4.post_init

Post initialization method

Store custom dnf arguments and create runtime configuration and environment

Parameters

custom_args () – dnf arguments

kiwi.repository.dnf4.RepositoryDnf4.runtime_config

dnf runtime configuration and environment

Returns

dnf_args:list, command_env:dict

Return type

dict

kiwi.repository.dnf4.RepositoryDnf4.setup_package_database_configuration

Setup rpm macros for bootstrapping and image building

  1. Create the rpm image macro which persists during the build

  2. Create the rpm bootstrap macro to make sure for bootstrapping the rpm database location matches the host rpm database setup. This macro only persists during the bootstrap phase. If the image was already bootstrapped a compat link is created instead.

kiwi.repository.dnf4.RepositoryDnf4.use_default_location

Setup dnf repository operations to store all data in the default places

13.16.4 kiwi.repository.zypper Module

kiwi.repository.zypper.RepositoryZypper

Bases: RepositoryBase

Implements repo handling for zypper package manager

Parameters
  • shared_zypper_dir () – shared directory between image root and build system root

  • runtime_zypper_config_file () – zypper runtime config file name

  • runtime_zypp_config_file () – libzypp runtime config file name

  • zypper_args () – zypper caller args plus additional custom args

  • command_env () – customized os.environ for zypper

  • runtime_zypper_config () – instance of ConfigParser

kiwi.repository.zypper.RepositoryZypper.add_repo

Add zypper repository

Parameters
  • name () – repository name

  • uri () – repository URI

  • repo_type () – repostory type name

  • prio () – zypper repostory priority

  • dist () – unused

  • components () – unused

  • user () – credentials username

  • secret () – credentials password

  • credentials_file () – zypper credentials file

  • repo_gpgcheck () – enable repository signature validation

  • pkg_gpgcheck () – enable package signature validation

  • sourcetype () – unused

  • use_for_bootstrap () – unused

  • customization_script () – custom script called after the repo file was created

kiwi.repository.zypper.RepositoryZypper.cleanup_unused_repos

Delete unused zypper repositories

zypper creates a system solvable which is unwanted for the purpose of building images. In addition zypper fails with an error message ‘Failed to cache rpm database’ if such a system solvable exists and a new root system is created

All other repository configurations which are not used for this build must be removed too, otherwise they are taken into account for the package installations

kiwi.repository.zypper.RepositoryZypper.delete_all_repos

Delete all zypper repositories

kiwi.repository.zypper.RepositoryZypper.delete_repo

Delete zypper repository

Parameters

name () – repository name

kiwi.repository.zypper.RepositoryZypper.delete_repo_cache

Delete zypper repository cache

The cache data for each repository is stored in a list of directories of the same name as the repository name. The method deletes these directories to cleanup the cache information

Parameters

name () – repository name

kiwi.repository.zypper.RepositoryZypper.import_trusted_keys

Imports trusted keys into the image

Parameters

signing_keys () – list of the key files to import

kiwi.repository.zypper.RepositoryZypper.post_init

Post initialization method

Store custom zypper arguments and create runtime configuration and environment

Parameters

custom_args () – zypper arguments

kiwi.repository.zypper.RepositoryZypper.runtime_config

zypper runtime configuration and environment

kiwi.repository.zypper.RepositoryZypper.setup_package_database_configuration

Setup rpm macros for bootstrapping and image building

  1. Create the rpm image macro which persists during the build

  2. Create the rpm bootstrap macro to make sure for bootstrapping the rpm database location matches the host rpm database setup. This macro only persists during the bootstrap phase. If the image was already bootstrapped a compat link is created instead.

  3. Create zypper compat link

kiwi.repository.zypper.RepositoryZypper.use_default_location

Setup zypper repository operations to store all data in the default places

13.16.5 Module Contents

kiwi.repository.Repository

Bases: object

Repository factory

Parameters
  • root_bind () – instance of RootBind

  • package_manager () – package manager name

  • custom_args () – list of custom package manager arguments to setup the repository

Raises

kiwi.exceptions.KiwiRepositorySetupError – if package_manager is not supported

kiwi.repository.Repository.new

13.17 kiwi.repository.template Package

13.17.1 Submodules

13.17.2 kiwi.repository.template.apt Module

kiwi.repository.template.apt.PackageManagerTemplateAptGet

Bases: object

apt-get configuration file template

kiwi.repository.template.apt.PackageManagerTemplateAptGet.get_host_template

apt-get package manager template for apt-get called outside of the image, not chrooted

Return type

Template

kiwi.repository.template.apt.PackageManagerTemplateAptGet.get_image_template

apt-get package manager template for apt-get called inside of the image, chrooted

Return type

Template

13.17.3 Module Contents

13.18 kiwi.solver.repository Package

13.18.1 Submodules

13.18.2 kiwi.solver.repository.base Module

kiwi.solver.repository.base.SolverRepositoryBase

Bases: object

Base class interface for SAT solvable creation.

Parameters
  • uri () – Instance of Uri

  • user () – User name for uri authentication

  • secret () – Secret token for uri authentication

kiwi.solver.repository.base.SolverRepositoryBase.create_repository_solvable

Create SAT solvable for this repository from previously created intermediate solvables by merge and store the result solvable in the specified target_dir

Parameters

target_dir () – path name

Returns

file path to solvable

Return type

str

kiwi.solver.repository.base.SolverRepositoryBase.download_from_repository

Download given source file from the repository and store it as target file

The repo_source location is used relative to the repository location and will be part of a mime type source like: file://repo_path/repo_source

Parameters
  • repo_source () – source file in the repo

  • target () – file path

Raises

kiwi.exceptions.KiwiUriOpenError – if the download fails

kiwi.solver.repository.base.SolverRepositoryBase.get_repo_type
kiwi.solver.repository.base.SolverRepositoryBase.is_uptodate

Check if repository metadata is up to date

Returns

True or False

Return type

bool

kiwi.solver.repository.base.SolverRepositoryBase.timestamp

Return repository timestamp

The retrieval of the repository timestamp depends on the type of the repository and is therefore supposed to be implemented in the specialized Solver Repository classes. If no such implementation exists the method returns the value ‘static’ to indicate there is no timestamp information available.

Return type

str

kiwi.solver.repository.rpm_md.SolverRepositoryRpmMd

Bases: SolverRepositoryBase

Class for SAT solvable creation for rpm-md type repositories.

kiwi.solver.repository.rpm_md.SolverRepositoryRpmMd.timestamp

Get timestamp from the first primary metadata

Returns

time value as text

Return type

str

kiwi.solver.repository.rpm_dir.SolverRepositoryRpmDir

Bases: SolverRepositoryBase

Class for SAT solvable creation for rpm_dir type repositories.

kiwi.solver.repository.suse.SolverRepositorySUSE

Bases: SolverRepositoryBase

Class for SAT solvable creation for SUSE type repositories.

13.18.3 Module Contents

kiwi.solver.repository.SolverRepository

Bases: object

Repository factory for creation of SAT solvables

  • param object uri

    Instance of Uri

kiwi.solver.repository.SolverRepository.new

13.19 kiwi.solver Package

13.19.1 Submodules

13.19.2 kiwi.solver.sat Module

kiwi.solver.sat.Sat

Bases: object

Sat Solver class to run package solver operations

The class uses SUSE’s libsolv sat plugin

kiwi.solver.sat.Sat.add_repository

Add a repository solvable to the pool. This basically add the required repository metadata which is needed to run a solver operation later.

Parameters

solver_repository () – Instance of SolverRepository

kiwi.solver.sat.Sat.set_dist_type
kiwi.solver.sat.Sat.solve

Solve dependencies for the given job list. The list is allowed to contain element names of the following format:

  • name describes a package name

  • pattern:name describes a package collection name whose metadata type is called ‘pattern’ and stored as such in the repository metadata. Usually SUSE repos uses that

  • group:name describes a package collection name whose metadata type is called ‘group’ and stored as such in the repository metadata. Usually RHEL/CentOS/Fedora repos uses that

Parameters
  • job_names () – list of strings

  • skip_missing () – skip job if not found

  • ignore_recommended () – do not include recommended packages

Raises

kiwi.exceptions.KiwiSatSolverJobProblems – if solver reports solving problems

Returns

Transaction result information

Return type

dict

13.19.3 Module Contents

13.20 kiwi.storage Package

13.20.1 Submodules

13.20.2 kiwi.storage.device_provider Module

kiwi.storage.device_provider.DeviceProvider

Bases: object

Base class for any class providing storage devices

kiwi.storage.device_provider.DeviceProvider.get_byte_size

Size of device in bytes

Parameters

device () – node name

Returns

byte value from blockdev

Return type

int

kiwi.storage.device_provider.DeviceProvider.get_device

Representation of device nodes

Could provide one ore more devices representing the storage Implementation in specialized device provider class

kiwi.storage.device_provider.DeviceProvider.get_uuid

UUID of device

Parameters

device () – node name

Returns

UUID from blkid

Return type

str

kiwi.storage.device_provider.DeviceProvider.is_loop

Check if device provider is loop based

By default this is always False and needs an implementation in the the specialized device provider class

Returns

True or False

Return type

bool

13.20.3 kiwi.storage.disk Module

kiwi.storage.disk.Disk

Bases: DeviceProvider

Implements storage disk and partition table setup

kiwi.storage.disk.Disk.activate_boot_partition

Activate boot partition

Note: not all Partitioner instances supports this

kiwi.storage.disk.Disk.create_boot_partition

Create boot partition

Populates kiwi_BootPart(id) and optional kiwi_BootPartClone(id)

Parameters
  • mbsize () – partition size string

  • clone () – create [clone] cop(y/ies) of the boot partition

kiwi.storage.disk.Disk.create_custom_partitions

Create partitions from custom data set

table_entries = {
    map_name: ptable_entry_type
}
Parameters

table () – partition table spec

kiwi.storage.disk.Disk.create_efi_csm_partition

Create EFI bios grub partition

Populates kiwi_BiosGrub(id)

Parameters

mbsize () – partition size string

kiwi.storage.disk.Disk.create_efi_partition

Create EFI partition

Populates kiwi_EfiPart(id)

Parameters

mbsize () – partition size string

kiwi.storage.disk.Disk.create_hybrid_mbr

Turn partition table into a hybrid GPT/MBR table

Note: only GPT tables supports this

kiwi.storage.disk.Disk.create_mbr

Turn partition table into MBR (msdos table)

Note: only GPT tables supports this

kiwi.storage.disk.Disk.create_prep_partition

Create prep partition

Populates kiwi_PrepPart(id)

Parameters

mbsize () – partition size string

kiwi.storage.disk.Disk.create_root_lvm_partition

Create root partition for use with LVM

Populates kiwi_RootPart(id)

Parameters
  • mbsize () – partition size string

  • clone () – create [clone] cop(y/ies) of the lvm roo partition

kiwi.storage.disk.Disk.create_root_partition

Create root partition

Populates kiwi_RootPart(id) and kiwi_BootPart(id) if no extra boot partition is requested

Parameters
  • mbsize () – partition size string

  • clone () – create [clone] cop(y/ies) of the root partition

kiwi.storage.disk.Disk.create_root_raid_partition

Create root partition for use with MD Raid

Populates kiwi_RootPart(id) and kiwi_RaidPart(id) as well as the default raid device node at boot time which is configured to be kiwi_RaidDev(/dev/mdX)

Parameters
  • mbsize () – partition size string

  • clone () – create [clone] cop(y/ies) of the raid root partition

kiwi.storage.disk.Disk.create_root_readonly_partition

Create root readonly partition for use with overlayfs

Populates kiwi_ReadOnlyPart(id), the partition is meant to contain a squashfs readonly filesystem. The partition size should be the size of the squashfs filesystem in order to avoid wasting disk space

Parameters
  • mbsize () – partition size string

  • clone () – create [clone] cop(y/ies) of the ro root partition

kiwi.storage.disk.Disk.create_spare_partition

Create spare partition for custom use

Populates kiwi_SparePart(id)

Parameters

mbsize () – partition size string

kiwi.storage.disk.Disk.create_swap_partition

Create swap partition

Populates kiwi_SwapPart(id)

Parameters

mbsize () – partition size string

kiwi.storage.disk.Disk.get_device

Names of partition devices

Note that the mapping requires an explicit map() call

Returns

instances of MappedDevice

Return type

dict

kiwi.storage.disk.Disk.get_public_partition_id_map

Populated partition name to number map

kiwi.storage.disk.Disk.is_loop

Check if storage provider is loop based

The information is taken from the storage provider. If the storage provider is loop based the disk is it too

Returns

True or False

Return type

bool

kiwi.storage.disk.Disk.map_partitions

Map/Activate partitions

In order to access the partitions through a device node it is required to map them if the storage provider is loop based

kiwi.storage.disk.Disk.set_start_sector

Set start sector

Note: only effective on DOS tables

kiwi.storage.disk.Disk.wipe

Zap (destroy) any GPT and MBR data structures if present For DASD disks create a new VTOC table

kiwi.storage.disk.ptable_entry_type

Bases: tuple

kiwi.storage.disk.ptable_entry_type.clone

Alias for field number 1

kiwi.storage.disk.ptable_entry_type.filesystem

Alias for field number 5

kiwi.storage.disk.ptable_entry_type.mbsize

Alias for field number 0

kiwi.storage.disk.ptable_entry_type.mountpoint

Alias for field number 4

kiwi.storage.disk.ptable_entry_type.partition_name

Alias for field number 2

kiwi.storage.disk.ptable_entry_type.partition_type

Alias for field number 3

13.20.4 kiwi.storage.loop_device Module

kiwi.storage.loop_device.LoopDevice

Bases: DeviceProvider

Create and manage loop device file for block operations

Parameters
  • filename () – loop file name to create

  • filesize_mbytes () – size of the loop file

  • blocksize_bytes () – blocksize used in loop driver

kiwi.storage.loop_device.LoopDevice.create

Setup a loop device of the blocksize given in the constructor The file to loop is created with the size specified in the constructor unless an existing one should not be overwritten

Parameters

overwrite () – overwrite existing file to loop

kiwi.storage.loop_device.LoopDevice.get_device

Device node name

Returns

device node name

Return type

str

kiwi.storage.loop_device.LoopDevice.is_loop

Always True

Returns

True

Return type

bool

13.20.5 kiwi.storage.luks_device Module

kiwi.storage.luks_device.LuksDevice

Bases: DeviceProvider

Implements luks setup on a storage device

Parameters

storage_provider () – Instance of class based on DeviceProvider

kiwi.storage.luks_device.LuksDevice.create_crypto_luks

Create luks device. Please note the passphrase is readable at creation time of this image. Make sure your host system is secure while this process runs

Parameters
  • passphrase () – credentials

  • osname () – distribution name to match distribution specific options for cryptsetup

  • options () – further cryptsetup options

  • keyfile () – file path name file path name which contains an alternative key to unlock the luks device

  • root_dir () – root dir path

kiwi.storage.luks_device.LuksDevice.create_crypttab

Create crypttab, setting the UUID of the storage device

Parameters

filename () – file path name

kiwi.storage.luks_device.LuksDevice.create_random_keyfile

Create keyfile with random data

Parameters

filename () – file path name

kiwi.storage.luks_device.LuksDevice.get_device

Instance of MappedDevice providing the luks device

Returns

mapped luks device

Return type

kiwi.storage.mapped_device.MappedDevice

kiwi.storage.luks_device.LuksDevice.is_loop

Check if storage provider is loop based

Return loop status from base storage provider

Returns

True or False

Return type

bool

13.20.6 kiwi.storage.mapped_device Module

kiwi.storage.mapped_device.MappedDevice

Bases: DeviceProvider

Hold a reference on a single device

Parameters
  • device_provider () – Instance of class based on DeviceProvider

  • device () – Device node name

kiwi.storage.mapped_device.MappedDevice.get_device

Mapped device node name

Returns

device node name

Return type

str

kiwi.storage.mapped_device.MappedDevice.is_loop

Check if storage provider is loop based

Return loop status from base storage provider

Returns

True or False

Return type

bool

13.20.7 kiwi.storage.raid_device Module

kiwi.storage.raid_device.RaidDevice

Bases: DeviceProvider

Implement raid setup on a storage device

Parameters

storage_provider () – Instance of class based on DeviceProvider

kiwi.storage.raid_device.RaidDevice.create_degraded_raid

Create a raid array in degraded mode with one device missing. This only works in the raid levels 0(striping) and 1(mirroring)

Parameters

raid_level () – raid level name

kiwi.storage.raid_device.RaidDevice.create_raid_config

Create mdadm config file from mdadm request

Parameters

filename () – config file name

kiwi.storage.raid_device.RaidDevice.get_device

Instance of MappedDevice providing the raid device

Returns

mapped raid device

Return type

kiwi.storage.mapped_device.MappedDevice

kiwi.storage.raid_device.RaidDevice.is_loop

Check if storage provider is loop based

Return loop status from base storage provider

Returns

True or False

Return type

bool

13.20.8 kiwi.storage.clone_device Module

kiwi.storage.clone_device.CloneDevice

Bases: DeviceProvider

Implements device cloning

kiwi.storage.clone_device.CloneDevice.clone

Clone source device to target device(s)

Parameters

target_devices () – List of target DeviceProvider instances

13.20.9 kiwi.storage.setup Module

kiwi.storage.setup.DiskSetup

Bases: object

Implements disk setup methods

Methods from this class provides information required before building a disk image

Parameters
  • xml_state () – Instance of XMLState

  • root_dir () – root directory path name

kiwi.storage.setup.DiskSetup.boot_partition_size

Size of the boot partition in mbytes

Returns

boot size mbytes

Return type

int

kiwi.storage.setup.DiskSetup.get_boot_label

Filesystem Label to use for the boot partition

Returns

label name

Return type

str

kiwi.storage.setup.DiskSetup.get_disksize_mbytes

Precalculate disk size requirements in mbytes

Parameters
  • root_clone () – root partition gets cloned, N+1 times the size is needed

  • boot_clone () – boot partition gets cloned, N+1 times the size is needed

Returns

disk size mbytes

Return type

int

kiwi.storage.setup.DiskSetup.get_efi_label

Filesystem Label to use for the EFI partition

Returns

label name

Return type

str

kiwi.storage.setup.DiskSetup.get_root_label

Filesystem Label to use for the root partition

If not specified in the XML configuration the default root label is set to ‘ROOT’

Returns

label name

Return type

str

kiwi.storage.setup.DiskSetup.need_boot_partition

Decide if an extra boot partition is needed. This is done with the bootpartition attribute from the type, however if it is not set it depends on some other type configuration parameters if we need a boot partition or not

Returns

True or False

Return type

bool

13.20.10 Module Contents

13.21 kiwi.storage.subformat Package

13.21.1 Submodules

13.21.2 kiwi.storage.subformat.base Module

kiwi.storage.subformat.base.DiskFormatBase

Bases: object

Base class to create disk formats from a raw disk image

Parameters
  • xml_state () – Instance of XMLState

  • root_dir () – root directory path name

  • arch () – Defaults.get_platform_name

  • target_dir () – target directory path name

  • custom_args () – custom format options dictionary

kiwi.storage.subformat.base.DiskFormatBase.create_image_format

Create disk format

Implementation in specialized disk format class required

kiwi.storage.subformat.base.DiskFormatBase.get_qemu_option_list

Create list of qemu options from custom_args dict

Parameters

custom_args () – arguments

Returns

qemu option list

Return type

list

kiwi.storage.subformat.base.DiskFormatBase.get_target_file_path_for_format

Create target file path name for specified format

Parameters

format_name () – disk format name

Returns

file path name

Return type

str

kiwi.storage.subformat.base.DiskFormatBase.has_raw_disk

Check if the base raw disk image exists

Returns

True or False

Return type

bool

kiwi.storage.subformat.base.DiskFormatBase.post_init

Post initialization method

Implementation in specialized disk format class if required

Parameters

custom_args () – unused

kiwi.storage.subformat.base.DiskFormatBase.resize_raw_disk

Resize raw disk image to specified size. If the request would actually shrink the disk an exception is raised. If the disk got changed the method returns True, if the new size is the same as the current size nothing gets resized and the method returns False

Parameters

size () – size in bytes

Returns

True or False

Return type

bool

kiwi.storage.subformat.base.DiskFormatBase.store_to_result

Store result file of the format conversion into the provided result instance.

By default only the converted image file will be stored as compressed file. Subformats which creates additional metadata files or want to use other result flags needs to overwrite this method

Parameters

result () – Instance of Result

13.21.3 kiwi.storage.subformat.gce Module

kiwi.storage.subformat.gce.DiskFormatGce

Bases: DiskFormatBase

Create GCE - Google Compute Engine image format

kiwi.storage.subformat.gce.DiskFormatGce.create_image_format

Create GCE disk format and manifest

kiwi.storage.subformat.gce.DiskFormatGce.get_target_file_path_for_format

Google requires the image name to follow their naming convetion. Therefore it’s required to provide a suitable name by overriding the base class method

Parameters

format_name () – gce

Returns

file path name

Return type

str

kiwi.storage.subformat.gce.DiskFormatGce.post_init

GCE disk format post initialization method

Store disk tag from custom args

Parameters

custom_args () –

custom gce argument dictionary

{'--tag': 'billing_code'}

kiwi.storage.subformat.gce.DiskFormatGce.store_to_result

Store result file of the gce format conversion into the provided result instance. In this case compression is unwanted because the gce tarball is already created as a compressed archive

Parameters

result () – Instance of Result

13.21.4 kiwi.storage.subformat.ova Module

kiwi.storage.subformat.ova.DiskFormatOva

Bases: DiskFormatBase

Create ova disk format, based on vmdk

kiwi.storage.subformat.ova.DiskFormatOva.create_image_format

Create ova disk format using ovftool from https://www.vmware.com/support/developer/ovf

kiwi.storage.subformat.ova.DiskFormatOva.post_init

vmdk disk format post initialization method

Store qemu options as list from custom args dict

Parameters

custom_args () – custom qemu arguments dictionary

kiwi.storage.subformat.ova.DiskFormatOva.store_to_result

Store the resulting ova file into the provided result instance.

Parameters

result () – Instance of Result

13.21.5 kiwi.storage.subformat.qcow2 Module

kiwi.storage.subformat.qcow2.DiskFormatQcow2

Bases: DiskFormatBase

Create qcow2 disk format

kiwi.storage.subformat.qcow2.DiskFormatQcow2.create_image_format

Create qcow2 disk format

kiwi.storage.subformat.qcow2.DiskFormatQcow2.post_init

qcow2 disk format post initialization method

Store qemu options as list from custom args dict

Parameters

custom_args () – custom qemu arguments dictionary

kiwi.storage.subformat.qcow2.DiskFormatQcow2.store_to_result

Store result file of the format conversion into the provided result instance.

In case of a qcow2 format we store the result uncompressed Since the format conversion only takes the real bytes into account such that the sparseness of the raw disk will not result in the output format and can be taken one by one

Parameters

result () – Instance of Result

13.21.6 kiwi.storage.subformat.vagrant_base Module

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase

Bases: DiskFormatBase

Base class for creating vagrant boxes.

The documentation of the vagrant box format can be found here: https://www.vagrantup.com/docs/boxes/format.html In a nutshell, a vagrant box is a tar, tar.gz or zip archive of the following:

  1. metadata.json: A json file that contains the name of the provider and arbitrary additional data (that vagrant doesn’t care about).

  2. Vagrantfile: A Vagrantfile which defines the boxes’ MAC address. It can be also used to define other settings of the box, e.g. the method via which the /vagrant/ directory is shared. This file is either automatically generated by KIWI or we use a file that has been provided by the user (depends on the setting in vagrantconfig.embebbed_vagrantfile)

  3. The actual virtual disk image: this is provider specific and vagrant simply forwards it to your virtual machine provider.

Required methods/variables that child classes must implement:

Optional methods:

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase.create_box_img

Provider specific image creation step: this function creates the actual box image. It must be implemented by a child class.

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase.create_image_format

Create a vagrant box for any provider. This includes:

  • creation of box metadata.json

  • creation of box Vagrantfile (either from scratch or by using the user provided Vagrantfile)

  • creation of result format tarball from the files created above

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase.get_additional_metadata

Provide create_image_format() with additional metadata that will be included in metadata.json.

The default implementation returns an empty dictionary.

Returns

A dictionary that is serializable to JSON

Return type

dict

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase.get_additional_vagrant_config_settings

Supply additional configuration settings for vagrant to be included in the resulting box.

This function can be used by child classes to customize the behavior for different providers: the supplied configuration settings get forwarded to VagrantConfigTemplate.get_template() as the parameter custom_settings and included in the Vagrantfile.

The default implementation returns nothing.

Returns

additional vagrant settings

Return type

str

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase.post_init

vagrant disk format post initialization method

store vagrantconfig information provided via custom_args

Parameters

custom_args () –

Contains instance of xml_parse::vagrantconfig

{'vagrantconfig': object}

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase.store_to_result

Store result file of the vagrant format conversion into the provided result instance. In this case compression is unwanted because the box is already created as a compressed tarball

Parameters

result () – Instance of Result

kiwi.storage.subformat.vagrant_base.DiskFormatVagrantBase.vagrant_post_init

Vagrant provider specific post initialization method

Setup vagrant provider and box name. This information must be set by the specialized provider class implementation to make the this base class methods effective

13.21.7 kiwi.storage.subformat.vagrant_libvirt Module

kiwi.storage.subformat.vagrant_libvirt.DiskFormatVagrantLibVirt

Bases: DiskFormatVagrantBase

Create a vagrant box for the libvirt provider

kiwi.storage.subformat.vagrant_libvirt.DiskFormatVagrantLibVirt.create_box_img

Creates the qcow2 disk image box for libvirt vagrant provider

Parameters

temp_image_dir () – Path to the temporary directory used to build the box image

Returns

A list of files relevant for the libvirt box to be included in the vagrant box

Return type

list

kiwi.storage.subformat.vagrant_libvirt.DiskFormatVagrantLibVirt.get_additional_metadata

Provide box metadata needed to create the box in vagrant

Returns

Returns a dictionary containing the virtual image format and the size of the image.

Return type

dict

kiwi.storage.subformat.vagrant_libvirt.DiskFormatVagrantLibVirt.get_additional_vagrant_config_settings

Returns settings for the libvirt provider telling vagrant to use kvm.

Returns

ruby code to be evaluated as string

Return type

str

kiwi.storage.subformat.vagrant_libvirt.DiskFormatVagrantLibVirt.vagrant_post_init

Vagrant provider specific post initialization method

Setup vagrant provider and box name. This information must be set by the specialized provider class implementation to make the this base class methods effective

13.21.8 kiwi.storage.subformat.vagrant_virtualbox Module

kiwi.storage.subformat.vagrant_virtualbox.DiskFormatVagrantVirtualBox

Bases: DiskFormatVagrantBase

Create a vagrant box for the virtualbox provider

kiwi.storage.subformat.vagrant_virtualbox.DiskFormatVagrantVirtualBox.create_box_img

Create the vmdk image for the Virtualbox vagrant provider.

This function creates the vmdk disk image and the ovf file. The latter is created via the class VirtualboxOvfTemplate.

Parameters

temp_image_dir () – Path to the temporary directory used to build the box image

Returns

A list of files relevant for the virtualbox box to be included in the vagrant box

Return type

list

kiwi.storage.subformat.vagrant_virtualbox.DiskFormatVagrantVirtualBox.get_additional_vagrant_config_settings

Configure the default shared folder to use rsync when guest additions are not present inside the box.

Returns

ruby code to be evaluated as string

Return type

str

kiwi.storage.subformat.vagrant_virtualbox.DiskFormatVagrantVirtualBox.vagrant_post_init

Vagrant provider specific post initialization method

Setup vagrant provider and box name. This information must be set by the specialized provider class implementation to make the this base class methods effective

13.21.9 kiwi.storage.subformat.vdi Module

kiwi.storage.subformat.vdi.DiskFormatVdi

Bases: DiskFormatBase

Create vdi disk format

kiwi.storage.subformat.vdi.DiskFormatVdi.create_image_format

Create vdi disk format

kiwi.storage.subformat.vdi.DiskFormatVdi.post_init

vdi disk format post initialization method

Store qemu options as list from custom args dict

Parameters

custom_args () – custom qemu arguments dictionary

13.21.10 kiwi.storage.subformat.vhd Module

kiwi.storage.subformat.vhd.DiskFormatVhd

Bases: DiskFormatBase

Create vhd disk format

kiwi.storage.subformat.vhd.DiskFormatVhd.create_image_format

Create vhd disk format

kiwi.storage.subformat.vhd.DiskFormatVhd.post_init

vhd disk format post initialization method

Store qemu options as list from custom args dict

Parameters

custom_args () – custom qemu arguments dictionary

13.21.11 kiwi.storage.subformat.vhdfixed Module

kiwi.storage.subformat.vhdfixed.DiskFormatVhdFixed

Bases: DiskFormatBase

Create vhd image format in fixed subformat

kiwi.storage.subformat.vhdfixed.DiskFormatVhdFixed.create_image_format

Create vhd fixed disk format

kiwi.storage.subformat.vhdfixed.DiskFormatVhdFixed.post_init

vhd disk format post initialization method

Store qemu options as list from custom args dict Extract disk tag from custom args

Parameters

custom_args () –

custom vhdfixed and qemu argument dictionary

{'--tag': 'billing_code', '--qemu-opt': 'value'}

kiwi.storage.subformat.vhdfixed.DiskFormatVhdFixed.store_to_result

Store result file of the vhdfixed format conversion into the provided result instance. In this case compressing the result is preferred as vhdfixed is not a compressed or dynamic format.

Parameters

result () – Instance of Result

13.21.12 kiwi.storage.subformat.vhdx Module

kiwi.storage.subformat.vhdx.DiskFormatVhdx

Bases: DiskFormatBase

Create vhdx image format in dynamic subformat

kiwi.storage.subformat.vhdx.DiskFormatVhdx.create_image_format

Create vhdx dynamic disk format

kiwi.storage.subformat.vhdx.DiskFormatVhdx.post_init

vhdx disk format post initialization method

Store qemu options as list from custom args dict

Parameters

custom_args () – custom qemu arguments dictionary

13.21.13 kiwi.storage.subformat.vmdk Module

kiwi.storage.subformat.vmdk.DiskFormatVmdk

Bases: DiskFormatBase

Create vmdk disk format

kiwi.storage.subformat.vmdk.DiskFormatVmdk.create_image_format

Create vmdk disk format and machine settings file

kiwi.storage.subformat.vmdk.DiskFormatVmdk.post_init

vmdk disk format post initialization method

Store qemu options as list from custom args dict

Parameters

custom_args () – custom qemu arguments dictionary

kiwi.storage.subformat.vmdk.DiskFormatVmdk.store_to_result

Store result files of the vmdk format conversion into the provided result instance. This includes the vmdk image file and the VMware settings file

Parameters

result () – Instance of Result

13.21.14 Module Contents

kiwi.storage.subformat.DiskFormat

Bases: object

DiskFormat factory

Parameters
  • name () – Format name

  • xml_state () – Instance of XMLState

  • root_dir () – root directory path name

  • target_dir () – target directory path name

kiwi.storage.subformat.DiskFormat.new

13.22 kiwi.storage.subformat.template Package

13.22.1 Submodules

13.22.2 kiwi.storage.subformat.template.vmware_settings Module

kiwi.storage.subformat.template.vmware_settings.VmwareSettingsTemplate

Bases: object

VMware machine settings template

kiwi.storage.subformat.template.vmware_settings.VmwareSettingsTemplate.get_template

VMware machine configuration template

Parameters
  • memory_setup () – with main memory setup true|false

  • cpu_setup () – with number of CPU’s setup true|false

  • network_setup () – with network emulation true|false

  • iso_setup () – with CD/DVD drive emulation true|false

  • disk_controller () – add disk controller setup to template

  • iso_controller () – add CD/DVD controller setup to template

  • network_mac () – add static MAC address setup to template

  • network_driver () – add network driver setup to template

  • network_connection_type () – add connection type to template

Return type

Template

13.22.3 kiwi.storage.subformat.template.vagrant_config Module

kiwi.storage.subformat.template.vagrant_config.VagrantConfigTemplate

Bases: object

Generate a Vagrantfile configuration template

This class creates a simple template for the Vagrantfile that is included inside a vagrant box.

The included Vagrantfile carries additional information for vagrant: by default that is nothing, but depending on the provider additional information need to be present. These can be passed via the parameter custom_settings to the method get_template().

Example usage:

The default without any additional settings will result in this Vagrantfile:

>>> vagrant_config = VagrantConfigTemplate()
>>> print(
...     vagrant_config.get_template()
... )
Vagrant.configure("2") do |config|
end

If your provider/box requires additional settings, provide them as follows:

>>> extra_settings = dedent('''
... config.vm.hostname = "no-dead-beef"
... config.vm.provider :special do |special|
...   special.secret_settings = "please_work"
... end
... ''').strip()
>>> print(
...     vagrant_config.get_template(extra_settings)
... )
Vagrant.configure("2") do |config|
  config.vm.hostname = "no-dead-beef"
  config.vm.provider :special do |special|
    special.secret_settings = "please_work"
  end
end
kiwi.storage.subformat.template.vagrant_config.VagrantConfigTemplate.get_template

Return a new template with custom_settings included and indented appropriately.

Parameters

custom_settings () – String of additional settings that get pasted into the Vagrantfile template. The string is put at the correct indentation level for you, but the internal indentation has to be provided by the caller.

Returns

A string with custom_settings inserted at the appropriate position. The template has one the variable mac_address that must be substituted.

Return type

str

13.22.4 kiwi.storage.subformat.template.virtualbox_ovf Module

kiwi.storage.subformat.template.virtualbox_ovf.VirtualboxOvfTemplate

Bases: object

Generate a OVF file template for a vagrant virtualbox box

This class provides a template for virtualbox’ ovf configuration file that is embedded inside the vagrant box. The template itself was extracted from a vagrant box that was build via packer and from a script provided by Neal Gompa.

kiwi.storage.subformat.template.virtualbox_ovf.VirtualboxOvfTemplate.get_template

Return the actual ovf template. The following values must be substituted: - vm_name: the name of this VM - disk_image_capacity: Size of the virtual disk image in GB - vm_description: a description of this VM

13.22.5 Module contents

13.23 kiwi.system Package

13.23.1 Submodules

13.23.2 kiwi.system.identifier Module

kiwi.system.identifier.SystemIdentifier

Bases: object

Create a random ID to identify the system

The information is used to create the mbrid file as an example

Parameters

image_id () – hex identifier string

kiwi.system.identifier.SystemIdentifier.calculate_id

Calculate random hex id

Using 4 tuples of rand in range from 1..0xfe

kiwi.system.identifier.SystemIdentifier.get_id

Current hex identifier

Returns

hex id

Return type

str

kiwi.system.identifier.SystemIdentifier.write

Write current hex identifier to file

Parameters

filename () – file path name

kiwi.system.identifier.SystemIdentifier.write_to_disk

Write current hex identifier to MBR at offset 0x1b8 on disk

Parameters

device_provider () – Instance based on DeviceProvider

13.23.3 kiwi.system.kernel Module

kiwi.system.kernel.Kernel

Bases: object

Implementes kernel lookup and extraction from given root tree

Parameters
  • root_dir () – root directory path name

  • kernel_names () – list of kernel names to search for functions.sh::suseStripKernel() provides a normalized file so that we do not have to search for many different names in this code

kiwi.system.kernel.Kernel.copy_kernel

Copy kernel to specified target

If no file_name is given the target filename is set as kernel-<kernel.version>.kernel

Parameters
  • target_dir () – target path name

  • filename () – base filename in target

kiwi.system.kernel.Kernel.copy_xen_hypervisor

Copy xen hypervisor to specified target

If no file_name is given the target filename is set as hypervisor-<xen.name>

Parameters
  • target_dir () – target path name

  • filename () – base filename in target

kiwi.system.kernel.Kernel.get_kernel

Lookup kernel files and provide filename and version

Parameters

raise_on_not_found () – sets the method to raise an exception if the kernel is not found

Raises

kiwi.exceptions.KiwiKernelLookupError – if raise_on_not_found flag is active and kernel is not found

Returns

tuple with filename, kernelname and version

Return type

tuple|None

kiwi.system.kernel.Kernel.get_xen_hypervisor

Lookup xen hypervisor and provide filename and hypervisor name

Returns

tuple with filename and hypervisor name

Return type

tuple|None

kiwi.system.kernel.kernel_type

Bases: tuple

kiwi.system.kernel.kernel_type.filename

Alias for field number 1

kiwi.system.kernel.kernel_type.name

Alias for field number 0

kiwi.system.kernel.kernel_type.version

Alias for field number 2

kiwi.system.kernel.xen_hypervisor_type

Bases: tuple

kiwi.system.kernel.xen_hypervisor_type.filename

Alias for field number 0

kiwi.system.kernel.xen_hypervisor_type.name

Alias for field number 1

13.23.4 kiwi.system.prepare Module

kiwi.system.prepare.SystemPrepare

Bases: object

Implements preparation and installation of a new root system

Parameters
  • xml_state () – instance of XMLState

  • root_dir () – Path to new root directory

  • allow_existing () – Allow using an existing root_dir

kiwi.system.prepare.SystemPrepare.clean_package_manager_leftovers

This methods cleans some package manager artifacts created at run time such as macros

kiwi.system.prepare.SystemPrepare.delete_packages

Delete one or more packages using the package manager inside of the new root directory. If the removal is set with force flag only listed packages are deleted and any dependency break or leftover is ignored.

Parameters
  • manager () – instance of a PackageManager subclass

  • packages () – package list

  • force () – force deletion true|false

Raises

kiwi.exceptions.KiwiSystemDeletePackagesFailed – if installation process fails

kiwi.system.prepare.SystemPrepare.install_bootstrap

Install system software using the package manager from the host, also known as bootstrapping

Parameters
  • manager () – instance of a PackageManager subclass

  • plus_packages () – list of additional packages

Raises

kiwi.exceptions.KiwiBootStrapPhaseFailed – if the bootstrapping process fails either installing packages or including bootstrap archives

kiwi.system.prepare.SystemPrepare.install_packages

Install one or more packages using the package manager inside of the new root directory

Parameters
  • manager () – instance of a PackageManager subclass

  • packages () – package list

Raises

kiwi.exceptions.KiwiSystemInstallPackagesFailed – if installation process fails

kiwi.system.prepare.SystemPrepare.install_system

Install system software using the package manager inside of the new root directory. This is done via a chroot operation and requires the desired package manager to became installed via the bootstrap phase

Parameters

manager () – instance of a PackageManager subclass

Raises

kiwi.exceptions.KiwiInstallPhaseFailed – if the install process fails either installing packages or including any archive

kiwi.system.prepare.SystemPrepare.pinch_system

Delete packages marked for deletion in the XML description. If force param is set to False uninstalls packages marked with type="uninstall" if any; if force is set to True deletes packages marked with type="delete" if any.

Parameters
  • manager () – instance of PackageManager subclass

  • force () – Forced deletion True|False

Raises

kiwi.exceptions.KiwiPackagesDeletePhaseFailed – if the deletion packages process fails

kiwi.system.prepare.SystemPrepare.setup_repositories

Set up repositories for software installation and return a package manager for performing software installation tasks

Parameters
  • clear_cache () – Flag the clear cache before configure anything

  • signing_keys () – Keys imported to the package manager

  • target_arch () – Target architecture name

Returns

instance of PackageManager subclass

Return type

kiwi.package_manager.PackageManager

kiwi.system.prepare.SystemPrepare.update_system

Install package updates from the used repositories. the process uses the package manager from inside of the new root directory

Parameters

manager () – instance of a PackageManager subclass

Raises

kiwi.exceptions.KiwiSystemUpdateFailed – if packages update fails

13.23.5 kiwi.system.profile Module

kiwi.system.profile.Profile

Bases: object

Create bash readable .profile environment from the XML description

Parameters

xml_state () – instance of :class`XMLState`

kiwi.system.profile.Profile.add

Add key/value pair to profile dictionary

Parameters
  • key () – profile key

  • value () – profile value

kiwi.system.profile.Profile.create

Create bash quoted profile

Parameters

filename () – file path name

kiwi.system.profile.Profile.delete
kiwi.system.profile.Profile.get_settings

Return all profile elements that has a value

13.23.6 kiwi.system.result Module

kiwi.system.result.Result

Bases: object

Collect image building results

Parameters
  • result_files () – dict of result files

  • class_version () – Result class version

  • xml_state () – instance of XMLState

kiwi.system.result.Result.add

Add result tuple to result_files list

Parameters
  • key () – name

  • filename () – file path name

  • use_for_bundle () – use when bundling results true|false

  • compress () – compress when bundling true|false

  • shasum () – create shasum when bundling true|false

kiwi.system.result.Result.add_bundle_format
kiwi.system.result.Result.dump

Picke dump this instance to a file

Parameters
  • filename () – file path name

  • portable () – If set to true also create a .json formatted variant of the dump file which contains the elements of this instance that could be expressed in a portable json document. Default is set to: True

Raises

kiwi.exceptions.KiwiResultError – if pickle fails to dump Result instance

kiwi.system.result.Result.get_results

Current list of result tuples

kiwi.system.result.Result.load

Load pickle dumped filename into a Result instance

Parameters

filename () – file path name

Raises

kiwi.exceptions.KiwiResultError – if filename does not exist or pickle fails to load filename

kiwi.system.result.Result.print_results

Print results human readable

kiwi.system.result.Result.verify_image_size

Verifies the given image file does not exceed the size limit. Throws an exception if the limit is exceeded. If the size limit is set to None no verification is done.

Parameters
  • size_limit () – The size limit for filename in bytes.

  • filename () – File to verify.

Raises

kiwi.exceptions.KiwiResultError – if filename exceeds the size limit

kiwi.system.result.result_file_type

Bases: tuple

kiwi.system.result.result_file_type.compress

Alias for field number 2

kiwi.system.result.result_file_type.filename

Alias for field number 0

kiwi.system.result.result_file_type.shasum

Alias for field number 3

kiwi.system.result.result_file_type.use_for_bundle

Alias for field number 1

kiwi.system.result.result_name_tags

Bases: tuple

kiwi.system.result.result_name_tags.A

Alias for field number 2

kiwi.system.result.result_name_tags.I

Alias for field number 3

kiwi.system.result.result_name_tags.M

Alias for field number 5

kiwi.system.result.result_name_tags.N

Alias for field number 0

kiwi.system.result.result_name_tags.P

Alias for field number 1

kiwi.system.result.result_name_tags.T

Alias for field number 4

kiwi.system.result.result_name_tags.m

Alias for field number 6

kiwi.system.result.result_name_tags.p

Alias for field number 7

13.23.7 kiwi.system.root_bind Module

kiwi.system.root_bind.RootBind

Bases: object

Implements binding/copying of host system paths into the new root directory

Parameters
  • root_dir () – root directory path name

  • cleanup_files () – list of files to cleanup, delete

  • mount_stack () – list of mounted directories for cleanup

  • dir_stack () – list of directories for cleanup

  • config_files () – list of initial config files

  • bind_locations () – list of kernel filesystems to bind mount

  • shared_location () – shared directory between image root and build system root

kiwi.system.root_bind.RootBind.cleanup

Cleanup mounted locations, directories and intermediate config files

kiwi.system.root_bind.RootBind.mount_kernel_file_systems

Bind mount kernel filesystems

Raises

kiwi.exceptions.KiwiMountKernelFileSystemsError – if some kernel filesystem fails to mount

kiwi.system.root_bind.RootBind.mount_shared_directory

Bind mount shared location

The shared location is a directory which shares data from the image buildsystem host with the image root system. It is used for the repository setup and the package manager cache to allow chroot operations without being forced to duplicate this data

Parameters

host_dir () – directory to share between image root and build system root

Raises

kiwi.exceptions.KiwiMountSharedDirectoryError – if mount fails

kiwi.system.root_bind.RootBind.setup_intermediate_config

Create intermediate config files

Some config files e.g etc/hosts needs to be temporarly copied from the buildsystem host to the image root system in order to allow e.g DNS resolution in the way as it is configured on the buildsystem host. These config files only exists during the image build process and are not part of the final image

Raises

kiwi.exceptions.KiwiSetupIntermediateConfigError – if the management of intermediate configuration files fails

kiwi.system.root_bind.RootBind.umount_kernel_file_systems

Umount kernel filesystems

Raises

kiwi.exceptions.KiwiMountKernelFileSystemsError – if some kernel filesystem fails to mount

13.23.8 kiwi.system.root_init Module

kiwi.system.root_init.RootInit

Bases: object

Implements creation of new root directory for a linux system

Host system independent static default files and device nodes are created to initialize a new base system

Parameters

root_dir () – root directory path name

kiwi.system.root_init.RootInit.create

Create new system root directory

The method creates a temporary directory and initializes it for the purpose of building a system image from it. This includes the following setup:

  • create core system paths

  • create static core device nodes

On success the contents of the temporary location are synced to the specified root_dir and the temporary location will be deleted. That way we never work on an incomplete initial setup

Raises

kiwi.exceptions.KiwiRootInitCreationError – if the init creation fails at some point

kiwi.system.root_init.RootInit.delete

Force delete root directory and its contents

13.23.9 kiwi.system.setup Module

kiwi.system.setup.SystemSetup

Bases: object

Implementation of system setup steps supported by kiwi

Kiwi is not responsible for the system configuration, however some setup steps needs to be performed in order to provide a minimal work environment inside of the image according to the desired image type.

Parameters
  • xml_state () – instance of XMLState

  • root_dir () – root directory path name

kiwi.system.setup.SystemSetup.call_config_host_overlay_script

Call config-host-overlay.sh script _NON_ chrooted

kiwi.system.setup.SystemSetup.call_config_overlay_script

Call config-overlay.sh script chrooted

kiwi.system.setup.SystemSetup.call_config_script

Call config.sh script chrooted

kiwi.system.setup.SystemSetup.call_disk_script

Call disk.sh script chrooted

kiwi.system.setup.SystemSetup.call_edit_boot_config_script

Call configured editbootconfig script _NON_ chrooted

Pass the boot filesystem name and the partition number of the boot partition as parameters to the call

Parameters
  • filesystem () – boot filesystem name

  • boot_part_id () – boot partition number

  • working_directory () – directory name

kiwi.system.setup.SystemSetup.call_edit_boot_install_script

Call configured editbootinstall script _NON_ chrooted

Pass the disk file name and the device node of the boot partition as parameters to the call

Parameters
  • diskname () – file path name

  • boot_device_node () – boot device node name

  • working_directory () – directory name

kiwi.system.setup.SystemSetup.call_image_script

Call images.sh script chrooted

kiwi.system.setup.SystemSetup.call_post_bootstrap_script

Call post_bootstrap.sh script chrooted

kiwi.system.setup.SystemSetup.call_pre_disk_script

Call pre_disk_sync.sh script chrooted

kiwi.system.setup.SystemSetup.cleanup

Delete all traces of a kiwi description which are not required in the later image

kiwi.system.setup.SystemSetup.create_fstab

Create etc/fstab from given Fstab object

Custom fstab modifications are possible and handled in the following order:

  1. Look for an optional fstab.append file which allows to append custom fstab entries to the final fstab. Once embedded the fstab.append file will be deleted

  2. Look for an optional fstab.patch file which allows to patch the current contents of the fstab file with a given patch file. Once patched the fstab.patch file will be deleted

  3. Look for an optional fstab.script file which is called chrooted for the purpose of updating the fstab file as appropriate. Note: There is no validation in place that checks if the script actually handles fstab or any other file in the image rootfs. Once called the fstab.script file will be deleted

Parameters

fstab () – instance of Fstab

kiwi boot images provides the linuxrc script, however the kernel also expects an init executable to be present. This method creates a hard link to the linuxrc file

kiwi.system.setup.SystemSetup.create_recovery_archive

Create a compressed recovery archive from the root tree for use with kiwi’s recvoery system. The method creates additional data into the image root filesystem which is deleted prior to the creation of a new recovery data set

kiwi.system.setup.SystemSetup.export_modprobe_setup

Export etc/modprobe.d to given root_dir

Parameters

target_root_dir () – path name

kiwi.system.setup.SystemSetup.export_package_changes

Export image package changelog for comparision of actual changes of the installed packages

Parameters

target_dir () – path name

kiwi.system.setup.SystemSetup.export_package_list

Export image package list as metadata reference used by the open buildservice

Parameters

target_dir () – path name

kiwi.system.setup.SystemSetup.export_package_verification

Export package verification result as metadata reference used by the open buildservice

Parameters

target_dir () – path name

kiwi.system.setup.SystemSetup.import_cdroot_files

Copy cdroot files from the image description to the specified target directory. Supported is a tar archive named config-cdroot.tar[.compression-postfix]

Parameters

target_dir () – directory to unpack archive to

kiwi.system.setup.SystemSetup.import_description

Import XML descriptions, custom scripts, archives and script helper methods

kiwi.system.setup.SystemSetup.import_image_identifier

Create etc/ImageID identifier file

kiwi.system.setup.SystemSetup.import_overlay_files

Copy overlay files from the image description to the image root tree. Supported are a root/ directory or a root.tar.gz tarball. The root/ directory takes precedence over the tarball.

In addition the method also supports profile specific overlay files which are searched in a directory of the same name as the profile name.

The overall order for including overlay files is as follows:

  1. root/ dir or root.tar.gz

  2. PROFILE_NAME/ dir(s) in the order of the selected profiles

Parameters
  • follow_links () – follow symlinks true|false

  • preserve_owner_group () – preserve permissions true|false

kiwi.system.setup.SystemSetup.import_repositories_marked_as_imageinclude

Those <repository> sections which are marked with the imageinclude attribute should be permanently added to the image repository configuration

kiwi.system.setup.SystemSetup.script_exists

Check if provided script base name exists in the image description

Parameters

name () – script base name

kiwi.system.setup.SystemSetup.set_selinux_file_contexts

Initialize the security context fields (extended attributes) on the files matching the security_context_file

Parameters

security_context_file () – path file name

kiwi.system.setup.SystemSetup.setup_groups

Add groups for configured users

kiwi.system.setup.SystemSetup.setup_keyboard_map

Setup console keyboard

kiwi.system.setup.SystemSetup.setup_locale

Setup UTF8 system wide locale

kiwi.system.setup.SystemSetup.setup_machine_id

Setup systemd machine id

There are various states of /etc/machine-id:

  1. Does not exist: Triggers ConditionFirstBoot, but does not work if the filesystem is initially read-only (booted without “rw”).

  2. Exists, is empty: Does not trigger ConditionFirstBoot, but works with read-only mounts.

  3. Exists, contains the string “uninitialized”: Same as b), but triggers ConditionFirstBoot. Supported by systemd v247+ only.

  4. Exists, contains a valid ID.

See the machine-id(5) man page for details.

In images, d) is not desirable, so truncate the file. This is the previous behaviour and what existing images expect. If the image has one of the other states, keep it as-is.

kiwi.system.setup.SystemSetup.setup_permissions

Check and Fix permissions using chkstat

Call chkstat in system mode which reads /etc/sysconfig/security to determine the configured security level and applies the appropriate permission definitions from the /etc/permissions* files. It’s possible to provide those files as overlay files in the image description to apply a certain permission setup when needed. Otherwise the default setup as provided on the package level applies.

It’s required that the image root system has chkstat installed. If not present KIWI skips this step and continuous with a warning.

kiwi.system.setup.SystemSetup.setup_plymouth_splash

Setup the KIWI configured splash theme as default

The method uses the plymouth-set-default-theme tool to setup the theme for the plymouth splash system. Only in case the tool could be found in the image root, it is assumed plymouth splash is in use and the tool is called in a chroot operation

kiwi.system.setup.SystemSetup.setup_selinux_file_contexts

Set SELinux file security contexts if the default context file is found

kiwi.system.setup.SystemSetup.setup_timezone

Setup timezone symlink

kiwi.system.setup.SystemSetup.setup_users

Add/Modify configured users

13.23.10 kiwi.system.shell Module

kiwi.system.shell.Shell

Bases: object

Special character handling for shell evaluated code

kiwi.system.shell.Shell.format_to_variable_value

Format given variable value to return a string value representation that can be sourced by shell scripts. If the provided value is not representable as a string (list, dict, tuple etc) an exception is raised

Parameters

value () – a python variable

Raises

kiwi.exceptions.KiwiShellVariableValueError – if value is an iterable

Returns

string value representation

Return type

str

kiwi.system.shell.Shell.quote

Quote characters which have a special meaning for bash but should be used as normal characters. actually I had planned to use pipes.quote but it does not quote as I had expected it. e.g ‘name_wit_a_$’ does not quote the $ so we do it on our own for the scope of kiwi

Parameters

message () – message text

Returns

quoted text

Return type

str

kiwi.system.shell.Shell.quote_key_value_file

Quote given input file which has to be of the form key=value to be able to become sourced by the shell

Parameters

filename () – file path name

Returns

list of quoted text

Return type

List[str]

kiwi.system.shell.Shell.run_common_function

Run a function implemented in config/functions.sh

Parameters
  • name () – function name

  • parameters () – function arguments

13.23.11 kiwi.system.size Module

kiwi.system.size.SystemSize

Bases: object

Provide source tree size information

Parameters

source_dir () – source directory path name

kiwi.system.size.SystemSize.accumulate_files

Calculate sum of all files in the source tree

Returns

number of files

Return type

int

kiwi.system.size.SystemSize.accumulate_mbyte_file_sizes

Calculate data size of all data in the source tree

Parameters

exclude () – list of paths to exclude

Returns

mbytes

Return type

int

kiwi.system.size.SystemSize.customize

Increase the sum of all file sizes by an empiric factor

Each filesystem has some overhead it needs to manage itself. Thus the plain data size is always smaller as the size of the container which embeds it. This method increases the given size by a filesystem specific empiric factor to ensure the given data size can be stored in a filesystem of the customized size

Parameters
  • size () – mbsize to update

  • requested_filesystem () – filesystem name

Returns

mbytes

Return type

int

13.23.12 kiwi.system.uri Module

kiwi.system.uri.Uri

Bases: object

Normalize and manage URI types

kiwi.system.uri.Uri.alias

Create hex representation of uuid4

If the repository definition from the XML description does not provide an alias, kiwi creates one for you. However it’s better to assign a human readable alias in the XML configuration

Returns

alias name as hex representation of uuid4

Return type

str

kiwi.system.uri.Uri.credentials_file_name

Filename to store repository credentials

Returns

credentials file name

Return type

str

kiwi.system.uri.Uri.get_fragment

Returns the fragment part of the URI.

Returns

fragment part of the URI if any, empty string otherwise

Return type

str

kiwi.system.uri.Uri.is_public

Check if URI is considered to be publicly reachable

Returns

True|False

Return type

bool

kiwi.system.uri.Uri.is_remote

Check if URI is a remote or local location

Returns

True|False

Return type

bool

kiwi.system.uri.Uri.print_sensitive
kiwi.system.uri.Uri.translate

Translate repository location according to their URI type

Depending on the URI type the provided location needs to be adapted e.g updated by the service URL in case of an open buildservice project name

Raises

kiwi.exceptions.KiwiUriStyleUnknown – if the uri scheme can’t be detected, is unknown or it is inconsistent with the build environment

Parameters

check_build_environment () – specify if the uri translation should depend on the environment the build is called in. As of today this only effects the translation result if the image build happens inside of the Open Build Service

Returns

translated repository location

Return type

str

13.23.13 kiwi.system.users Module

kiwi.system.users.Users

Bases: object

Operations on users and groups in a root directory

Parameters

root_dir () – root directory path name

kiwi.system.users.Users.group_add

Add group with options

Parameters
  • group_name () – group name

  • options () – groupadd options

kiwi.system.users.Users.group_exists

Check if group exists

Parameters

group_name () – group name

Returns

True|False

Return type

bool

kiwi.system.users.Users.setup_home_for_user

Setup user home directory

Parameters
  • user_name () – user name

  • group_name () – group name

  • home_path () – path name

kiwi.system.users.Users.user_add

Add user with options

Parameters
  • user_name () – user name

  • options () – useradd options

kiwi.system.users.Users.user_exists

Check if user exists

Parameters

user_name () – user name

Returns

True|False

Return type

bool

kiwi.system.users.Users.user_modify

Modify user with options

Parameters
  • user_name () – user name

  • options () – usermod options

13.23.14 Module Contents

13.24 kiwi.tasks package

13.24.1 Submodules

13.24.2 kiwi.tasks.base Module

kiwi.tasks.base.CliTask

Bases: object

Base class for all task classes, loads the task and provides the interface to the command options and the XML description

Attributes

  • should_perform_task_setup

    Indicates if the task should perform the setup steps which covers the following task configurations: * setup debug level * setup logfile * setup color output

kiwi.tasks.base.CliTask.load_xml_description

Load, upgrade, validate XML description

Parameters
  • description_directory () – Path to the image description

  • kiwi_file () – Basename of kiwi file which contains the main image configuration elements. If not specified kiwi searches for a file named config.xml or a file matching .kiwi

kiwi.tasks.base.CliTask.quadruple_token

Helper method for commandline options of the form –option a,b,c,d

Make sure to provide a common result for option values which separates the information in a comma separated list of values

Parameters

option () – comma separated option string

Returns

common option value representation

Return type

list

kiwi.tasks.base.CliTask.run_checks

This method runs the given runtime checks excluding the ones disabled in the runtime configuration file.

Parameters

checks () – A dictionary with the runtime method names as keys and their arguments list as the values.

kiwi.tasks.base.CliTask.tentuple_token

Helper method for commandline options of the form –option a,b,c,d,e,f,g,h,i,j

Make sure to provide a common result for option values which separates the information in a comma separated list of values

Parameters

option () – comma separated option string

Returns

common option value representation

Return type

list

13.24.3 kiwi.tasks.result_bundle Module

kiwi.tasks.result_bundle.ResultBundleTask

Bases: CliTask

Implements result bundler

Attributes

  • manual

    Instance of Help

kiwi.tasks.result_bundle.ResultBundleTask.process

Create result bundle from the image build results in the specified target directory. Each result image will contain the specified bundle identifier as part of its filename. Uncompressed image files will also become xz compressed and a sha sum will be created from every result image

13.24.4 kiwi.tasks.result_list Module

kiwi.tasks.result_list.ResultListTask

Bases: CliTask

Implements result listing

Attributes

  • manual

    Instance of Help

kiwi.tasks.result_list.ResultListTask.process

List result information from a previous system command

13.24.5 kiwi.tasks.system_build Module

kiwi.tasks.system_build.SystemBuildTask

Bases: CliTask

Implements building of system images

Attributes

  • manual

    Instance of Help

kiwi.tasks.system_build.SystemBuildTask.process

Build a system image from the specified description. The build command combines the prepare and create commands

13.24.6 kiwi.tasks.system_create Module

kiwi.tasks.system_create.SystemCreateTask

Bases: CliTask

Implements creation of system images

Attributes

  • manual

    Instance of Help

kiwi.tasks.system_create.SystemCreateTask.process

Create a system image from the specified root directory the root directory is the result of a system prepare command

13.24.7 kiwi.tasks.system_prepare Module

kiwi.tasks.system_prepare.SystemPrepareTask

Bases: CliTask

Implements preparation and installation of a new root system

Attributes

  • manual

    Instance of Help

kiwi.tasks.system_prepare.SystemPrepareTask.process

Prepare and install a new system for chroot access

13.24.8 kiwi.tasks.system_update Module

kiwi.tasks.system_update.SystemUpdateTask

Bases: CliTask

Implements update and maintenance of root systems

Attributes

  • manual

    Instance of Help

kiwi.tasks.system_update.SystemUpdateTask.process

Update root system with latest repository updates and optionally allow to add or delete packages. the options to add or delete packages can be used multiple times

13.24.9 Module Contents

13.25 kiwi.utils Package

13.25.1 Submodules

13.25.2 kiwi.utils.checksum Module

kiwi.utils.block.BlockID

Bases: object

Get information from a block device

Parameters

device () – block device node name name. The device can also be specified as UUID=<uuid>

kiwi.utils.block.BlockID.get_blkid

Retrieve information for specified metadata ID from block device

Parameters

id_type () – metadata ID, see man blkid for details

Returns

ID of the block device

Return type

str

kiwi.utils.block.BlockID.get_filesystem

Retrieve filesystem type from block device

Returns

filesystem type

Return type

str

kiwi.utils.block.BlockID.get_label

Retrieve filesystem label from block device

Returns

block device label

Return type

str

kiwi.utils.block.BlockID.get_partition_count

Retrieve number of partitions from block device

Returns

A number

Return type

int

kiwi.utils.block.BlockID.get_uuid

Retrieve filesystem uuid from block device

Returns

uuid for the filesystem of the block device

Return type

str

13.25.3 kiwi.utils.block Module

kiwi.utils.checksum.Checksum

Bases: object

Manage checksum creation for files

Parameters
  • source_filename () – source file name to build checksum for

  • checksum_filename () – target file with checksum information

kiwi.utils.checksum.Checksum.matches

Compare given checksum with reference checksum stored in the provided filename. If the checksum matches the method returns True, or False in case it does not match

Parameters
  • checksum () – checksum string to compare

  • filename () – filename containing checksum

Returns

True or False

Return type

bool

kiwi.utils.checksum.Checksum.md5

Create md5 checksum

Parameters

filename () – filename for checksum

Returns

checksum

Return type

str

kiwi.utils.checksum.Checksum.sha256

Create sha256 checksum

Parameters

filename () – filename for checksum

13.25.4 kiwi.utils.compress Module

kiwi.utils.compress.Compress

Bases: object

File compression / decompression

Parameters
  • keep_source () – Request to keep the uncompressed source

  • source_filename () – Source file name to compress

  • supported_zipper () – List of supported compression tools

  • compressed_filename () – Compressed file name path with compression suffix

  • uncompressed_filename () – Uncompressed file name path

kiwi.utils.compress.Compress.get_format

Detect compression format

Returns

compression format name or None if it couldn’t be inferred

Return type

Optional[str]

kiwi.utils.compress.Compress.gzip

Create gzip(max compression) compressed file

kiwi.utils.compress.Compress.uncompress

Uncompress with format autodetection

By default the original source file will be changed into the uncompressed variant. If temporary is set to True a temporary file is created instead

Parameters

temporary () – uncompress to a temporary file

kiwi.utils.compress.Compress.xz

Create XZ compressed file

Parameters

options () – custom xz compression options

13.25.5 kiwi.utils.sync Module

kiwi.utils.sync.DataSync

Bases: object

Sync data from a source directory to a target directory

kiwi.utils.sync.DataSync.sync_data

Sync data from source to target using the rsync protocol

Parameters
  • options () – rsync options

  • exclude () – file patterns to exclude

  • force_trailing_slash () – add ‘/’ to source_dir if not present

A speciality of the rsync tool is that it behaves differently if the given source_dir ends with a ‘/’ or not. If it ends with a slash the data structure below will be synced to the target_dir. If it does not end with a slash the source_dir and its contents are synced to the target_dir. For example

source
  └── some_data

1. $ rsync -a source target

target
  └── source
        └── some_data

2. $ rsync -a source/ target

target
  └── some_data

The parameter force_trailing_slash can be used to make sure rsync behaves like shown in the second case. If set to true a ‘/’ is appended to the given source_dir if not already present

kiwi.utils.sync.DataSync.target_supports_extended_attributes

Check if the target directory supports extended filesystem attributes

Returns

True or False

Return type

bool

13.25.6 kiwi.utils.sysconfig Module

kiwi.utils.sysconfig.SysConfig

Bases: object

Read and Write sysconfig style files

Parameters

source_file () – source file path

kiwi.utils.sysconfig.SysConfig.get
kiwi.utils.sysconfig.SysConfig.write

Write back source file with changed content but in same order

13.25.7 Module Contents

13.26 kiwi.volume_manager Package

13.26.1 Submodules

13.26.2 kiwi.volume_manager.base Module

kiwi.volume_manager.base.VolumeManagerBase

Bases: kiwi.storage.device_provider.DeviceProvider

Implements base class for volume management interface

Parameters
  • mountpoint () – root mountpoint for volumes

  • device_map () – dictionary of low level DeviceProvider intances

  • root_dir () – root directory path name

  • volumes () – list of volumes from XMLState::get_volumes()

  • volume_group () – volume group name

  • volume_map () – map volume name to device node

  • mount_list () – list of volume MountManager’s

  • device () – storage device node name

  • custom_args () – custom volume manager arguments for all volume manager and filesystem specific tasks

  • custom_filesystem_args () – custom filesystem creation and mount arguments, subset of the custom_args information suitable to be passed to a FileSystem instance

Raises

kiwi.exceptions.KiwiVolumeManagerSetupError – if the given root_dir doesn’t exist

kiwi.volume_manager.base.VolumeManagerBase.apply_attributes_on_volume
kiwi.volume_manager.base.VolumeManagerBase.create_verification_metadata

Write verification block on LVM devices is not supported

kiwi.volume_manager.base.VolumeManagerBase.create_verity_layer

veritysetup on LVM devices is not supported

kiwi.volume_manager.base.VolumeManagerBase.create_volume_paths_in_root_dir

Implements creation of volume paths in the given root directory

kiwi.volume_manager.base.VolumeManagerBase.create_volumes

Implements creation of volumes

Implementation in specialized volume manager class required

Parameters

filesystem_name () – unused

kiwi.volume_manager.base.VolumeManagerBase.get_canonical_volume_list

Implements hierarchical sorting of volumes according to their paths and provides information about the volume configured as the one eating all the rest space

Returns

list of canonical_volume_type tuples

Return type

list

kiwi.volume_manager.base.VolumeManagerBase.get_device

Return current DeviceProvider dictionary

Returns

device_map

Return type

dict

kiwi.volume_manager.base.VolumeManagerBase.get_fstab

Implements setup of the fstab entries. The method should return a list of fstab compatible entries

Parameters
  • persistency_type () – unused

  • filesystem_name () – unused

kiwi.volume_manager.base.VolumeManagerBase.get_mountpoint

Provides mount point directory

Effective use of the directory is guaranteed only after sync_data

Returns

directory path name

Return type

string

kiwi.volume_manager.base.VolumeManagerBase.get_root_volume_name

Provides name of the root volume

This is by default set to ‘/’. Volume Managers that supports the concept of sub-volumes overrides this method

Returns

directory path name

Return type

string

kiwi.volume_manager.base.VolumeManagerBase.get_volume_mbsize

Implements size lookup for the given path and desired filesystem according to the specified size type

Parameters
  • volume () – volume to check size for

  • all_volumes () – list of all volume tuples

  • filesystem_name () – filesystem name

  • resize_on_boot – specify the time of the resize. If the resize happens at boot time the volume size is only the minimum size to just store the data. If the volume size is fixed and does not change at boot time the returned size is the requested size which can be greater than the minimum needed size.

Returns

mbsize

Return type

int

kiwi.volume_manager.base.VolumeManagerBase.get_volumes

Implements return of dictionary of volumes and their mount options

kiwi.volume_manager.base.VolumeManagerBase.is_loop

Check if storage provider is loop based

The information is taken from the storage provider. If the storage provider is loop based the volume manager is it too

Returns

True of False

Return type

bool

kiwi.volume_manager.base.VolumeManagerBase.mount_volumes

Implements mounting of all volumes below one master directory

Implementation in specialized volume manager class required

kiwi.volume_manager.base.VolumeManagerBase.post_init

Post initialization method

Implementation in specialized volume manager class if required

Parameters

custom_args () – unused

kiwi.volume_manager.base.VolumeManagerBase.set_property_readonly_root

Implements setup of read-only root property

kiwi.volume_manager.base.VolumeManagerBase.setup

Implements setup required prior to the creation of volumes

Implementation in specialized volume manager class required

Parameters

name () – unused

kiwi.volume_manager.base.VolumeManagerBase.setup_mountpoint

Implements creation of a master directory holding the mounts of all volumes

kiwi.volume_manager.base.VolumeManagerBase.sync_data

Implements sync of root directory to mounted volumes

Parameters

exclude () – file patterns to exclude

kiwi.volume_manager.base.VolumeManagerBase.umount_volumes

Implements umounting of all volumes

Implementation in specialized volume manager class required

13.26.3 kiwi.volume_manager.btrfs Module

kiwi.volume_manager.btrfs.VolumeManagerBtrfs

Bases: VolumeManagerBase

Implements btrfs sub-volume management

Parameters
  • subvol_mount_list () – list of mounted btrfs subvolumes

  • toplevel_mount () – MountManager for root mountpoint

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.create_volumes

Create configured btrfs subvolumes

Any btrfs subvolume is of the same btrfs filesystem. There is no way to have different filesystems per btrfs subvolume. Thus the filesystem_name has no effect for btrfs

Parameters

filesystem_name () – unused

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.get_fstab

Implements creation of the fstab entries. The method returns a list of fstab compatible entries

Parameters
  • persistency_type () – by-label | by-uuid

  • filesystem_name () – unused

Returns

list of fstab entries

Return type

list

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.get_mountpoint

Provides btrfs root mount point directory

Effective use of the directory is guaranteed only after sync_data

Returns

directory path name

Return type

string

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.get_root_volume_name

Provides name of the root volume

Returns

directory path name

Return type

string

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.get_volumes

Return dict of volumes

Returns

volumes dictionary

Return type

dict

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.mount_volumes

Mount btrfs subvolumes

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.post_init

Post initialization method

Store custom btrfs initialization arguments

Parameters

custom_args () – custom btrfs volume manager arguments

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.set_property_readonly_root

Sets the root volume to be a readonly filesystem

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.setup

Setup btrfs volume management

In case of btrfs an optional toplevel subvolume is created and marked as default volume. If snapshots are activated via the custom_args the setup method also creates the .snapshots/1/snapshot subvolumes. There is no concept of a volume manager name, thus the name argument is not used for btrfs

Parameters

name () – unused

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.sync_data

Sync data into btrfs filesystem

If snapshots are activated the root filesystem is synced into the first snapshot

Parameters

exclude () – files to exclude from sync

kiwi.volume_manager.btrfs.VolumeManagerBtrfs.umount_volumes

Umount btrfs subvolumes

Returns

True if all subvolumes are successfully unmounted

Return type

bool

13.26.4 kiwi.volume_manager.lvm Module

kiwi.volume_manager.lvm.VolumeManagerLVM

Bases: VolumeManagerBase

Implements LVM volume management

kiwi.volume_manager.lvm.VolumeManagerLVM.create_volumes

Create configured lvm volumes and filesystems

All volumes receive the same filesystem

Parameters

filesystem_name () – volumes filesystem name

kiwi.volume_manager.lvm.VolumeManagerLVM.get_device

Dictionary of MappedDevice instances per volume

Note: The mapping requires an explicit create_volumes() call

Returns

root plus volume device map

Return type

dict

kiwi.volume_manager.lvm.VolumeManagerLVM.get_fstab

Implements creation of the fstab entries. The method returns a list of fstab compatible entries

Parameters
  • persistency_type () – unused

  • filesystem_name () – volumes filesystem name

Returns

fstab entries

Return type

list

kiwi.volume_manager.lvm.VolumeManagerLVM.get_volumes

Return dict of volumes

Returns

volumes dictionary

Return type

dict

kiwi.volume_manager.lvm.VolumeManagerLVM.mount_volumes

Mount lvm volumes

kiwi.volume_manager.lvm.VolumeManagerLVM.post_init

Post initialization method

Store custom lvm initialization arguments

Parameters

custom_args () – custom lvm volume manager arguments

kiwi.volume_manager.lvm.VolumeManagerLVM.setup

Setup lvm volume management

In case of LVM a new volume group is created on a PV initialized storage device

Parameters

name () – volume group name

kiwi.volume_manager.lvm.VolumeManagerLVM.umount_volumes

Umount lvm volumes

Returns

True if all subvolumes are successfully unmounted

Return type

bool

13.26.5 Module Contents

kiwi.volume_manager.VolumeManager

Bases: object

VolumeManager factory

Parameters
  • name () – volume management name

  • device_map () – dictionary of low level DeviceProvider intances

  • root_dir () – root directory path name

  • volumes () – list of volumes from XMLState::get_volumes()

  • custom_args () – dictionary of custom volume manager arguments

kiwi.volume_manager.VolumeManager.new
Print this page