You are not logged in.

#1 2013-07-30 15:37:00

ljwagerfield
Member
Registered: 2013-07-30
Posts: 8

Creating a USB UEFI live media

Hi,

Completely new to Arch/Linux, so sorry if the answer is really obvious!

I have been trying for the last 2 days now to create a UEFI bootable USB media for Arch following the Wiki instructions.

My USB drive is using the GPT partition scheme and is partitioned as follows:
/dev/sdc1 | vfat | EFI system partition
/dev/sdc2 | Microsoft reserved partition
/dev/sdc3 | vfat | Basic data partition ("ARCH_201307")
/dev/sdc4 | exfat | Basic data partition ("Data")

The instructions weren't obvious as to which type of partiton the arch ISO content should be copied to, so I assumed a basic data partition. Now, unsurprisingly, this USB stick won't boot into Arch. I suspect this is because the EFI partition is empty...

1) Should I be copying the ISO content to the EFI partition instead, Or should I install a bootloader to that partition?
2) I have tried using grub-install. Following the instructions, I mounted the efi partition on the USB stick and pointed grub-install at it. However, the install failed saying 'installation impossible, /boot/grub will not be accessible' - which makes sense, but I assumed the install was going copy all dependencies onto the efi partition (not sure why it tries to reference back to the root... which will no longer be there when the system restarts).

Thanks!

Offline

#2 2013-07-30 15:52:02

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,532

Re: Creating a USB UEFI live media

I looking for a system like yours. Mine differs that I've already setup Arch64 and 32 bit version in the USB drive and they boot with MBR grub install.
I would like to expand to UEFI capabilities in order to use for emergency cases where efivars are necessary.
I added the vfat partition and copied the ISO in that partition, but BIOS ignore the presence of such system.
Waiting for some light shed over here smile


do it good first, it will be faster than do it twice the saint wink

Offline

#3 2013-07-31 19:54:54

ljwagerfield
Member
Registered: 2013-07-30
Posts: 8

Re: Creating a USB UEFI live media

Yaaayyy! I did it! Arch you cool mistress... so hard... so tricky (for noobs)... but you keep us coming back for more wink

Here's how to install Arch onto a USB key using a MacBook Pro 6.2:

  1. Create live bootable CD. Download ISO from Arch website and burn. Simple.

  2. Boot into Arch in UEFI mode. Do this by holding Option and selecting ‘EFI Boot’. Gotcha: just holding C will boot into BIOS compatibility mode. This will prevent you from creating boot loaders later on.

  3. Partition the disk using cgdisk. Create the following partitions in this order (the first 3 are important - the remaining space is yours to play with!)

    1. EFI System partition, aka ‘boot’. Default first sector. 512M in size. ef00 type.

    2. Microsoft reserved partition (if you intend to use the stick on Win). Default first sector. 128M in size. 0c01 type.

    3. Arch partition, aka ‘root’. Default first sector. 1.5G in size. Default type. Label as-per the ISO (for me this was ARCH_201307).

    4. Gotcha: If cgdisk fails to write the GPT, use parted to wipe the drive.

  4. Format partitions. Gotcha: EFI must be FAT32 and root must be ext4.

  5. Establish a network connection. Gotcha: if connecting wirelessly with netctl, manually ensure link is set to ‘down’ using ip link set XXX down (it may report as down, but may be in an invalid state that disagrees with netctl when trying to start a profile)

  6. mount /dev/sdX3 /mnt

  7. mkdir /mnt/boot[*/]

  8. mount /dev/sdX1 /mnt/boot

  9. Follow Wiki to install and configure base system. Don’t forget to install WiFi packages if required!

  10. Install ZSH and GIT via pacman.

  11. Install oh-my-zsh using their curl method (nice to have the little luxuries like la - this script also sets zsh as your default shell)

  12. Install the oh-my-zsh archlinux plugin by editing ~/.zshrc and appending archlinux to the plugins list.

  13. Follow instructions for the GRUB bootloader.

    • This modifies your machine, placing the USB drive in firmware’s EFI boot list.

    • However, we want the USB to be portable, running on any machine. To do this, we should firstly remove any hardcoded association from this machine to the USB...

    • efibootmgr -b XXXX -B (where XXXX is the hexcode for the entry created by GRUB - just type the command without any parameters to view all entries).

    • Now rename the GRUB EFI application so it becomes the default EFI application for that device. This is required for the Mac Startup Manager to pick up the device...

    • mv /boot/EFI/arch_grub /boot/EFI/boot

    • mv /boot/EFI/boot/grubx64.efi /boot/EFI/boot/bootx64.efi

Hey-presto! You now have an Arch USB device that shows up in the Mac Startup Manager!!

Last edited by ljwagerfield (2013-08-01 08:53:13)

Offline

#4 2013-08-01 01:38:22

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,156

Re: Creating a USB UEFI live media

Welcome to Arch!

How do you feel about contributing that to the wiki? smile

Last edited by cfr (2013-08-01 01:38:56)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2013-08-01 08:41:58

ljwagerfield
Member
Registered: 2013-07-30
Posts: 8

Re: Creating a USB UEFI live media

Sounds like a great idea.That page appears to be quite general though; this is more:

'Installing Arch Linux on a USB key for MacBook Pro using UEFI'

Offline

#6 2013-08-01 17:20:04

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,532

Re: Creating a USB UEFI live media

A question:
How to keep MBR and UEFI booting the USB?


do it good first, it will be faster than do it twice the saint wink

Offline

#7 2013-08-02 00:19:54

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,156

Re: Creating a USB UEFI live media

ljwagerfield wrote:

Sounds like a great idea.That page appears to be quite general though; this is more:

'Installing Arch Linux on a USB key for MacBook Pro using UEFI'

