June, 2012

26
Jun 12

Booting F17 without an initramfs

I prefer not to use an initramfs with my laptop these days – it helps get my boot time down to just over 3 seconds (zooooom – check out these optimisations for more information). Here’s how I configured grub so that I don’t have to edit my grub config every time there is a kernel update. I made sure /etc/grub2/default has these lines:


GRUB_DISABLE_LINUX_UUID=true
GRUB_CMDLINE_LINUX="rootfstype=ext4 quiet libahci.ignore_sss=1 raid=noautodetect rd.lvm=0 rd.dm=0 SYSFONT=True KEYTABLE=uk rd.luks=0 LANG=en_US.UTF-8 rhgb quiet"

This isn’t yet quite enough, since I need to point grub at the correct root device. As things stand, grub2-mkconfig doesn’t seem to know about /dev/root.

Also, because kernel updates automatically provide an initramfs and /etc/grub.d/10_linux checks for the presence of that when generating config, I need to run a small script after each kernel update:

Here is /root/bin/move-initramfs-from-boot:

#!/bin/sh
ln -s /dev/sda3 /dev/root && mv /boot/initramfs* ~/initramfs/ && grub2-mkconfig -o /boot/grub2/grub.cfg

UPDATE: my friend Graham has pointed out a nicer way to run scripts after install. Copy his method, I have!