Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

gcp custom vm created from virtualbox

i uploaded a vm i created in virtual box using packer. i uploaded to a bucket and tried importing it with

gcloud compute images import rocky-linux-9-custom-v20240523 --sourcefile=gs://mybucket/RockyLinux.ovf --os=rocky-9 --format=vmdk

 

but it keeps failing here

 

step "translate-disk" run error: step "wait-for-translator" run error: WaitForInstancesSignal FailureMatch found for "inst-translator-translate-translate-disk-md2v8": "TranslateFailed: error: inspect_vm: no operating systems found"
ERROR
ERROR: build step 0 "us-central1-docker.pkg.dev/compute-image-import/wrappers/gce_vm_image_import:release" failed: step exited with non-zero status: 1
ERROR: (gcloud.compute.images.import) build a39daecd-da30-406f-a253-45e7f2ddc3f3 completed with status "FAILURE"

 

i checked and disabled splash screen in my grub file

GRUB_CMDLINE_LINUX=""

any idea why

 

3 9 1,370
9 REPLIES 9

Hello @gcp888  ,Welcome on Google Cloud Community.

1. Rocky Linux is available from Marketplace: 

DamianS_0-1716873262755.png

2. Regarding requirements 

  • Perform a consistency check on the disk image by using the qemu-img check command on the disk.
  • or ensure that your OVF and VMDK files are correctly structured and not corrupted. You can use tools like ovftool to validate and convert OVF files if needed. 
    ovftool --lax /path/to/RockyLinux.ovf /path/to/output
    ​
  • or use VBoxManage utility to deal with image: https://www.virtualbox.org/manual/ch08.html
  • To export the virtual disk, use the export function of your VM management software. Don't copy the VMDK file from your VM manager's filesystem.
  • The image file must be of a supported image.
  • The disk image filename must be disk.raw.
  • The RAW image file must have a size in an increment of 1 GB. For example, the file must be either 10 GB or 11 GB but not 10.5 GB.
  • The compressed file must be a .tar.gz file that uses gzip compression and the --format=oldgnu option for the tar utility (manual).+

3. Regarding your disk
1. It looks like your disk is in wrong format. For VirtualBox it should be disk.raw according to https://cloud.google.com/compute/docs/import/import-existing-image#create_image_file
2. After that import should be either possible from CLI or UI. You could also create new disk, from this tar file. 
https://cloud.google.com/compute/docs/import/import-existing-image#gcloud-and-gsutil

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost

 

If you have macos and you are not able to install virtualbox, please follow those steps:

1. I've downloaded clear rocky.vdi file from Internet. (as I had not any VDI files locally)
2. I've created disk.raw file by executing 

 

dd if=RockyLinux_9.0_VBM_LinuxVMImages.COM.vdi of=raw/disk.raw bs=4M conv=sparse

 

3. Next, I've installed gnu-tar via brew.
4. I've used gtar because normal tar didn't used --format=oldgnu parameter

 

gtar --format=oldgnu -Sczf compressed-image.tar.gz disk.raw --verbose

 

5. I've created bucket via UI.
6. I've uploaded compressed-image.tar.gz via UI ( was faster). 
7. I've imported image via UI ( again was faster ). as a source, I've provided cloud bucket compressed-image.tar.gz file. 
8. Once done, I've created VM.

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost

hi

 

I cannot use rockylinux from market place because it does not use lvm. i tried doing

dd if=/dev/sda of=/mnt/disk.raw bs=4M conv=sparse status=progress but I ran out of space. 

 

What is the issue to configure LVM on Rocky linux from marketplace ? 
 


@gcp888 wrote:

i tried doing

dd if=/dev/sda of=/mnt/disk.raw bs=4M conv=sparse status=progress but I ran out of space. 


 

Yes, because you don't have enough space on your PC / laptop or wherever you are executing this command .

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost

so do i need to export it to another or external disk? because my /mnt is on my sda

Wherever you have enough space. 


@gcp888 wrote:

dd if=/dev/sda of=/mnt/disk.raw bs=4M conv=sparse status=progress but I ran out of space.


You said, that you have ovf file. So I'm wondering WHY are you sourcing /dev/sda ?

Did you follow steps from this instruction ? https://cloud.google.com/compute/docs/import/import-existing-image#virtualbox

PS: I've configured LVM on RockyLinux 9 taken from Marketplace without any issue.

 

i tried but i keep getting following error

gcloud compute images create rockylinux-custom \
--project=healthy-display-417113 \
--source-uri=https://storage.googleapis.com/xxxxxxx/compressed-image.tar.gz \
--storage-location=us-central1
ERROR: (gcloud.compute.images.create) Could not fetch resource:
- The tar archive is not a valid image.

 

I created the compressed image from vboxmanage

For me you have error in "--source-uri". It should not be authentication URL. You should choose gsutil URI. 

DamianS_0-1716959201378.png

webaap-wordpress-load)$ gcloud compute images create my-image --source-uri=gs://import-images-random-bucket/compressed-image.tar.gz --project=webaap-wordpress-load  --storage-location=us-central
1
Created [https://www.googleapis.com/compute/v1/projects/webaap-wordpress-load/global/images/my-image].
NAME: my-image
PROJECT: webaap-wordpress-load
FAMILY: 
DEPRECATED: 
STATUS: READY
damian_sztankowski@cloudshell:~ (webaap-wordpress-load)$ 

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost

ok I think i was importing the wrong file "ovf" instead of vmdk.

so I after i created my cirtualbox image via packer.

it outputs was a vmdk disk and an ovf file. 

I went ahead and gsutil copied the vmdk file to my bucket and imported it with

gcloud compute images import rocky-linux9-custom \
--source-file=gs://xxxxxx/RockyLinux-disk001.vmdk

now i see the image in gcp

i havent tried the tar.gz method.