EFI boot from card reader

"Please leave a message at the beep, we will get back to you when your support contract expires."

Moderators: phlip, Moderators General, Prelates

User avatar
Flumble
Yes Man
Posts: 2182
Joined: Sun Aug 05, 2012 9:35 pm UTC

EFI boot from card reader

Postby Flumble » Thu Mar 28, 2019 3:52 am UTC

I want to try out an arch install on my laplet/tabletop/convertible without touching the windows install that works well. And the perfect way to do that seems to be to use the SD card slot on the side of the screen (rather than, say, a thumbdrive because they're bulky and it disconnects if you detach the keyboard).

It boots fine from disk (windows) and from a thumbdrive (arch live image) in the keyboard, but I can't seem to boot from a micro-SD card (arch installed with the thumbdrive). I have the gut feeling that the EFI shell simply doesn't know what the card reader is because map only lists:
  • FS0 (/PciRoot(0x0)/Pci(0x14)/USB(0x3)/USB(0x2)/HD(1,MBR)),
  • FS1 (/PciRoot(0x0)/Pci(0x17)/Ctrl(0x0)/HD(1,GPT)),
  • BLK0 (/PciRoot(0x0)/Pci(0x14)/USB(0x3)/USB(0x2)),
  • BLK2 (/PciRoot(0x0)/Pci(0x17)/Ctrl(0x0)),
  • BLK4 (/PciRoot0/Pci17/Ctrl0/HD2),
  • BLK5 (..HD3) and
  • BLK6 (..HD4).
On the other hand, devtree does list a Ctrl[FD] SD Host Controller.

The internal disk has a GPT layout with a fat32 ESP, the thumbdrive has an MBR layout with a... iso9960 type 0 boot partition (maybe I should've formatted the thumbdrive as GPT before writing the live image; anyway, it works) and the sd card has a GPT layout with a fat32 ESP.
Also, with the thumbdrive live image lshw reports the thumbdrive at usb@1:3.2 and the sd card at usb@1:4.1.
Changing the windows ESP might be an option. (I'd rather not, but if there's some bootloader required to figure out where the SD card is and call the initramfs, so be it.)

Can I make the computer boot from an SD card? (And, if so, how?) (And, if not, could I successfully dd the whole internal disk, install arch on it and put the disk copy back later without side effects?)

Possible complications: in all my wisdom I made the root partition on the sd card an encrypted volume. And so far the boot partition does not have an EFI folder, but only initramfses.

Tub
Posts: 446
Joined: Wed Jul 27, 2011 3:13 pm UTC

Re: EFI boot from card reader

Postby Tub » Thu Mar 28, 2019 8:31 pm UTC

Someone is asking for trouble.

1) you need a bootloader on an EFI partition
2) you need the firmware ("bios") of your computer to recognize that partition
3) you need an initramfs that can mount the root partition.

For the first problem, you can either re-use the existing EFI partition from your windows installation, or you can add an EFI partition onto your SD card (but then you'll probably have to manually select the SD card as your boot device each boot).
In either case, you must add a bootloader (systemd-boot) onto that EFI partition. Your last paragraph sound like you didn't do that.

For the second problem, once you have a bootable EFI partition on the SD card, and you have disabled secure boot, hit whatever hotkey allows you to select the boot medium (F8?) and see if the SD card shows up. If it doesn't, there's not much you can do except to use the existing EFI partition.

The third one is not yet a problem, but it will be. Mounting from an SD card may require additional modules/hooks in mkinitcpio.conf, and unlocking a root partition via password will also require changes.

Knowing how long SD cards last (looking at you, raspberry!), I'd personally use gparted or something to resize the windows partition, then add a linux partition at the end, then install the linux boot loader onto the existing ESP partition. You're correct though that there's no going back if you screw this up; do you have a bootable windows installation disk, a bunch of drivers and backups of all your personal files? Also read and re-read the archwiki articles about bootloaders and dual-booting.

Flumble wrote:(And, if not, could I successfully dd the whole internal disk, install arch on it and put the disk copy back later without side effects?)

efivars are a thing, and they can persistently store things, including boot related configurations. So that's a "maybe" from me. You can probably dump and restore them when booting arch from your thumb drive.


Return to “The Help Desk”

Who is online

Users browsing this forum: No registered users and 2 guests