Importing .ova to EC2 fails with "ClientError: Unknown OS / Missing OS files."

0

Hi all,

I'm trying to convert VMware virtual machines to EC2 instances, but the import always fails with "ClientError: Unknown OS / Missing OS files."

Here's my process:

  1. I start with a CentOS 7.9 VM on ESXi (supported according to https://docs.aws.amazon.com/vm-import/latest/userguide/vmie_prereqs.html#vmimport-operating-systems). The VM is bootable, has only one volume (MBR, ext4) and otherwise nothing special.

  2. I use ovftools to export the VM from ESXi to .ova:

/usr/lib/vmware-ovftool/ovftool --X:logFile=mytestvm-log.txt --X:logLevel=warning --noSSLVerify --powerOffSource vi://$user:$pass@vmhost/mytestvm /volumes/vmexport/mytestvm.ova
Opening VI source: vi://$user@vmhost:443/mytestvm
Opening OVA target: /volumes/vmexport/mytestvm.ova
Writing OVA package: /volumes/vmexport/mytestvm.ova
Transfer Completed                    
Completed successfully

I tried this as well as exporting to OVF and then manually creating a tar file from it - same result. There's nothing in the log that indicates any problem. I can re-import the ova file and run it on ESXi, so it doesn't seem to be broken in any way.

  1. Upload the .ova to S3:
aws s3 cp --sse --acl private /vm/mytestvm.ova s3://mv-ova-test

  1. Create a presigned URL for the file:
aws s3  presign s3://mv-ova-test/mytestvm.ova --expires-in 86400
  1. Make a .json to describe the import:
[
  {
    "Description": "ova-import-test",
    "Format": "ova",
    "Url": "https://mv-ova-test.s3.eu-central-1.amazonaws.com/mytestvm.ova?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential={the rest of the URL}"
  }
]

  1. Start the import:
aws ec2 import-image --description "ova import test" --disk-containers "file://mytestvm.json"

{
    "Description": "test ova import",
    "ImportTaskId": "import-ami-06c5fc120d02749d7",
    "Progress": "1",
    "SnapshotDetails": [
        {
            "Description": "mytestvm",
            "DiskImageSize": 0.0,
            "Format": "OVA",
            "Url": "https://mv-ova-test.s3.eu-central-1.amazonaws.com/mytestvm.ova?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential={the rest of the URL}",
            "UserBucket": {}
        }
    ],
    "Status": "active",
    "StatusMessage": "pending"
}

  1. Check the import task:
{
    "ImportImageTasks": [
       
            "Description": "test ova import",
            "ImportTaskId": "import-ami-06c5fc120d02749d7",
            "Progress": "19",
            "SnapshotDetails": [
                {
                    "DiskImageSize": 7062419968.0,
                    "Format": "VMDK",
                    "Status": "active",
                    "Url": "https://mv-ova-test.s3.eu-central-1.amazonaws.com/mytestvm.ova?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential={the rest of the URL}",
                    "UserBucket": {}
                }
            ],
            "Status": "active",
            "StatusMessage": "converting",
            "Tags": []
        }
    ]
}

  1. And in the end I get:
{
    "ImportImageTasks": [
        {
            "Description": "test ova import",
            "ImportTaskId": "import-ami-06c5fc120d02749d7",
            "SnapshotDetails": [
                {
                    "DeviceName": "/dev/sde",
                    "DiskImageSize": 7062419968.0,
                    "Format": "VMDK",
                    "Status": "completed",
                    "Url": "https://mv-ova-test.s3.eu-central-1.amazonaws.com/mytestvm.ova?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential={the rest of the URL}",
                    "UserBucket": {}
                }
            ],
            "Status": "deleted",
            "StatusMessage": "ClientError: Unknown OS / Missing OS files.",
            "Tags": []
        }
    ]
}
  1. Trying to import the vmdk alone makes no difference:
{
    "ImportImageTasks": [
        {
            "Description": "test vmdk import",
            "ImportTaskId": "import-ami-0e1dc2522176e0cdf",
            "SnapshotDetails": [
                {
                    "Description": "test-vm",
                    "DeviceName": "/dev/sde",
                    "DiskImageSize": 7062419968.0,
                    "Format": "VMDK",
                    "Status": "completed",
                    "Url": "https://mv-ova-test.s3.eu-central-1.amazonaws.com/mytestvm.ova?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential={the rest of the URL}",
                    "UserBucket": {}
                }
            ],
            "Status": "deleted",
            "StatusMessage": "ClientError: Unknown OS / Missing OS files.",
            "Tags": []
        }
    ]
}

So. What could be the cause for "ClientError: Unknown OS / Missing OS files" if I use a supported OS and the .ova seems to be intact? Would I have the same issue if I tried using MGN for this?

Thanks,

Marc

Marc
asked 2 years ago2589 views
3 Answers
1

At least one thing to check is whether or not you have encryption enabled. I was doing something similar recently and although the the ovftool did not produce an error, the resulting ova file was not usable.

MGN is a separate migration method through the use of an agent installed on the VM and then block-level replication into AWS. There are a number of network requirements for MGN. https://docs.aws.amazon.com/mgn/latest/ug/Network-Settings-Video.html.

profile pictureAWS
EXPERT
answered 2 years ago
  • Thanks for your reply. The only step that involves encryption is the SSE for S3, the disk itself is unencrypted and ESXi doesn't even support encryption at the HV level as far as I know. MGN looks a bit like overkill for the one or two machines I wanted to migrate.

0

i have same issue for an centos 8, still investigating (was thinking i have missed install cloud-init). Marc have u solved the problem?

wmz
answered 2 years ago
  • No, I haven't yet.

  • Just to make sure, it was working. I had a CentOS8 VM running under VMware Fusion

    ./ovftool /Virtual\ Machines.localized/CentOS8-VM.vmwarevm/CentOS8-VM.vmx /Work/CentOS8-VM.ova

    I split the file up into multi-parts to get it into S3, but then ran the VM import task on it.

    { "ImportImageTasks": [ { "Architecture": "x86_64", "ImageId": "ami-xxxx", "ImportTaskId": "import-ami-xxxxx", "LicenseType": "BYOL", "Platform": "Linux", "SnapshotDetails": [ { "DeviceName": "/dev/sda1", "DiskImageSize": 4243619840.0, "Format": "VMDK", "SnapshotId": "snap-xxxxx", "Status": "completed", "UserBucket": { "S3Bucket": "sbx-s3-xxxxx", "S3Key": "CentOS8-VM.ova" } } ], "Status": "completed", "Tags": [], "BootMode": "legacy_bios" } ] }

    It completed without error.

0

Hi Marc, have you solved the problem?

alieZ
answered a year ago
  • Hi Alie, no I have not - it might have been a problem with CentOS 7 only, see answer from Michael above who had success with CentOS 8.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions