Configuration files

From CRIU
Revision as of 23:56, 26 November 2018 by Radostin (talk | contribs) (Reword introduction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Many of CRIU's command-line options can also be influenced via configuration files. These files are evaluated in CLI and RPC mode, before the options set via CLI or RPC (except for the RPC configuration file). This means that whatever is configured in the files will be overwritten by explicitly set values via CLI or RPC.

Configuration File Location[edit]

The default configuration files parsed by CRIU, if they are present on the system, are first /etc/criu/default.conf and then $HOME/.criu/default.conf. Settings in the file /etc/criu/default.conf are overridden by settings in $HOME/.criu/default.conf. CRIU also evaluates the configuration file specified via CRIU_CONFIG_FILE.

Without any additional parameters CRIU configuration file parsing works like this:

  1. /etc/criu/default.conf; these values can be overridden by
  2. $HOME/.criu/default.conf; these values can be overridden by
  3. CRIU_CONFIG_FILE; these values can be overridden by
  4. --config FILENAME; these values can be overridden by
  5. CLI or RPC configuration options
  6. RPC configuration file (only in RPC mode)

The user can tell CRIU to completely ignore configuration files in one of the default locations (/etc or $HOME) with the --no-default-config option. In this case the user can still tell CRIU to use a configuration file with the --config FILENAME option. CRIU also honours the environment variable CRIU_CONFIG_FILE just as --config FILENAME option.

Configuration File Syntax[edit]

Comments are supported using the '#' character. The rest of the line is ignored. Options are the same as command line options without the '--' prefix, use one option per line (with corresponding argument if applicable, divided by whitespaces). If needed, the argument can be provided in double quotes (this should be needed only if the argument contains whitespaces). In case this type of argument contains a literal double quote as well, it can be escaped using the '\' character. Usage of commands is disallowed and all other escape sequences are interpreted literally.

Example of Configuration File[edit]

$ cat ~/.criu/default.conf
tcp-established
work-dir "/home/USERNAME/criu/my \"work\" directory"
#this is a comment
no-restore-sibling   # this is another comment

Configuration Files in RPC Mode[edit]

As configuration file settings are overridden by CLI and RPC mode, there is a special RPC option which let's the RPC user define a configuration file that will overwrite all other configuration file or RPC settings. Using "req.opts.config_file = '/path/to/file'" it is possible to provide such a configuration file that overwrites all other settings.

This can lead to undesired behavior of criu and should only be used carefully.

Related[edit]