- Launch EC2 instance with Amazon Linux 2011.09 64-bit AMI
ddthe contents of the EBS volume over
sshto a local image file.
- Mount the image file as a loopback device and then to a local mount point.
- Create a new empty disk image file, partition with an offset for a bootloader, and create an ext4 filesystem.
- Mount the new image's partition and copy everything from the EC2 image.
- Install grub (using Ubuntu's
grub-legacy-ec2package, not grub2).
- Convert the image file to vmdk using
- Create a new VirtualBox VM with the vmdk.
Now the VM boots, grub loads, and the kernel is found. But it fails when it tries to mount the root device:
dracut Warning: No root device "block:/dev/xvda1" found dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line. dracut Warning: Signal caught! dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line. Kernel panic - not syncing: Attempted to kill init! Pid: 1, comm: init Not tainted 22.214.171.124-107.1.39.amzn1.x86_64 #1
I have tried changing
/boot/grub/menu.lst to find the root device by label and UUID, but nothing works. I'm guessing the xen kernel is not compatible with VirtualBox.
The reasoning behind all this effort is to make a Vagrant box that is as close to possible as the production enviroment, so deploys can be tested locally. I know it's cheap to do test runs on EC2, but poor connectivity often ruins the experience. Plus it would be really nice to have a virtual machine with the production environment so that co-workers don't have to install everything under the sun just to get up and running with app development.
If I were to try running a different kernel, what kernel could I get to be as close as possible to Amazon Linux 2011.09?