You are not logged in.

#1 2012-12-30 11:55:10

stefo
Member
Registered: 2012-12-01
Posts: 44

[SOLVED] arch with efi stub

Hi, i'm relatively new to the arch world and i am trying to install arch with efi stub. I want to ask, is there anyway to install arch and efi stub booting right away. Because i followed the guide for setting up efi stub and i saw that the guide applies to already installed arch, which i assume means that i need to have other bootloader like grub for e.g. to boot in my arch and then setup the new booting method. I want to make clean installation of arch and along the way install efi stub (efibootmgr) to boot directly in my arch without previously booting a bootloader like grub. My mobo is UEFI capable and i want to use arch with GPT and efi stub, nothing more smile. Anyway i'm experimenting on virutalbox before i try this on my machine because i want to train my self in doing this type of installation. I would be thankful if you provide me with any tips and links so i can learn this matter a bit better, thanks and cheers!

Last edited by stefo (2012-12-31 00:28:46)

Offline

#2 2012-12-30 19:13:20

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] arch with efi stub

That is how I did it; it was just a case of partitioning the drive, chrooting for the install and then installing efibootmgr and, in my case, gummiboot and then creating the entries and copying the relevant files to the correct location. I read the wiki pages and it went pretty smoothly.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2012-12-30 19:16:58

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

Re: [SOLVED] arch with efi stub

The beginner's guide now basically recommends this as the default installation method for UEFI boot. It recommends rEFInd but you can rely just on efibootmgr entries if you prefer.


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

#4 2012-12-30 20:23:39

stefo
Member
Registered: 2012-12-01
Posts: 44

Re: [SOLVED] arch with efi stub

I followed the guide, i tried with refind and also i tried adding entry directly in the efibootmgr to invoke the kernel (not installing any bootloader like refind). In both cases, when i reboot, my virtual-machine goes in EFI shell (v 2.10).. It seems to me that the kernel is not being invoked, hmm? What can be the cause for this?

Offline

#5 2012-12-30 20:39:12

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

Re: [SOLVED] arch with efi stub

Hard to say with the little information you've provided.


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

#6 2012-12-30 20:54:18

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] arch with efi stub

There have been a lot of really really horrible questions around here lately.  There is the saying that there are no stupid questions, but this is not true.  Seeking information is repsectable, but a poorly phrased question can certainly make it "bad".  Please see cfr's signature and click on the first link of the two (and read the linked article of course).

If you wnat help, you are probably going to have to do better.  More than that, if you don't want to be berated by the other members around here, you need to do better.

Offline

#7 2012-12-30 21:18:13

stefo
Member
Registered: 2012-12-01
Posts: 44

Re: [SOLVED] arch with efi stub

Ok, sorry for not providing what i did, here it is:

First i downloaded latest arch release. I create new virtual machine (arch x64 type, 8GB dynamically alocated) in virtualbox. In the settings for the machine i enabled EFI, added the iso in the virtual cd-rom and fired the machine. I picked the first entry in the arch startup menu (arch x86_64).

1. I ran this

gdisk /dev/sda

Then inputed "o" to create new GPT scheme. After that i created new 512MB ef00 partition (EFI System) as the first partition of the 8GB virtual HDD. And the second one 7.5GB as type 8300 (Linux filesystem) (i didn't created LVM since i don't think ill need it, i dont need the additional layer because i dont resize or do similar staff to my partitions, i just keep em fixed). So i had 2 partitions, one 512MB of type ef00, and the second one 7.5GB of type 8300.

2. I formated the partitions running this:

mkfs.vfat -F32 /dev/sda1     and mkfs.ext4 /dev/sda2

It went smoothly..

So far i my disk is properly partitioned and ready for next steps...

3. Mounted the partitions like so:

mount /dev/sda2 /mnt
mkdir /mnt/boot/efi -p
mount /dev/sda1 /mnt/boot/efi

4. I settup mirrors in the /etc/pacman.d/mirrorList and then run:

pacstrap /mnt/ base base-devel

Installation went smoothly...

5. This step is kinda awkward to me and i smell misconfiguration here, so please consider this one a bit carefully...
Next i had to generate the filesystem table, so i get my partitions mounted at startup.. so i generated the fstab as so:

genfstab -U -p /mnt >> /mnt/etc/fstab

