Importing Ubuntu 20.04 cloud images

2

Following the instructions at https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html. Doing a

aws ec2 import-image --disk-containers Format=OVA,UserBucket="{S3Bucket=<RedactedBucket>,S3Key=ubuntu-18.04-server-cloudimg-amd64.ova}"

Using the image at https://cloud-images.ubuntu.com/releases/bionic/release/ubuntu-18.04-server-cloudimg-amd64.ova, works as expected and the AMI is created fine.

But the same using https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.ova, i.e the 20.04 image returns

ClientError: We were unable to read your import's initramfs/initrd to determine what drivers your import requires to run in EC2.

I know there are AMIs available with the Ubuntu 20.04, I am trying to understand what causes this error and how to overcome it in a custom OVA I am building.

TIA

  • Had this exact same error trying to import an ubuntu 20.04 image, created on Virtualbox, starting from the ubuntu focal-server-cloudimg-amd64.ova , using default kernel 5.4.0-121-generic.

    Please help!

asked 2 years ago325 views
1 Answer
1

I looked into this and I think I've figured out what's happening. Canonical made a change to their cloud images in which "server" versions no longer include microcode related packages:

https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1938588

The microcode packages, (amd64-microcode and intel-microcode) change the format of the initrd when they're installed. The file can either be a single CPIO archive or a 2-part CPIO archive with 1 part being compressed:

https://unix.stackexchange.com/questions/505746/content-of-initramfs

One of these formats can cause the import service to return a client error. There are 2 general approaches for working around the issue:

  1. If you'd like to use the base image for Ubuntu 20, simply use a EC2 ready AMI from Canonical. They publish their AMI account number to make it easy to find these official images: https://ubuntu.com/server/docs/cloud-images/amazon-ec2

  2. If you have an existing image that has content and modifications you'd like to import, I would try to rebuild the initrd files by installing the microcode packages. Make sure to have a backup first, but then you can attempt to install the microcode packages:

sudo apt-get install -y dracut-core amd64-microcode intel-microcode

After the microcode packages are added the initrd should rebuild automatically in the correct format and resolve the issue, allowing the import to complete normally.

profile pictureAWS
James W
answered a year ago

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