If you aren't sure where to put it ask on the talk page. Say what you think is best or what the options are (section of this page, part of tips & tricks page for usb installation, new page linked from there). Right now, there doesn't seem to be information about how to do this for UEFI at all and at least some of what you've done is likely relevant for other hardware i.e. it is likely to be more helpful than a page which only deals with bios booting.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#8 2013-08-20 02:28:10

pdizzle
Member
Registered: 2013-02-07
Posts: 15

Re: Creating a USB UEFI live media

thanks man. Had to do the same for my local hard drive, never thought to do it for a usb stick. works like a charm

Offline

#9 2014-01-01 07:32:25

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,532

Re: Creating a USB UEFI live media

I did some experiment and I got to fix my internal hard disk rendered unable to boot.

NOTE All herein descriptions are referring to 64bit architecture. 32bit may start too, but only if the EFI system is sets for 32bit architecture. MBR mode souldn't have this issue (not tested).

  • For MBR booting I disable CSM and entered the Arch64 installation (may be by chroot). Some BIOS is referred as legacy mode

    grub-install --target=i386-pc --recheck --debug --force /dev/sdY

    Assumed Y is the USB device.
    Assumed that all USB partitioning and installation are done, including ESP.

    grub-mkconfig -o /boot/grub/grub.cfg

    This may not boot correct,  because the created grub.cfg has the set root= statement inversed or wrong hard disk pointer, that's means to try it out and see if necessary to modify set root=(hdX) statement
    Also need to verify if the UUID (at the linux line) points to the correct partition on USB. I rather prefer to use to label the partitions, then it won't be hard to remember.

This would be enough for MBR booting. To proceed to EFI booting do reset CSM to Disabled

Note herein $espUSB is the EFI partition on the USB device

As per Archiso method I opted to boot with gummiboot, which I copied EFI directory to $espUSB.

  • # mount $espUSB /boot # this will allow the gummiboot to install correctly
    
    # pacman -S gummiboot
    
    # gummiboot --path /where/boot/is # just in case it wasn't possible to mount directly on /boot

For better understanding of gummiboot see its own wiki

  • Copy initramfs-linux.img  and  vmlinuz-linux to $espUSB. Note that further kernel's updates should repeat to copy the newer files in the $espUSB, unless mounting $spUSB as /boot

  • Configure the correct entry of gummiboot. If it was copied the Archiso's EFI directory, then see the options in $espUSB/loader/entries/archiso-x86_64.conf and modify there

    title   Arch Linux x86_64 UEFI USB
    linux   /vmlinuz-linux
    initrd  /initramfs-linux.img
    options root=................... quiet rw

    Last line must reflect the way one chosen to address the partition (UUD or LABEL). I used label and it comes like root=LABEL=MyUSB_Part

  • Modify $espUSB/loader/loader.conf . I used the Archiso's EFI directory, which I copied, so I just modified the entry content

    timeout 3
    default archiso-x86_64
  • Once able to boot  the USB in EFI mode, would be better to make efibootmgr temporarily unavailable, so it won't write uselessly in the BIOS NVRAM and issue

    grub-install --target=x86_64-efi --efi-directory=$espUSB/EFI --bootloader-id=arch --recheck --debug
  • Do or copy the grub.cfg into $espUSB/EFI/grub/

REMEMBER it may be necessary to modify the grub.cfg as above mentioned

  • Last optional setting it takes to add one more option for gummiboot to list grub in the menu.

     # $espUSB/loader/entries/grub.conf
    title   USB GRUB start
    linux   /EFI/grub/grubx64.efi
  • If one wants to enable grub as a bootloader then just do

    # cp $espUSB/EFI/grub/grubx64.efi $espUSB/EFI/bootx64.efi

    This will overwrite the gummiboot starter and put grub instead

For any misunderstanding, tests, let me know and I will try to add more details

Last edited by TheSaint (2014-01-01 08:10:24)


do it good first, it will be faster than do it twice the saint wink

Offline

#10 2014-01-01 12:37:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: Creating a USB UEFI live media

I believe this is all in the wiki already, isn't it.

I am unclear what your goal was, however.  Did you want to create a persistent installation on a eufi enabled usb, or did you just want a uefi bootable installation media?  What you did was the former - this is no different than a uefi installation on a hard drive.

If you just wanted the uefi iso on a usb, the partitions you listed in your first post are not recommended anywhere in the wiki you linked to.  In fact the page you linked to only has a link to the correct wiki page here.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2014-01-01 19:15:30

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,532

Re: Creating a USB UEFI live media

My intent is to set up an installation on USB media which may include a DE as commonly we're used to. 32 Gib media would give enough room for all whistles and bells of Archlinux.
The most feature is to have the ways to boot with MBR and UEFI mode, like the Archiso. My own setup includes a 32bit installation too, for some maintenance on holder PC, in a necessity  rare case.
My link is referring to gummiboot details only.
Partitioning may go by this wiki  and setting up by this wiki. The USB setup is supposed to have already another installation running and the USB will be used for some troubleshooting.
I added here the explanation about making the media bootable.

Last edited by TheSaint (2014-01-01 19:16:56)


do it good first, it will be faster than do it twice the saint wink

Offline

#12 2014-01-27 04:02:16

kevin24
Member
Registered: 2013-07-20
Posts: 9

Re: Creating a USB UEFI live media

Hi,

Sorry to be a bit dim but I am unsure what the following refers to:-

mount /dev/sdX3 /mnt
mkdir /mnt/boot[*/]
mount /dev/sdX1 /mnt/boot

I have assumed the first is the arch root partition
I have assumed the third is the EFI partition

I do not know what the [*/] refers to in the second

Thanks.

Offline

Board footer

Powered by FluxBB