So you want to replace your bootloader with
core/grub? or maybe you don’t know you do yet…
WHY? I hear you ask. Why not? I thought it would be funny. At this point, I’m still very much trying to learn Habitat and what it can and cannot do. VMs are disposable, so worst case scenario I have to delete a non booting VM, best case scenario I delete a booting VM having proven it works…
In this post, we’ll explore how I did just that!
I spun up a brand new CentOS 7 instance in our VMware/OpenStack instance. (This is only relevant due to cloud-init). Nothing really remarkable about the image. It’s generally been hardened following CIS specs.
# install hab, all the obvious places are mouted as noexec, so install using `/root` four our tmpdir # tsk tsk, curling straight to a root shell curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | sudo TMPDIR=/root bash # remove grub rpms # grub2* would work too, but it doesn't look like a few of the more esoteric packages are included in core/grub yum remove grub2 grub2-tools # install grub with habitat hab pkg install core/grub # binlink so our system knows where to find our binaries hab pkg binlink core/grub # recreate our grub config, _might_ be unnecessary... # note on RHEL/CentOS systems this was `grub2-mkconfig` before grub-mkconfig # reboot reboot
Interestingly it seems cloud-init didn’t pick up the new name as the instance name changed when it rebooted, but the system seemed to come up straight away with no complaints. So I’m calling it a win!
I’ve created a gist of my terminal output during the ordeal for your light reading. There are some interesting differences in the grub.conf. (Should have run a diff!)
EDIT: So it seems my
grub-mkconfig bit is only printing to STDOUT… what you actually need is
grub-mkconfig -o /boot/grub.cfg (or wherever your actual grub.cfg file lives, seems to vary depending on OS/Initial grub version)