In the guide there was warning that the current kernel has an issue with the EFI system partition because of the options set by the fstab generator. I edited the fstab generated by the generator and in the fist entry, the one for sda2 (Linux filesystem partiton) i removed data=ordered because the guide says that this is irrelevant option as it is turned on by default. And in the second entry, the one for sda1 (EFI system partition) i removed everything except "codepage=cp437" which i replaced with "codepage=437". The guide says something about this option being rewritten but i got a bit confused since first it says remove everything except "noatime" which was not present in my fstab, and then says to rewrite the codepage one, removing the cp part???

6. Did arch-chroot /mnt to jump to my new installation and did some locale and similar configurations. Configured pacman to include multilib section and upgraded it using -Syy. Changed root pass and created new user part of the wheel group for sudo previlages.

7. Since i started my installation with efi support i didn't have to reboot my vbox so i continued with the next step, setting up the boot method. First i loaded efivars using the modprobe to load the module efivars. Then i created /boot/efi/EFI/arch folder structure, copied the kernel, images for ram blocks and fallback (vmlinuz, initramfs, initramfs-..-fallback) into /boot/efi/EFI/arch.

8. Installed refind

 pacman -S refind-efi efibootmgr
# mkdir -p /boot/efi/EFI/refind
# cp /usr/lib/refind/refindx64.efi /boot/efi/EFI/refind/refindx64.efi
# cp /usr/lib/refind/config/refind.conf /boot/efi/EFI/refind/refind.conf
# cp -r /usr/share/refind/icons /boot/efi/EFI/refind/icons

Created refind_linux.conf, and inputed the following content in it"

# nano /boot/efi/EFI/arch/refind_linux.conf
------
"Boot to X"          "root=/dev/sda2 ro rootfstype=ext4 systemd.unit=graphical.target"
"Boot to console"    "root=/dev/sda2 ro rootfstype=ext4 systemd.unit=multi-user.target"

9. Added entry to the efi using efibootmgr (sda1 on sda is EFI System, just as reminder):

efibootmgr -c -g -d /dev/sda -p 1 -w -L "rEFInd" -l '\EFI\refind\refindx64.efi'

10. Unmounted and rebooted..

umount /mnt/boot/efi    and  umount /mnt
reboot

And then i boot in EFI Shell 2.10 =/

Thanks for trying to help!

Last edited by stefo (2012-12-30 21:34:37)

Offline

#8 2012-12-30 21:34:28

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

Re: [SOLVED] arch with efi stub

What does ls /boot/efi/EFI/arch give? (Did you remember to add the .efi suffix to the appropriate file?)

I'm not sure what to say about the fstab generation. I've never actually used genfstab but I don't have anything like that in my options for my EFI partition:

UUID=1234-5678  /boot/efi vfat defaults 0 2

Please post fstab so we can see exactly what you've got. I think the auto-generation is sometimes a bit hit-and-miss.

Did you edit refind.conf at all?

Did you install an EFI shell? If so, where? I'm just surprised you've ended up in one. I've actually tried to achieve this but never succeeded!

EDIT: CAVEAT: I don't use virtualbox so if some of what you have is specific to that, ignore my protestations!

Last edited by cfr (2012-12-30 21:35:37)


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

#9 2012-12-30 22:58:46

stefo
Member
Registered: 2012-12-01
Posts: 44

Re: [SOLVED] arch with efi stub

Thanks for the reply, here is what i have:

ls -lh /boot/efi/EFI/arch
-rwxr-xr-x 1 root root 13M Dec 30 20:45 initramfs-arch-fallback.img
-rwxr-xr-x 1 root root 2.7M Dec 30 20:45 initramfs-arch.img
-rwxr-xr-x 1 root root 3.4M Dec 30 20:44 vmlinuz-arch.efi

This is what i have in my fstab:

#/dev/sda2 (this is the 7.5GB Linux filesystem, and the UUID i looked up using blkid /dev/sda2)
UUID=85a611ff-0744-414d-8ab3-32be42e92d1f  /  ext4  rw,realtime 0 1
#/dev/sda1 (this is the 512MB EFI system, UUID lookup using blkid /dev/sda1)
UUID=DB88-894B  /boot/efi  vfat  codepage=437,noatime  0 2

I did not touch refind.conf at all.. in the guide there is no such step...

I did not install efi shell, i guess virtualbox has it by default when you enable efi support inside the settings of a virtual machine.

Cheers!

Last edited by stefo (2012-12-30 23:01:04)

Offline

#10 2012-12-30 23:07:24

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

