Virt-sysprep

From wikieduonline
Jump to navigation Jump to search

virt-sysprep[1] command included in libguestfs-tools package reset, unconfigure or customize a virtual machine so clones can be made.

WARNING: Using virt-sysprep on live virtual machines, or concurrently with other disk editing tools, can be dangerous, potentially causing disk corruption. Virtual Machine must be shut down.

Command examples[edit]

  • List operations:
virt-sysprep --list-operations
  • Performs a read-only "dry run" sysprep operation:
virt-sysprep --dry-run TEST_VM_TO_RESET
  • To reset everything:
virt-sysprep -d TEST_VM_TO_RESET
  • To Change name and force to keep user account MY_USERNAME_TO_KEEP
virt-sysprep -d testvm --hostname testvm --enable user-account --keep-user-accounts MY_USERNAME_TO_KEEP
  • virt-sysprep -d bionic[2]

Related commands[edit]

Help[edit]

virt-sysprep
virt-sysprep: error: you must give either -a or -d options.  Read
virt-sysprep(1) man page for further information.

If reporting bugs, run virt-sysprep with debugging enabled and include the
complete output:

 virt-sysprep -v -x [...]


virt-sysprep --help
virt-sysprep: reset or unconfigure a virtual machine so clones can be made

 virt-sysprep [--options] -d domname

 virt-sysprep [--options] -a disk.img [-a disk.img ...]

A short summary of the options is given below.  For detailed help please
read the man page virt-sysprep(1).

Options:
  -a, --add <file>                    Add disk image file
  --append-line <FILE:LINE>           Append line(s) to the file
  -c, --connect <uri>                 Set libvirt URI
  --chmod <PERMISSIONS:FILE>          Change the permissions of a file
  --color, --colors, --colour, --colours
                                      Use ANSI colour sequences even if not tty
  --commands-from-file <FILENAME>     Read customize commands from file
  --copy <SOURCE:DEST>                Copy files in disk image
  --copy-in <LOCALPATH:REMOTEDIR>     Copy local files or directories into image
  -d, --domain <domain>               Set libvirt guest name
  --delete <PATH>                     Delete a file or directory
  -n, --dryrun, --dry-run             Perform a dry run
  --echo-keys                         Don’t turn off echo for passphrases
  --edit <FILE:EXPR>                  Edit file using Perl expression
  --enable <operations>               Enable specific operations
  --firstboot <SCRIPT>                Run script at first guest boot
  --firstboot-command <'CMD+ARGS'>    Run command at first guest boot
  --firstboot-install <PKG,PKG..>     Add package(s) to install at first boot
  --format <format>                   Set format (default: auto)
  --help                              Display brief help
  --hostname <HOSTNAME>               Set the hostname
  --install <PKG,PKG..>               Add package(s) to install
  --keep-user-accounts <users>        Users to keep
  --key <SELECTOR>                    Specify a LUKS key
  --keys-from-stdin                   Read passphrases from stdin
  --link <TARGET:LINK[:LINK..]>       Create symbolic links
  --list-operations                   List supported operations
  --mkdir <DIR>                       Create a directory
  --mount-options <opts>              Set mount options (eg /:noatime;/var:rw,noatime)
  --move <SOURCE:DEST>                Move files in disk image
  --network                           Enable appliance network
  --no-logfile                        Scrub build log file
  --no-network                        Disable appliance network (default)
  --no-selinux-relabel                Compatibility option, does nothing
  --operation, --operations <operations>
                                      Enable/disable specific operations
  --password <USER:SELECTOR>          Set user password
  --password-crypto <md5|sha256|sha512>
                                      Set password crypto
  -q, --quiet                         Don’t print progress messages
  --remove-user-accounts <users>      Users to remove
  --root-password <SELECTOR>          Set root password
  --run <SCRIPT>                      Run script in disk image
  --run-command <'CMD+ARGS'>          Run command in disk image
  --script <script>                   Script or program to run on guest
  --scriptdir <dir>                   Mount point on host
  --scrub <FILE>                      Scrub a file
  --selinux-relabel                   Relabel files with correct SELinux labels
  --sm-attach <SELECTOR>              Attach to a subscription-manager pool
  --sm-credentials <SELECTOR>         Credentials for subscription-manager
  --sm-register                       Register using subscription-manager
  --sm-remove                         Remove all the subscriptions
  --sm-unregister                     Unregister using subscription-manager
  --ssh-inject <USER[:SELECTOR]>      Inject a public key into the guest
  --timezone <TIMEZONE>               Set the default timezone
  --touch <FILE>                      Run touch on a file
  --truncate <FILE>                   Truncate a file to zero size
  --truncate-recursive <PATH>         Recursively truncate all files in directory
  --uninstall <PKG,PKG..>             Uninstall package(s)
  --update                            Update packages
  --upload <FILE:DEST>                Upload local file to destination
  -V, --version                       Display version and exit
  -v, --verbose                       Enable libguestfs debugging messages
  --write <FILE:CONTENT>              Write file
  -x                                  Enable tracing of libguestfs calls

Activities[edit]

See also[edit]

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Source: wikiversity

Advertising: