Menu

Macbook Pro, booting to Ubuntu on BTRFS

2014-12-17
2014-12-26
  • Anand Patil

    Anand Patil - 2014-12-17

    Hi everyone,

    I've created a partition on my Macbook Pro, booted Ubuntu from a USB
    stick using refind 0.8.4, formatted the partition as BTRFS, and
    installed Ubuntu to it using ubiquity.

    I then roughly followed the instructions here:
    http://randomtutor.blogspot.com/2014/01/installing-ubuntu-on-retina-macbook-pro_19.html
    by adding the following lines to /Volumes/ESP/EFI/BOOT/refind.conf :

    fs0: load btrfs_x64.efi
    fs0: map -r

    The other options in that blog post didn't seem necessary:
    btrfs_x64.efi seems to already be on the driver search path, and
    'scanfor internal' is already the default behavior.

    I then followed the instructions here:
    http://www.rodsbooks.com/refind/drivers.html for btrfs. I added

    also_scan_dirs @/boot

    to refind.conf. I then generated
    /Volumes/ESP/EFI/BOOT/refind_linux.conf, corrected the device path (my
    btrfs partition is /dev/disk0s4), and added the rootflags option from
    the above link, so refind_linux.conf looks like this:

    "Boot with standard options" "ro root=/dev/disk0s4 rootflags=subvol=@"

    "Boot to single-user mode" "ro root=/dev/disk0s4
    rootflags=subvol=@ single"

    "Boot with minimal options" "ro root=/dev/disk0s4 rootflags=subvol=@"

    I didn't make any other changes to the configuration.

    Ubuntu shows up in the boot menu,
    saying 'Boot @\boot\vmlinuz-3.13.0-32-generic from Ubuntu'. When I
    select it, I briefly see a screen that says

    rEFInd - Booting OS
    Starting vmlinuz-3.13.0-32-generic
    Using load options "initrd-@\boot\initd.img-3.13.0-32-generic

    followed by some log messages, and finally I see a message that says

    BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)

    and am dropped at a shell with prompt (intramfs). If I push ctrl-d, I
    get a message saying "can't open /root/dev/console: no such file" and
    a kernel panic.

    Most of the advice on the internet for this error seems to say that
    the volume is corrupted, but I ran 'btrfs check' on /dev/sda4 and it
    seemed to be fine. I also booted from a USB stick, mounted /dev/sda4,
    and verified that @/boot/vmlinuz-3.13.0-32-generic exists.

    I feel like I'm almost there, any help would be much appreciated.

    Thanks,
    Anand Patil

     
  • Roderick W. Smith

    /dev/disk0s4 is an OS X partition specifier, not a Linux one. Chances are this corresponds to /dev/sda4, although if you've got multiple disks, it's possible that OS X and Linux would number them differently, so it could be something else. It's generally safer to specify a volume by UUID or label because these are usually invariant, although using a device file is perfectly OK for short-term use or if you're careful to adjust them if you repartition in a way that changes the partition number.

     
    • Anand Patil

      Anand Patil - 2014-12-18

      Hi Roderick, thanks for the response. I did test the partition numbers when booting from a live cd, and they were the same, so hopefully this will fix it. I'll test as soon as I get back to the macbook.

       
  • Anand Patil

    Anand Patil - 2014-12-19

    Hi Roderick,

    I replaced /dev/disk0s4 with /dev/sda4, then tried the uuid of the volume (obtained by running blkid from the intramfs shell) and also the uuid_sub of the volume, but no dice.

    I also noticed that, when I added options such as 'quiet' and 'splash', as you did here: http://www.rodsbooks.com/refind/linux.html , I didn't notice any difference in the output. That makes me wonder whether I'm making refind_linux.conf available to rEFInd correctly. I currently have it in the same folder as refind.conf, which is /Volumes/ESP/EFI/BOOT.

    Thanks again,
    Anand

     
  • Anand Patil

    Anand Patil - 2014-12-19

    Hey hey! Got it working. I had to put my refind_linux.conf in @/boot in the actual btrfs volume, not where I had it. To do that, I had to boot Ubuntu from a usb stick, mount the btrfs volume, and create the text file in there. How awesome is this!

    In case anyone gets here from Google, the steps were, with @ being the root subvolume:

    • Add to /Volumes/ESP/EFI/BOOT/refind.conf

    fs0: load btrfs_x64.efi
    fs0: map -r
    also_scan_dirs @/boot

    • Boot Ubuntu from a USB stick, mount the btrfs volume, and write the following into @/boot/refind_linux.conf

    "Boot with standard options" "ro root=/dev/sda4 rootflags=subvol=@"
    "Boot to single-user mode" "ro root=/dev/sda4
    rootflags=subvol=@ single"
    "Boot with minimal options" "ro root=/dev/sda4 rootflags=subvol=@"

    As Roderick said earlier, I should replace the /dev/sda4's with uuid's, but note that the mac and ubuntu uuid's are different.

    Thanks for your help!
    Anand

     
  • Roderick W. Smith

    The following two lines do nothing in refind.conf:

    fs0: load btrfs_x64.efi
    fs0: map -r
    

    Those are EFI shell commands (and prompts), which rEFInd can't parse.

    Most partitions have one UUID and one GUID (called a "PARTUUID" in some Linux utilities). The UUID is a filesystem-level ID, which is embedded in the filesystem itself. The GUID is part of the partition table, and identifies the partition. (There's also a partition type code GUID.) Chances are you're thinking that the UUID is Linux-specific and the GUID is Mac-specific, but that's not the case; it's just that some tools will show the UUID and others show the GUID.

    The /boot/refind_linux.conf file is Linux-specific, so you should use Linux device identifiers and conventions in it. Most distributions use filesystem UUIDs to identify devices, as in UUID=9b6f62b3-dab2-4abc-987e-32d769a01068. You could instead use a partition's GUID by using the PARTUUID= syntax. I don't know how that would work with a Btrfs volume, though. If you want to experiment with this, you can create new entries in /boot/refind_linux.conf -- duplicate existing ones, modify them, and then select them when you reboot by hitting F2 or Insert and picking your modified entry from the list.

     

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.