Re: [SOLVED] arch with efi stub

OK. I'm not sure about that fstab entry but I'm pretty sure it isn't the problem. As far as I know, the EFI partition doesn't need to be mounted at all except for updates. Moreover, the system is clearly not getting to the point of reading fstab.

Can you do this:

modprobe efivars
efibootmgr -v

and post the output?

EDIT: You could also try copying /boot/efi/EFI/arch_refind/refindx64.efi to /boot/efi/EFI/boot/bootx64.efi which might get it booted even if the efibootmgr entry isn't working for some reason.

EDIT 2: I just reread your earlier post. When you updated did you just run pacman -Syy? If so, you need to go back and run pacman -Syu as you will have just updated the database - not the actual installed packages. Since you then went on to install at least the boot loader, you may have mismatched stuff.

EDIT 3: Also, you may need to modprobe efivars before chrooting in order to get the menu entry set up correctly.

Last edited by cfr (2012-12-30 23:16:03)


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

#11 2012-12-30 23:21:47

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: [SOLVED] arch with efi stub

stefo wrote:

I followed the guide, i tried with refind and also i tried adding entry directly in the efibootmgr to invoke the kernel (not installing any bootloader like refind). In both cases, when i reboot, my virtual-machine goes in EFI shell (v 2.10).. It seems to me that the kernel is not being invoked, hmm? What can be the cause for this?

In my experience, VirtualBox can't remember its EFI "NVRAM" entries when they're set via efibootmgr in Linux. You must either name your boot loader EFI/BOOT/bootx64.efi on the ESP or use the bcfg utility in a version 2 shell to get the entry to "stick."

Offline

#12 2012-12-30 23:27:19

stefo
Member
Registered: 2012-12-01
Posts: 44

Re: [SOLVED] arch with efi stub

Hmm, it seems to me that the entry i added with efibootmgr is not remembered after rebooting.. Here is what i have before reboot and after i add the entry in efi..

efibootmgr -v
BootCurrent: 0000
BootOrder: 0005,0000,0001,0002,0003,0004
Boot0000* 0 ACPI(a0341d0,0)PCI(1,1)ATAPI(1,0,0) the default boot entry is 0...
Boot0001* 1 ACPI(a0341d0,0)PCI(d,0)ATAPI(0,0,0)
Boot0002* 0 ACPI(a0341d0,0)PCI(d,0)ATAPI(0,0,0)HD(1,800,100000,a828acb3-3c-0d-4255-92a4-bce260d3c0b0)
Boot0003* 1 ACPI(ao341d0,0)PCI(d,0)ATAPI(0,0,0)HD(2,100800,eff7df,c8bd4a59-72b7-46f6-bd8c-70abd4cbd459)
Boot0004* EFI Internal Shell MM(b,5e255000,5e6a4fff)
Boot0005* rEFInd HD(1,800,100000,a828acb3-3c0d-4255-92a4-bce260d3c0b0)File(\EFI\refind\refindx64.efi)

And after i reboot the 5th entry is gone and the BootOrder is: 0000,0001,0002,0003,0004

One more question along the way.. The efibootmgr is changing the entries in the hardware right? It's just a handle so i can manipulate the efi software that is shipped with the mobo, if i get that right? And, if i plan to install win. single boot i will need to restore back the efi boot order and remove the entry added for arch, or the win installation fixes this?

Last edited by stefo (2012-12-30 23:28:55)

Offline

#13 2012-12-30 23:35:44

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

Re: [SOLVED] arch with efi stub

See the post just above yours - it sounds like the memory issue is a virtualbox one so hopefully this will work OK when you do it for real.

I don't know anything about Windows however generally people seem to have to reset up their boot loaders etc. after installing Windows for dual boot so I'm assuming that it wipes this sort of thing. In any case, it would probably make the Windows boot the new default so even if the other one was still there, it wouldn't affect anything.

In my experience, the problem of keeping the entries is much more serious than the problem of their hanging around. If I reset my BIOS to defaults, for example, all the customised efibootmgr entries are wiped and it is back to factory settings. They are also easy to delete intentionally by hand. The boot order can also be changed in either BIOS or with efibootmgr on my machine.


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

#14 2012-12-30 23:36:28

stefo
Member
Registered: 2012-12-01
Posts: 44

Re: [SOLVED] arch with efi stub

yay! got it workin smile the prob. is that virtualbox can't remember efi entries across reboots... Now i have it up and running by renaming refindx64.efi into bootx64.efi and putting it inside /boot/efi/EFI/boot/
I guess this is not going to be the issue if i try to install on my lap-top diretly? Because i plan to do so and i want to be sure beforehand.

Thanks for your help guys, and sorry for the bad start...

Cheers!

Offline

#15 2012-12-30 23:43:03

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: [SOLVED] arch with efi stub

stefo wrote:

Hmm, it seems to me that the entry i added with efibootmgr is not remembered after rebooting.. Here is what i have before reboot and after i add the entry in efi..

Judging by the time stamps, you were probably writing this just as I was posting my last message. Be sure to go back and read it if you missed it.

One more question along the way.. The efibootmgr is changing the entries in the hardware right? It's just a handle so i can manipulate the efi software that is shipped with the mobo, if i get that right?

Yes, that's right -- although in your case, since you're using VirtualBox, it's just virtual hardware. VirtualBox stores its settings in a file on the disk somewhere rather than in an actual NVRAM chip.

And, if i plan to install win. single boot i will need to restore back the efi boot order and remove the entry added for arch, or the win installation fixes this?

If you remove whatever boot loader files you installed, the firmware will skip over them and move on to the next one. Some implementations also seem to remove such "dead" entries automatically. Either way, you shouldn't need to make any adjustments unless the entry for Windows ends up getting removed from the boot list.

If you don't remove the files for your Linux boot loader, it will continue to launch. If it can chainload to the Windows boot loader and is designed sensibly, this will end up being an extra step in the boot process until you remove the Linux boot loader, but will otherwise do no harm -- Windows will continue to boot. Fedora's EFI-enabled GRUB Legacy, gummiboot, and rEFInd all operate in this way. GRUB 2 can, as well, although some configurations put some of its configuration files on /boot, which means it'll stop working if you remove Linux. (Ubuntu configures its GRUB 2 in this way, which I consider to be a bug.) ELILO and the kernel's EFI stub loader can't chainload and so can't be used as the first boot program in a dual-boot configuration to begin with.

Offline

#16 2012-12-30 23:46:54

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: [SOLVED] arch with efi stub

stefo wrote:

I guess this is not going to be the issue if i try to install on my lap-top diretly? Because i plan to do so and i want to be sure beforehand.

More crossed postings!

Your laptop will probably remember its settings, but that's far from guaranteed. I own four EFI-based computers, three of which can reliably remember their settings. The fourth (a Gigabyte board that uses its "Hybrid EFI" implementation) can remember its settings for a reboot or two, but tends to forget them randomly. I've given up trying with it, and use rEFInd as EFI/BOOT/bootx64.efi on that system.

Offline

#17 2012-12-30 23:48:22

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

Re: [SOLVED] arch with efi stub

Glad you got it working.

As I said above, it shouldn't be an issue when you do it for real - not unless you have really, really buggy firmware. Besides, that would be far too easy - whatever trouble you run into is bound to be of a different kind - that's sod's law! Seriously, I'm sure you'll be fine and there is, in any case, only one way to know for certain...

Just remember to stay calm if you run into difficulties and post enough information for people to understand what you've tried, what you are trying to do and what the issue is. That way if you do come across any problems the wiki and google can't solve, you'll be likely to get effective (and less frustrated) advice from the beginning.

Good luck - let us know how it goes!


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

#18 2012-12-30 23:53:49

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

Re: [SOLVED] arch with efi stub

OK. More cross-postings. So I take back the "really, really buggy firmware". Make that just "buggy firmware". However, sod's law still applies so I'm sure if you have trouble it will be something you are not prepared for wink.

Note that I'm not sure what the current recommendations in the wiki are but when I set up grub 2 following the wiki's recommendations, I also installed some of the files grub needs to work on /boot. So that configuration, too, would be broken if I removed everything but the EFI stuff.

PS Don't forget to mark this solved by editing your first post and prepending the subject line with [solved].

Last edited by cfr (2012-12-30 23:54:52)


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

#19 2012-12-31 01:43:12

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: [SOLVED] arch with efi stub

cfr wrote:

OK. More cross-postings. So I take back the "really, really buggy firmware". Make that just "buggy firmware".

No, Gigabyte's Hybrid EFI qualifies as "really, really buggy." See my Web page on the topic if you want the details. The problem is that such firmware isn't yet really, really uncommon!

Offline

Board footer

Powered by FluxBB