New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid grub2 ignition URL variables #1317

Closed
bgeesaman opened this Issue Jul 7, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@bgeesaman

bgeesaman commented Jul 7, 2017

Is this a BUG REPORT or FEATURE REQUEST?

Choose one: BUG REPORT

Versions

  • Tectonic version (release or commit hash): 1.6.4-tectonic.1
  • Terraform version: v0.9.6
  • Platform: metal

What happened?

During the graphical installation of Tectonic-Kubernetes using matchbox 0.6.1, my grub (not ipxe) systems were unable to pull a valid http-based "configfile" via the /grub endpoint in matchbox using the installer-generated profiles placed into matchbox.

This is what was placed in /var/lib/matchbox/profiles/coreos-install.json by the installer:

{
	"id": "coreos-install",
	"ignition_id": "coreos-install.yaml.tmpl",
	"boot": {
		"kernel": "/assets/coreos/1409.5.0/coreos_production_pxe.vmlinuz",
		"initrd": [
			"/assets/coreos/1409.5.0/coreos_production_pxe_image.cpio.gz"
		],
		"args": [
			"coreos.config.url=http://deploy.lab:8080/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
			"coreos.first_boot=yes",
			"console=tty0",
			"console=ttyS0"
		]
	}
}

but since I'm using grub and not ipxe, this is what it needs to be in order to work on my grub-booting PCs:

{
	"id": "coreos-install",
	"ignition_id": "coreos-install.yaml.tmpl",
	"boot": {
		"kernel": "/assets/coreos/1409.5.0/coreos_production_pxe.vmlinuz",
		"initrd": [
			"/assets/coreos/1409.5.0/coreos_production_pxe_image.cpio.gz"
		],
		"args": [
			"coreos.config.url=http://deploy.lab:8080/ignition?mac=$net_default_mac",
			"coreos.first_boot=yes",
			"console=tty0",
			"console=ttyS0"
		]
	}
}

and this is what it needs to be in order to work on my grub-booting Mac Minis/Mac Pro:

{
	"id": "coreos-install",
	"ignition_id": "coreos-install.yaml.tmpl",
	"boot": {
		"kernel": "/assets/coreos/1409.5.0/coreos_production_pxe.vmlinuz",
		"initrd": [
			"/assets/coreos/1409.5.0/coreos_production_pxe_image.cpio.gz"
		],
		"args": [
			"coreos.config.url=http://deploy.lab:8080/ignition?mac=$net_efinet0_dhcp_mac",
			"coreos.first_boot=yes",
			"console=tty0",
			"console=ttyS0"
		]
	}
}

If I edit the profile by hand and network boot one type of system that I have, that system works. If I edit that profile again, I can then network boot the other types of systems that I have successfully. I have Dells and SuperMicros (grub i386) as well as Mac Minis and a Mac Pro (grub-efi x86_64).

Matchbox's Grub handler simply renders the lines provided in the args list of the tectonic-installer provided profile into the grub.cfg served when a match is made at deploy.lab:8080/grub, but the variables used uuid=$${uuid}&mac=$${mac:hexhyp} are only valid for ipxe boot environments, not for grub2. Grub2 doesn't seem to have a uuid or mac variable, but it does have a $net_default_mac and/or a net_efinet0_dhcp_mac variable set (system dependent) for accessing the system's mac address.

Unfortunately, it appears that modifications to the profile supplied by the installer as well as the matchbox /grub and /ipxe handlers would need to be made in order to make things work seamlessly for all booting methods. e.g. The installer sends a "generic" url parameter in the coreos-install.json profile and the grub and ipxe handlers do a template/substitution to place in the proper configuration/variables to match. The downside is that there would be a hard coupling of installer and matchbox version numbers for any metal installations should this feature be made.

I can potentially contribute most (maybe all?) of this feature set if desired, but I'd prefer to get a thumbs up from the maintainers before undertaking it. I'm not a go developer, but I think the amount of logic to be edited is minimal.

What is a potential workaround?

If I give up ipxe and only use grub for booting systems, I can:

  1. Build a custom version of matchbox and edit the http /grub handler to include if/then logic to grab either $net_default_mac or $net_efinet0_dhcp_mac and assign it to a grub variable called$mac_address
  2. Run the graphical-installer until the terraform apply is done.
  3. Hand-edit the coreos-install.json like such:
"coreos.config.url=http://deploy.lab:8080/ignition?mac=$mac_address",
  1. Finally power on and network boot my systems.

What you expected to happen?

I expected the tectonic-installer to place valid, bootable profiles into matchbox for either ipxe or grub2 boot methods.

How to reproduce it (as minimally and precisely as possible)?

  • Set up matchbox
  • Set up dnsmasq using the grub setup instructions
  • Run the tectonic-installer with metal options (I did one controller and one worker)
  • Watch the matchbox logs hand out 404s upon sending invalid requests to /grub while the client's grub boot fails and falls back to a grub> prompt.
@bgeesaman

This comment has been minimized.

bgeesaman commented Jul 7, 2017

After further digging and troubleshooting, another workaround that requires no code changes is to clone the coreos-install.json profile to make one for each host (making the edits to the URL params for mac address variables for that system) and modify the per-host groups to point to the new per-host profiles.

I don't know what the long term ramifications are from this in terms of future cluster scaling and runs of terraform applyin how they might overwrite all this, though.

@robszumski

This comment has been minimized.

Member

robszumski commented Jul 12, 2017

@dghubble Any ideas on this one?

@bgeesaman

This comment has been minimized.

bgeesaman commented Jul 31, 2017

So, my workaround to manually edit the profile JSONs certainly worked, but it wasn't at all a scalable solution as I had to edit and make new profiles per instance before powering on the systems. I've moved on to another solution at this point, but I hope I can pick Tectonic/Matchbox up for future use on another project.

@bgeesaman bgeesaman closed this Jul 31, 2017

@dghubble

This comment has been minimized.

Contributor

dghubble commented Aug 2, 2017

@robszumski the efi grub support endpoints were de-prioritized a while ago to focus on iPXE. We can pick it up if that's desired now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment