You are not logged in.

#1 2013-08-08 22:19:41

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

[SOLVED] Installation on UEFI from usb stick

Greetings,
I'm trying to figure out this uefi thing and install arch on my laptop.
I swear, I've been trying so many times now that I have a headache. My girlfriend too because of all my ranting.

I downloaded the latest arch iso and "burned" it to a usb stick (my laptop lack a cdrom).
I booted with the first option and went through the whole installation progress to the grub installing part MANY times before realizing I was doing it all wrong and I had to start from a UEFI shell.
Now I started from the UEFI shell and I just have no idea what I'm doing, the beginner guide doesn't seem to explain this.
I should probably wait until my headache pass and I'm fresh and ready to start over but I'm one stubborn guyif there is one and I had enough of failing, I want it to work.

What do I do from the UEFI shell?
Do I have to reinstall everything from scratch, partitioning and all or I can just get back to the part where I have to install grub? What do I do?
Thanks in advance and sorry if I'm asking stupid questions or something but, honestly, I failed so many times that my frustration is seriously high.

Last edited by arkindal (2013-08-13 23:13:11)

Offline

#2 2013-08-08 22:38:52

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

Re: [SOLVED] Installation on UEFI from usb stick

When I learned how to use UEFI, I first started with a bios based installation.  When I installed I just made sure to also create an EFI System Partition so that I could get it working.  Besides the existence of the ESP, there is no difference in the structure of the filesystem or what is in it.  So there is no need to repartition or reinstall as long as you have that ESP.

UEFI and bios booting methods can coexist on a disk.  The legacy bios mode lives in the MBR, which is sector 0 (or more precisely, all but the last 66 bytes of the first 512 byte sector).  UEFI on the other hand, uses the ESP to hold its boot code.  So there is no overlap of these two things. 

Partition type (ie. ms-dos/MBR or GPT) will only matter if you are using windows, as the type of partitioning is how windows determines wheter to use UEFI or legacy bios.  Oh, and Macs will only boot with bios compatibility mode if there is a ms-dos partition table with more than just a protective entry. 

You say that you "burned" the archiso to the USB.  What does this mean?  The archiso image is not set up to boot from either/or when copied to a USB.  From an optical disk, it will work either way, but for a USB, the procedure is different.  It basically just requires a partition large enough to hold the contents of the archiso, formatted the FAT32 (or FAT16), and labelled with whatever is specified by the file in /boot/loader/entries/archiso.conf (<-not sure if that is really the file name, but there are only three in there and the other two are for the UEFI shells v1 and v2).  Then you need to simply copy all the contents of the archiso to the USB.  See the UEFI wiki page, towards the bottom, for more info.

What I have given you is really just general basics about UEFI, but as to your specific problem, I don't think as it is now, anyone can really help you with it.  You have basically only said that you are trying to install with UEFI, but are confused and frusturated, and you're doing it wrong.  So without more specifics.... anyone who ventures here is at a bit of a loss.

Offline

#3 2013-08-08 22:53:51

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

I'm sorry WonderWoofy, I just let my emotions take control a bit there and I was unable to think straight, I'll try to give more informations now.
I "burned" the iso to a usb stick using a program on windows (EW!) called rufus, it's kinda like unetbootin I guess.
I followed the procedure as usual when I installed on bios with the only difference that I created a fat32 partition and flagged it as bootable.
I attach two pictures I took here:

https://dl.dropboxusercontent.com/u/557 … .43.06.jpg this is the list of options I get at boot, I used the first one and, once I got to the install grub part, I got the following error:

Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.

It also suggest to run  "modprobe efivars" as root, which I did and didn't work, no output is given but still grub won't install with the command suggested in the wiki: grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug


I googled and found this: https://bbs.archlinux.org/viewtopic.php?id=148184

That's where I got the idea to boot it from UEFI shell, from the list in the picture posted above I picked the second option and I am in front of this shell:
https://dl.dropboxusercontent.com/u/557 … .43.33.jpg

Here I'm just lost.

I hope the informations I just posted are enough to make you understand what I should do next, again, thanks for your time and sorry for the awful post I started this thread with, I feel kinda silly about it now.

Offline

#4 2013-08-08 23:15:18

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

Re: [SOLVED] Installation on UEFI from usb stick

UEFI has kind of a chicken/egg scenario in order to get things going.  You want to boot with UEFI, but in order to create the UEFI entries into the firmware (with efibootmgr) you first have to be booted with UEFI.  Only when you are booted with UEFI will you be able to properly load the efivars module and have the proper /sys directory get populated.

You need to make the USB stick according to how it tells you on the UEFI arch wiki page.  I tried to explain this in my last post.

If you want to get around all this, and just get some UEFI booting going without making any nvram/firmware entries, you can use another way.  Most firmwares will allow for a "default" spot on the ESP.  Whatever you put as \EFI\BOOT\BOOTX64.EFI will be booted if you select the disk to boot from with the machine set to boot via UEFI.  This is actually for removable disks, so that it can boot something that is obviously not going to hvae its own firmware entry.

You can make firmware entries using the UEFI shell with bcfg, but i have never had to do this.  You could also try booting grub from the UEFI shell as well.  Just navigate to \EFI\arch_grub (or whereve you installed it) and then just run the grub.efi (or whatever it is called).  Assuming your grub is configued right, you should see the grub screen.

To me, grub is far too complex for its own good.  You never know if it is actually configured right until you either try it, or you know what the heck it s massive, generated config file means.  It might be good to try to get things going by using the efistub and a boot manager instead.  There are currently two boot managers avaiable, both of which are pretty easy to set up.  There is rEFInd and there is gummiboot.  I have both installed, but I use gummiboot as my "daily driver".  I find gummiboot even easier to set up than rEFInd, though rEFInd is not terribly complex either.

Have you read all the wiki pages about UEFI and UEFI bootloaders?  They *should* be enough to get you going or at least get you far enough to run into some really specific questions.  I am not quite sure who is more lost... you with the installation, or me with what you are actually asking.

Offline

#5 2013-08-08 23:28:39

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

What's following might be stupid but...
I burned the same usb stick with ubuntu as a test, it managed to run and install the OS just fine, the OS worked perfectly.
Why can't I install GRUB from the arch iso? What's the difference?

To answer your question I've read a bit on the wiki about UEFI and a bit on other websites but I guess I'll read more if I can't figure out how to install it.

Offline

#6 2013-08-08 23:51:49

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

Re: [SOLVED] Installation on UEFI from usb stick

You can install grub from teh archiso... kind of.  You ahve to do it from a chroot.  So really you are installing it from the installed system.  Other UEFI bootloaders and boot managers simply provide an efi application that yuo can copy to the righ place and create an efibootmgr entry for.  I think that grub actually generates the grub.efi when you run the grub-install command... though I am not sure since I don't actually use grub.

Offline

#7 2013-08-08 23:57:28

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

WonderWoofy wrote:

You can install grub from teh archiso... kind of.  You ahve to do it from a chroot.  So really you are installing it from the installed system.  Other UEFI bootloaders and boot managers simply provide an efi application that yuo can copy to the righ place and create an efibootmgr entry for.  I think that grub actually generates the grub.efi when you run the grub-install command... though I am not sure since I don't actually use grub.

That is exactly what I am doing.

The beginner's guide on the wiki at some point makes you chroot and start installing stuff
https://wiki.archlinux.org/index.php/Beginners'_Guide#Chroot_and_configure_the_base_system

From that point if you keep going you get to this point:
https://wiki.archlinux.org/index.php/Beginners'_Guide#For_UEFI_motherboards

and that's what I'm trying, as I enter the command:
grub-install --efi-directory=/boot --bootloader-id=arch_grub --recheck

I get the error I mentioned previously:
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.

That as I said suggest me to run: modprobe efivars

Which, ironically, you suggested to the guy on the other thread too (as I just noticed ^^)
but that sadly doesn't help, I still get the same error.

Offline

#8 2013-08-09 00:09:09

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [SOLVED] Installation on UEFI from usb stick

Hi,

this is basically what I followed and it worked for me:

make an archlinux uefi usb stick (it's a bit different than a normal one). Use a live ubuntu cd or something, so you don't have to use windows:

#format  your usb key on /dev/sdXY to fat32 (replace XY with the right device, in the following code too)
sudo su
wget http://mirror.us.leaseweb.net/archlinux/iso/2013.08.01/archlinux-2013.08.01-dual.iso
mkdir -p /mnt/{usb,iso}
mount -o loop archlinux-2013.08.01-dual.iso /mnt/iso
awk 'BEGIN {FS="="} /archisolabel/ {print $3}' /mnt/iso/loader/entries/archiso-x86_64.conf | xargs mkfs.vfat -F32 /dev/sdXY -n
mount /dev/sdXY /mnt/usb
cp -a /mnt/iso/* /mnt/usb
sync
umount /mnt/{usb,iso}

full instructions here: https://wiki.archlinux.org/index.php/Un … B_from_ISO

now you have the instalation usb ready.

When I did this, i could still go to choose my boot device and i had a normal usb key boot option and an uefi shell usb key option, see if you have something like that to be sure you have the uefi boot. you should see an uefi shell and it should boot automatically as a normal archlinux live usb. if it doesn not (happend to me before) run ./start.sh or something like that (it should say in the uefi shell what to run). If that doesn not work, then the uefi usb key didn't work.


okay if you've successfully booted the uefi usb you have to format your drive so it has the uefi boot partition mounted inside the grup folder, so there has to be a ef00 partition on the begining

This is my actuall install script, it will wipe your drive, make 5 partitions (uefi boot, boot, swap, root, home) and then mount them, install arch and then chroot into that

modprobe efivars

#configure this as you wish 
SWAPSIZE=4G
ROOTSIZE=50G
DRIVE=sda

#these two lines are horrible, you could manually use gdist and format the drive as you wish, as this will just wipe it clean and make the partion table that I have.
dd if=/dev/zero of=/dev/$DRIVE bs=1M count=1k
echo "2\no\ny\nn\n\n\n+100M\nef00\nn\n\n\n+100M\n\nn\n\n\n+${SWAPSIZE}\n8200\nn\n\n\n+${ROOTSIZE}\n\nn\n\n\n\n\np\nw\ny\n" | gdisk /dev/$DRIVE

mkfs.vfat -F 32 /dev/${DRIVE}1
mkfs.ext2 -L boot /dev/${DRIVE}2
mkswap    -L swap /dev/${DRIVE}3
mkfs.ext4 -L root /dev/${DRIVE}4
mkfs.ext4 -L home /dev/${DRIVE}5

swapon /dev/${DRIVE}3
mount /dev/${DRIVE}4 /mnt
mkdir /mnt/home 
mount /dev/${DRIVE}5 /mnt/home
mkdir /mnt/boot
mount  /dev/${DRIVE}2 /mnt/boot

#this is the magic uefi part for grub
mkdir /mnt/boot/efi
mount /dev/${DRIVE}1 /mnt/boot/efi


pacstrap /mnt base base-devel zsh

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


arch-chroot /mnt

After doing that, you have can install the system as you wish and for the grub I do this:
I had problems a few times if i copy pasted all these lines at once, so now i copy paste them one at a time, (I know it should not make a difference but still, sometimes it didn't work)

# i do this in chmod too, though I'm not sure if it's really necessary
modprobe efivars 

mkinitcpio -p linux

echo "installing efi grup thingy"
pacman -S --noconfirm efibootmgr grub-efi-x86_64
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug

mkdir -p /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
grub-mkconfig -o /boot/grub/grub.cfg

and this is all i have in my install script file and uefi works fine.  I hope you'll get it running soon

Last edited by zidarsk8 (2013-08-09 00:25:20)

Offline

#9 2013-08-09 00:23:47

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

Hi, thanks for your time, I really appreciate it.
Where you, and the wiki also, say:
mkdir -p /mnt/{usb,iso}

What should I exactly type instead of "{usb,iso}" ? Or should I enter that command twice, first with "usb" and then with "iso"?

Offline

#10 2013-08-09 00:28:53

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

Re: [SOLVED] Installation on UEFI from usb stick

arkindal wrote:

Or should I enter that command twice, first with "usb" and then with "iso"?

This. Its a bash brace expansion that equates to /mnt/usb /mnt/iso...

You can also type it in and let the shell do the work, of course smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2013-08-09 00:30:57

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [SOLVED] Installation on UEFI from usb stick

you can just copy paste this command as it is

mkdir -p /mnt/{usb,iso} 

actually becomes

mkdir -p /mnt/usb /mnt/iso #it makes both directories

usefull for renaming things too such as

mv something{from,to}

renames "somthingfrom" to "somethingto"

Offline

#12 2013-08-09 00:32:15

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

Alright, thanks everyone, I'll get to it right away and I'll let you know how it goes so that I can put a [SOLVED] flag on the thread title (hopefully).
Thanks for your support.
I just hope creating the usb stick from command line will be more efficient than using a program for it.

Offline

#13 2013-08-09 00:33:31

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

Re: [SOLVED] Installation on UEFI from usb stick

zidarsk8 wrote:

make an archlinux uefi usb stick (it's a bit different than a normal one).

@arkindal, have yuo actually done this ^^^?  I have been trying to tell you that you need to do this in order to create an efibootmgr entry... but I still am not entirely sure if you have done this or not.

Offline

#14 2013-08-09 00:40:23

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [SOLVED] Installation on UEFI from usb stick

WonderWoofy wrote:
zidarsk8 wrote:

make an archlinux uefi usb stick (it's a bit different than a normal one).

@arkindal, have yuo actually done this ^^^?  I have been trying to tell you that you need to do this in order to create an efibootmgr entry... but I still am not entirely sure if you have done this or not.

he might have tried, but got it wrong. That's why i posted the exact lines I used. I don't know why (I might be slow or something) but it took me many tries to actually be able to boot an uefi archlinux usb.

Offline

#15 2013-08-09 00:45:54

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

Re: [SOLVED] Installation on UEFI from usb stick

It was all very confusing at first for sure.  There was just so much info to take in all at once, but now that I have a grasp of it, UEFI really is quite simple.  It is just nothing like the old MBR system, and I think that is what was so difficult to wrap my head around.

The wiki these days should have copy/paste'able commands with which to create a UEFI archiso though...

Offline

#16 2013-08-09 01:05:41

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

A little update:
So, I made the usb following your instructions and it boot (the previous one booted also).
I tried to save the work I did previously but as I expected it didn't work, I will try tomorrow to install everything from scratch, formatting the hard drive and repartitioning with the commands suggested by zidarsk8
I'll get some rest now, because I've been working on this since before dinner and it's 3 am now... Wow I've been failing this for more than 6 hours... I'm really bad... Gosh.
Thanks for your support, I'll let you know how it goes.

Offline

#17 2013-08-09 01:09:55

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [SOLVED] Installation on UEFI from usb stick

hehe ... took me A LOT longer than 6 hours to get it right, but hopefully we'll help you get there faster. keep us updated smile

Offline

#18 2013-08-09 01:15:00

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

Disregard what I said, just double checked as suggested here by zidarsk8:

"When I did this, i could still go to choose my boot device and i had a normal usb key boot option and an uefi shell usb key option, see if you have something like that to be sure you have the uefi boot. you should see an uefi shell and it should boot automatically as a normal archlinux live usb. if it doesn not (happend to me before) run ./start.sh or something like that (it should say in the uefi shell what to run). If that doesn not work, then the uefi usb key didn't work."

Didn't start the arch iso normally.
What I fail to understand is, why does ubuntu works just fine (installation and everything) when I make the usb with that rufus program thingy and it doesn't with arch?

EDIT: Worked on debian too, I actually wouldn't mind using debian but on that after installation I got a different issue.

Last edited by arkindal (2013-08-09 01:18:12)

Offline

#19 2013-08-09 01:20:26

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [SOLVED] Installation on UEFI from usb stick

sorry, I can't help you there since I don't know the rufus thingy. But there is an archboot iso, that has the uefi enabled by default and runs as an ubuntu live usb (uefi if it can otherwise normal bios boot)

you can get it here: http://mirror.rol.ru/archlinux/iso/archboot/2013.03/

but I did have some problems with this too, that's whay I did it the way I suggested it to you. But just for fun, you can try this too to see if it works.
Also someone should add to the Wiki how to check if you really booted in uefi mode, htere is a way to print efivars but i forgot how (or where they are).

....

arkindal wrote:

...EDIT: Worked on debian too, I actually wouldn't mind using debian but on that after installation I got a different issue.

Same here. tongue

Last edited by zidarsk8 (2013-08-09 01:21:19)

Offline

#20 2013-08-09 01:23:02

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

Well I'll watch a movie with my girlfriend to relax a bit (my brain is boiling) and I'll try that download you provided, and I'll let you know.
Thanks man, you're really nice.

Offline

#21 2013-08-09 01:50:45

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [SOLVED] Installation on UEFI from usb stick

just found it, ... if you've booted into uefi mode, and modprobed efivars  then you should see something with this

ls /sys/firmware/efi/efivars 

if you see stuff there then the rest of instalation should work, if you don't see stuff there, I have no idea (it might work or not).

Offline

#22 2013-08-09 02:06:10

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

Re: [SOLVED] Installation on UEFI from usb stick

If you have a UEFI bootable Ubuntu USB, you could if you preferred, boot into Ubuntu and then chroot into Arch and install grub. I don't think this is the easiest way to do it but it used to be the only way. Basically, you get a command line in Ubuntu and then:

Mount your Arch / partition to /mnt/arch.

Mount the temporary filesystems:

cd /mnt/arch
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
mount -t devpts pts dev/pts/

Mount other parts of your filesystem (e.g. /boot, /var, /usr...) that reside on separate partitions but which you need access to. For example:

mount /dev/<device-or-partition-name> boot/
mount /dev/<device-or-partition-name> boot/efi

It's possible to mount filesystems after you've chrooted, but it's more convenient to do so beforehand. The reasoning for this is you'll have to unmount the temporary filesystems after you exit a chroot so this lets you umount all the filesystems in a single command. This also allows a safer shutdown. Because the external Linux environment knows all mounted partitions it can safely unmount them during shutdown.

Now get the EFI variable stuff set up:

modprobe dm-mod
modprobe efivars

Now chroot to your installed device or partition:

chroot . /bin/bash

Then run grub-install as required.


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

#23 2013-08-09 02:24:10

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

God why didn't I think about it... I really am a slowpoke.
So I copu the commands in the first block as they are, the second block too since I only have a fat32 and an ext4 again as it is right?

Offline

#24 2013-08-09 08:31:42

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [SOLVED] Installation on UEFI from usb stick

if that's dirrected at me, then yes you can copy and paste each block, one line at a time (except in the create usb where XY have to be raplaced), the fist block is creating the usb, second block is in the live usb shell, the third block is in the chroot enviroment (here is where you install the rest of the system too)

Offline

#25 2013-08-09 11:32:34

arkindal
Member
From: 127.0.0.1
Registered: 2009-09-01
Posts: 37

Re: [SOLVED] Installation on UEFI from usb stick

It was directed at cfr, where he say

cfr wrote:

Mount other parts of your filesystem (e.g. /boot, /var, /usr...) that reside on separate partitions but which you need access to. For example:

mount /dev/<device-or-partition-name> boot/
mount /dev/<device-or-partition-name> boot/efi

I don't get it, I have two partition, the fat32 partition and an ext4 partition since I don't use a swap and a separated home partition, so what should I do?

mount /dev/fat32partition boot/efi
mount/devext4partition /boot

or something different?

Offline

Board footer

Powered by FluxBB