Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Saint Germain <saintger@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: BTRFS partitioning scheme (was BTRFS with RAID1 cannot boot when removing drive)
Date: Thu, 13 Feb 2014 20:37:47 +0100	[thread overview]
Message-ID: <20140213203747.4e65e708@system> (raw)
In-Reply-To: <15ABD3CE-BF67-42B5-9EF0-BE1823CB54CE@colorremedies.com>

On Thu, 13 Feb 2014 10:43:08 -0700, Chris Murphy
<lists@colorremedies.com> wrote :
> >>> sda3 = 1 TiB root partition (BTRFS), mounted on /
> >>> sda4 = 6 GiB swap partition
> >>> (that way I should be able to be compatible with both CSM or UEFI)
> >>> 
> >>> B) normal Debian installation on sdas, activate the CSM on the
> >>> motherboard and reboot.
> >>> 
> >>> C) apt-get install grub-efi-amd64 and grub-install /dev/sda
> >>> 
> >>> And the problems begin:
> >>> 1) grub-install doesn't give any error but using the --debug I
> >>> can see that it is not using EFI.
> >>> 2) Ok I force with grub-install --target=x86_64-efi
> >>> --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug
> >>> /dev/sda
> >>> 3) This time something is generated in /boot/efi:
> >>> /boot/efi/EFI/grub/grubx64.efi
> >>> 4) Copy the file /boot/efi/EFI/grub/grubx64.efi to
> >>> /boot/efi/EFI/boot/bootx64.efi
> >> 
> >> 
> >>                ^^^^ is EFI/boot/ correct here?
> >> 
> >> If you're lucky then your BIOS will tell what path it will try to
> >> read for the boot code. For me that is /EFI/debian/grubx64.efi.
> >> 
> > 
> > I followed the advices here (first result on Google with "grub uefi
> > debian"): http://tanguy.ortolo.eu/blog/article51/debian-efi
> > 
> >>> 5) Reboot and disable the CSM on the motherboard
> >>> 6) No boot possible, I always go directly to the UEFI-BIOS
> >>> 
> >>> I am currently stuck there. I read a lot of conflicting advises
> >>> which doesn't work:
> >>>   - use "modprobe efivars" and efibootmgr: not possible because I
> >>> have not booted in EFI (chicken-egg problem)
> >> 
> >> 
> >> Not exactly. Boot in EFI mode into your favourite installer rescue
> >> mode, then chroot into the target filesystem and run efibootmgr
> >> there.
> >> 
> > 
> > In the end I managed to do it like this:
> > 1) Make a USB stick with FAT32 partition
> > 2) Install grub on it with:
> > grub-install --target=x86_64-efi --efi-directory=/media/usb0
> > --removable 3) Note on a paper the grub commands to start the
> > kernel in /boot/grub/grub.cfg 3) Reboot, Disable CSM in the
> > motherboard boot utility (BIOS?), Reboot with the USB stick
> > connected 4) Normally it should have started on the USB stick grub
> > command-line 5) Enter the necessary command to start the kernel (if
> > you have some problem with video mode, use "insmod efi_gop")
> > 6) Normally your operating system should start normally
> > 7) Check that efibootmgr is installed and working (normally efivars
> > should be loaded in the modules already)
> > 8) grub-install --efi-directory=/boot/efi --recheck --debug
> > (with the debug info you should see that it is using grub-efi and
> > not grub-pc) 9) efibootmgr -c -d /dev/sda -p 2 -w -L "Debian
> > (GRUB)" -l '\EFI\Debian\grubx64.efi'
> > (replace -p 2 with yout correct ESP partition number)
> > 10) Reboot and enjoy !
> 
> OK at least with GRUB 2.00 I never have to use any options with
> grub-install when installing to a chrooted system. It also even
> writes the proper entry into NVRAM for me, I don't have to use
> efibootmgr.

Yes you are right, this is probably unnecessary (see below).

> 
> Also I've never had single \ work with efibootmgr from shell. I have
> to use \\. Try typing efibootmgr -v to see the actual entry you
> created and whether it has the \ in the path.
> 

Here is the output:
BootCurrent: 0001
Timeout: 1 seconds
BootOrder: 0001,0000
Boot0000* debian        HD(2,7d8,106430,5d012c09-b70d-4225-ae18-9831f997c493)File(\EFI\debian\grubx64.efi)
Boot0001* Debian (GRUB) HD(2,7d8,106430,5d012c09-b70d-4225-ae18-9831f997c493)File(\EFI\Debian\grubx64.efi)

Ah the joy of FAT32 and the case sensitivity !
So it seems that grub-install automatically install the correct entry
 and using efibootmgr was unnecessary.
However it seems that single '\' works.

> But one thing that explains why the UEFI bootloading stuff is
> confusing for you is that every distro keeps their own grub patches.
> So there is very possibly a lot of difference between the downstream
> grub behaviors, and upstream.
> 

Understood. That is why I took the step to describe what I did.
Perhaps it will be useful for others (most info on the topic was
not for Debian...).

Thanks again for your insights !

  reply	other threads:[~2014-02-13 19:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 17:02 BTRFS partitioning scheme (was BTRFS with RAID1 cannot boot when removing drive) Saint Germain
2014-02-11 18:15 ` Chris Murphy
2014-02-11 21:27   ` Duncan
2014-02-12 17:13   ` Saint Germain
2014-02-12 17:50     ` Chris Murphy
2014-02-13  8:50     ` Frank Kingswood
2014-02-13 10:03       ` Saint Germain
2014-02-13 17:43         ` Chris Murphy
2014-02-13 19:37           ` Saint Germain [this message]
2014-02-13 17:33       ` Chris Murphy
2014-02-13 18:02         ` Austin S Hemmelgarn
2014-02-13 18:17           ` Chris Murphy
2014-02-21 11:42           ` Frank Kingswood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140213203747.4e65e708@system \
    --to=saintger@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox