From b6ed6676d420b750cb56b8bf10a5dcc6e7e77704 Mon Sep 17 00:00:00 2001 From: John Turner Date: Mon, 4 Aug 2025 02:01:33 -0400 Subject: add blog first blog post --- blog/gentoo-on-gcloud.org | 36 ++++++++++++++++++++++++++++++++++++ blog/index.org | 3 +++ 2 files changed, 39 insertions(+) create mode 100644 blog/gentoo-on-gcloud.org create mode 100644 blog/index.org diff --git a/blog/gentoo-on-gcloud.org b/blog/gentoo-on-gcloud.org new file mode 100644 index 0000000..d826e53 --- /dev/null +++ b/blog/gentoo-on-gcloud.org @@ -0,0 +1,36 @@ +* gentoo on google cloud + +Google Cloud only provides Debian and a few other operating system images by default, but does allow bringing your own ISO. + +** gentoo official qcow2 images + +The first thing I tried was booting one of Gentoo's official qcow2 images directly. + +Importing custom images requires downloading the image to a "bucket" which is basically Google's s3 object store. + +Downloading images to a bucket requires transfering data via a URL list. The URL list is a file hosted somewhere with a list of URLs in it, one per line. Maybe using a pastebin for the URL list could work? + +After getting the image downloaded to the bucket, you must go to the "Migrate to Virtual Machines" entry, which is underneath "Compute Engine". Then there will be a button that says "Import Images" (note there is another button called "Import Machine Images" which won't work). The rest should be easy. + +After getting the image imported, you can use it like any other gcloud disk image. + +After doing these steps, I created a new vm instance with the Gentoo qcow2 image as the base, but it failed to boot with an error saying something along the lines of "no bootable media found". + +I am not exactly sure what is wrong with gcloud, but these images boot fine in qemu for me. + +** hijacking a debian image +Instead of using one of the official Gentoo images, we decided to "hijack" one of gclouds already booting Debian images. + +To do this, I created a new instance using the default Debian boot disk, and then cloned the instance's disk while the instance was shut down. Then I booted the instance back up, and attached the clone'd disk to the instance. + +From here, I made a brand new filesystem on the main rootfs partition, but left alone the rest of the disk. You can install Gentoo from a stage3 and chroot in like normal to configure stuff, or install however you'd like. + +When installing the kernel, I just deleted the old debian ~/boot~ contents, and installed ~gentoo-kernel-bin~, and ran ~grub-mkconfig~ like you'd normally do. This also failed to boot, with an error about $UUID not existing. It looks like the old EFI binaries/bootloaders are somehow conflicting with out setup. + +The trick that got it to boot, was clearing out the old EFI binaries completely, and then installing grub with the ~--removable~ flag. Without the ~--removable~ flag, it would not boot. + +After installing our new bootloader, I shut down the instance, detached the boot disk, and reattached the Gentoo disk as the new boot disk. Then booted into Gentoo! + +* tldr + +To get it to boot, you hijack a working image by making a new rootfs on the rootfs partition, replace the kernel, initramfs and then the bootloader with a "removable" bootloader (aka ~grub-install --removable~). diff --git a/blog/index.org b/blog/index.org new file mode 100644 index 0000000..8d4b810 --- /dev/null +++ b/blog/index.org @@ -0,0 +1,3 @@ +* gentoo on gcloud + +[[https://jturnerusa.dev/blog/gentoo-on-gcloud.html][Installing Gentoo on a Google Cloud compute instance!]] -- cgit v1.2.3