Running DietPi VM images on Google Cloud

Hello!

I was wondering if anyone has been able to run DietPi VM images (e.g. *.vmdk images) via the Google Cloud importer?

While Google say they support Debian 9, they also have a specific set of requirements for custom VM images:

https://cloud.google.com/compute/docs/images/building-custom-os

I’ve use DietPi for a SBC for LAN services, but it would be great to be able to run DietPi “in the cloud.” Installing various self-hosted services can take hours when done manually; with DietPi it’s pretty easy (if the application is supported).

I will probably experiment on my own and report back.

For what it’s worth, I was able to pass Google’s pre-check tool, but I got a warning about SSH access (something about port 22 not being open).

Google was also able to successfully convert the VMware image, but I was not able to get in via SSH, although this doesn’t seem to be a SSH issue as you can see from the serial console log:

SeaBIOS (version 1.8.2-20190322_093631-google)

Total RAM Size = 0x000000006cc00000 = 1740 MiB

CPUs found: 1     Max CPUs supported: 1

found virtio-scsi at 0:3

virtio-scsi vendor='Google' product='PersistentDisk' rev='1' type=0 removable=0

virtio-scsi blksize=512 sectors=629145600 = 307200 MiB

drive 0x000f2a20: PCHS=0/0/0 translation=lba LCHS=1024/255/63 s=629145600

Booting from Hard Disk 0...

Gave up waiting for root file system device.  Common problems:

 - Boot args (cat /proc/cmdline)

   - Check rootdelay= (did the system wait long enough?)

 - Missing modules (cat /proc/modules; ls /dev)

ALERT!  UUID=ea6994c8-782d-4c8c-a12b-c104742301cf does not exist.  Dropping to a shell!

(initramfs)

I also tried converting a “pre-installed” VMware image, but that didn’t change anything.

The problem is that obviously while converting the image, the UUID of the virtual disk is not converted as well so the drive of the Google VM finally has a different UUID while the one that the grub bootloader looks for is ea6994c8-782d-4c8c-a12b-c104742301cf.

I think it is not possible to somehow manipulate the UUID of a drive via Google cloud?

I think before tinkering around and if finally a kernel module/setting is missing to support virtio-scsi or something, follow this guide moreless to install a Debian image from scratch and run the DietPi-PREP script on it: https://github.com/MichaIng/DietPi/wiki/How-to-create-a-DietPi-image-for-VirtualBox#download-base-image
It is for VirtualBox but the “Debian installer” and “DietPi-PREP” part should match.


Found the SSH error: https://github.com/GoogleCloudPlatform/compute-image-tools/blob/master/cli_tools/import_precheck/check_ssh.go#L43
Very strange, wherever you run this check, of course port 22 will not be opened in most cases. Since this is not a matter of the image, but of the network, I wonder why this is checked. Of course the VMs on Google Cloud will find port 22 opened… Not sure what is the purpose of this. However I also see they only have OpenSSH in the list: https://github.com/GoogleCloudPlatform/compute-image-tools/blob/master/cli_tools/import_precheck/check_ssh.go#L24
DietPi images come with Dropbear as lightweight SSH server alternative. Not sure if this might be related. However your issue as above is not SSH but the non-matching UUID.

Ah another thing to try, when you are in the initramfs:
set root=(hd0,1)
linux /vmlinuz root=/dev/sda1
initrd /initrd.img
boot
Source: https://www.linux.com/learn/how-rescue-non-booting-grub-2-linux

And if its working and booting first run setup will do 1-2 reboots which means you need to redo the above. After you are finally in cmd terminal to make the changes permanent:
edit /etc/fstab and replace
UUID=ea6994c8-782d-4c8c-a12b-c104742301cf with /dev/sda1.

Then run: update-grub

Thank you for the pointers. I will give it a go over the weekend and see what happens.