Search code examples
linux-kernelgoogle-compute-enginegrub2

How do I install a custom kernel on a google compute engine instance?


I would like to install a custom kernel image on a Google Compute Engine instance. I have an instance running with:

foo@instance-1:/boot/efi$ uname -a
Linux instance-1 4.10.0-22-generic #24-Ubuntu SMP Mon May 22 17:43:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

And I've built and installed my kernel image:

sudo dpkg -i linux-image-4.10.0-rc8.10.0-rc8_amd64.deb

It shows up in the grub configuration file, I've set the default grub menu item to correct number, and I've run

sudo update-grub

Yet, when I reboot, I get the same kernel I started with.

Google documentation on this seems to be non-existent. There is one spot that suggests I might have to create the image externally, install the kernel, and import it. However, I will need to do this a lot, so I'd rather just install new kernels the old fashioned way.


Solution

  • Turns out that in Google's stock Ubuntu image, there's a grub config file:

    /etc/default/grub.d/50-cloudimg-settings.cfg
    

    that overrides what's in

    /etc/default/grub
    

    Editing the first file got everything working.