Menu

rEFInd using Linux stub loader & Ubuntu 12.10

2012-12-11
2012-12-11
  • Stefan Agner

    Stefan Agner - 2012-12-11

    Hi,

    Recently I installed rEFInd on my Elitebook 8530w. I'm using Windows 7 and Ubuntu 12.10. The switch from BIOS/MBR boot loader to UEFI was a fight, but in the end everything worked! I copied the linux kernel to the EFI system partition and boot them using rEFInd and a custom refind_linux.conf.

    Now my question: Since kernel updates land in /boot on my root partition (which is ext4 formatted) the boot manager only sees my manually copied kernel. Are there any scripts around to copy the kernel directly to the ESP partition?

    Thanks for ideas,
    Stefan

     
  • Roderick W. Smith

    The cleanest solution, and the one that applies most broadly to most systems, is to begin using your ESP as your /boot partition. This is pretty easy to do (do all of this as root):

    1. Begin with your ESP mounted at /boot/efi.
    2. Check your /boot directory to be sure it contains no links or other files that rely on Unix/Linux-style permissions or ownership. If it does, don't proceed, or at least research these files further to determine if you can work around the need for such permissions and ownership.
    3. Type mv /boot/* /boot/efi. You'll see an error message about being unable to move /boot/efi into itself. Ignore this.
    4. Type umount /boot/efi.
    5. Edit /etc/fstab and change the mount point for /boot/efi to /boot.
    6. Type mount -a to re-mount everything, including /boot. Check that your normal /boot files are all present, along with the new /boot/EFI directory, which holds what used to be /boot/efi/EFI. If something seems to be missing, then you should try to correct the problem.
    7. Copy the refind_linux.conf file you created from /boot/EFI/ubuntu/ (or wherever you placed it) to /boot.
    8. Check your refind.conf file (presumably in /boot/EFI/refind) to be sure that the scan_all_linux_kernels line is uncommented.
    9. Optionally, type cd /boot/EFI/refind/icons/os_ubuntu.icns /boot/.VolumeIcon.icns to give loaders in /boot an Ubuntu icon.
    10. Reboot to test it.

    Set up in this way, your kernels will be dropped into the root of the ESP, where rEFInd will detect them automatically, so no copying is required. The main drawback is that this makes them vulnerable to damage or erasure should some other OS decide to erase the ESP. Thus, making a backup of /boot from time to time makes sense.

    You could do a variant of this with another partition that uses ext2fs, ext3fs, or ReiserFS, and add appropriate EFI drivers for that filesystem. This would require you to create a new partition, though.

    The method you inquired explicitly about is also possible, but the details vary from one distribution to another. Certain Arch Linux users have come up with this procedure, but that's designed for systemd, whereas Ubuntu uses Upstart, so it would have to be adapted. I can't say I've looked into this approach in more detail, since I designed rEFInd explicitly so that it wouldn't be necessary if the system were configured so that the EFI can read Linux's /boot directory -- a goal that's easily achieved with a little forethought or a little more after-the-fact reconfiguration.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.