rancher / k3os

Purpose-built OS for Kubernetes, fully managed by Kubernetes.
https://k3os.io
Apache License 2.0
3.5k stars 403 forks source link

grub.cfg not supported by Xen's pygrub #520

Open Jille opened 4 years ago

Jille commented 4 years ago

Version (k3OS / kernel) k3os version v0.10.2 xen-utils-4.9

Architecture x86_64

Describe the bug I'm trying to boot K3OS with Xen using PyGrub. K3OS uses this grub stanza:

menuentry "k3OS Current" {
  search.fs_label K3OS_STATE root
  set sqfile=/k3os/system/kernel/current/kernel.squashfs
  loopback loop0 /$sqfile
  set root=($root)
  linux (loop0)/vmlinuz printk.devkmsg=on console=tty1 console=console
  initrd /k3os/system/kernel/current/initrd
}

Both search.fs_label and loopback aren't supported by PyGrub.

There's two routes to fix this:

  1. Implement these features in PyGrub. (Will be a while until that makes it into all distros)
  2. Stop using these features in K3OS.

What route do you prefer?

For 1: https://www.gnu.org/software/grub/manual/grub/html_node/search.html says search.fs_label is just an alias, so that should be a trivial fix.

For 2: The easy fix is not to compress the kernel with squashfs (just like you do for the 'previous' kernel), that removes the need for loopback. But I suspect there's a reason you did it this way (saving space?) which I don't know.

After these two fixes it seems to work fine (I worked around it by not using pygrub but hardcoding a kernel and ramdisk, so updates won't work.)

Actual behavior

Using <class 'grub.GrubConf.Grub2ConfigFile'> to parse /boot/grub/grub.cfg
WARNING:root:Unknown image directive search.fs_label
WARNING:root:Unknown image directive loopback
dweomer commented 4 years ago

The "previous" grub entry is out of date, it will use a squashfs as well.