I am trying to make a template VM using virt-sysprep. The host is CentOS 7, and the guests are CentOS 7 in LVM partitions (not RAW or qcow image files). The guest I'm working with has LUKS full disk encryption, set up at install time. When I run virt-sysprep with -v, I can see that it seems to recognize the basic disk structure in the guest, and it lists what appears to be all entries under /dev. However, it fails with an error:

virt-sysprep: error: no operating systems were found in the guest image

The command I'm trying is:

virt-sysprep -d base1 --hostname basetest.mydomain.com --echo-keys --keys-from-stdin

Has anyone managed to get virt-sysprep to work with a LUKS encrypted guest on LVM?

  • I don't think it will ever work, precisely because the guest is encrypted. (Which doesn't seem to make a lot of sense; normally you encrypt the host storage.) – Michael Hampton Apr 26 at 17:19
  • In the man page there is a --key option, which allows you to put a LUKS passphrase in the command. The --keys-from-stdin seems to allow you to be prompted for the key instead, but I have not been able to get that aspect to work. I'm going to try getting it to work with --keys instead. – user2792137 Apr 29 at 14:26
  • Looking further into it, It seems that the --key option is missing from newer versions of virt-sysprep, so maybe the developer gave up on LUKS in the guests. – user2792137 Apr 29 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.