Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: people / fr33domlover /

libreboot-fix.mdwn

I have an X60s laptop, liberated, with Libreboot.

One special thing about Libreboot is that it comes with its own GRUB. The GRUB configuration makes some assumptions about your partitions:

But my case is different. I installed [[Trisquel|http://trisquel.info]], a fully free GNU/Linux-libre distribution, using its netinst image. The network installer has suport for custom partition setup, which I needed for an encrypted volume containing my home and swap partitions. Anyway, the point is that I also made - as I always do - a separate partition for /boot, which isn’t the same as the / (i.e. root) partition.

First partition on disk is the boot partition. Second is root. Then the encrypted volume.

When upgrading the kernel package, the OS updates the symlinks I mentioned above, but they are in the root partition, not in the boot partition. So Libreboot’s GRUB can’t see them. Also, it tells the kernel that the root partition is /dev/sda1, and that’s incorrect since the root partition in my case is actualy /dev/sda2.

So how can the OS even be booted? One obvious way is to boot from a Live USB (or similar) and modify files on the haddrive. Another way, easy and quick, is to manually type GRUB commands.

After GRUB loads and you see the main menu, press c. You can then type in commands. GRUB has many of them, but there’s tab completion. First, enter the following:

set root='ahci0,1'

This may need to be adapted to your specific config. Skip to extraction of the GRUB config (using a Live USB) if needed.

Find the kernel you want to boot:

ls / -lh

Tell GRUB which kernel you want to boot and pass parameters, e.g.:

linux /vmlinuz-3.13.0-52-generic root=/dev/sda2 rw
initrd /initrd.img-3.13.0-52-generic

Finally, boot:

boot

So I need to fix 2 things:

  1. Make symlinks in the boot partition
  2. Tell Libreboot’s GRUB to pass the correct root partition to the kernel

Let’s create symlinks /boot/libreboot-vmlinuz and /boot/libreboot-initrd.img. First the manual method, and then we’ll make them be updated automatically. The commands (in Bash) for making them by hand are:

# cd /boot
# ln -s $(basename $(readlink /vmlinuz)) libreboot-vmlinuz
# ln -s $(basename $(readlink /initrd.img)) libreboot-initrd.img

This can be automated by creating a script under /etc/kernel/postinst.d. For example:

#!/bin/bash

# Update kernel symlinks for use by libreboot's GRUB

cd /boot
mv -f libreboot-vmlinuz    libreboot-vmlinuz.old
mv -f libreboot-initrd.ing libreboot-initrd.img.old
ln -s $(basename $(readlink /vmlinuz)) libreboot-vmlinuz
ln -s $(basename $(readlink /initrd.img)) libreboot-initrd.img

The script will run after each kernel package installation.

Now let’s update the GRUB config.

Libreboot has a document explaining how to modify the GRUB configuration [[here|http://libreboot.org/docs/gnulinux/grub_cbfs.html]]. Download a [[libreboot release archive|http://libreboot.org/download/#http]] corresponding to your libreboot version, extract it and use the tools as explained in that link, to extract the libreboot ROM and then extract the GRUB config from it. Place it under /grub/libreboot_grub.cfg.

The modifications needed (for the first menu entry) are:

Hopefully, done! Reboot and make sure it successfully boots the OS using the first menu entry in GRUB.

[See repo JSON]