View previous topic :: View next topic |
Author |
Message |
caph n00b
Joined: 06 Jan 2015 Posts: 4
|
Posted: Tue Jan 06, 2015 12:14 pm Post subject: UEFI boot on X220 |
|
|
I'm in front of a new (well, 2nd hand, but new to me ) ThinkPad X220. I would love to give Gentoo a try after several years of using Debian. So far I'm installed a statge3 system and configured most of the stuff (including a kernel build based on an old .config file from a X220 user). It is a standard hdd in the laptop, if this is relevant.
But what really doesn't work is the bootloader installation. It's been ages since I installed grub by hand and with EFI and UEFI it's not as trivial as it once was. I assume that X220 needs an UEFI bootable grub - at least my BIOS says UEFI booting is enabled.
My partitions look like this:
Code: | /dev/sda1 /boot/efi vfat noauto 0 2
/dev/sda3 / btrfs noatime 0 1
/dev/sda2 none swap sw 0 0 |
All of those partitions are created with the fitting fs and mounted as stated above. Because the wiki entry for Grub2 said so, I also extended my make.conf which results in this so far:
Code: | CFLAGS="-march=native -O3 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
USE="bindist mmx sse sse2 ssl gtk -kde -qt4"
MAKEOPTS="-j4 -l4"
GRUB_PLATFORMS="efi-64"
INPUT_DEVICES="evdev synaptics"
VIDEO_CARDS="intel vesa fbdev"
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages" |
Now I did a emerge grub2 and everything was compiled correctly. I did a make install and make modules_install in the kernel source folder and ran grub2-install /dev/sda --target=x86_64-efi which gave me:
Code: | Installing for x86_64-efi platform.
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
Installation finished. No error reported. |
When I did a modprobe outside of the chroot (on the usbstick) I get modprobe: ERROR: could not insert 'efivars': No such device. Within the chroot the module exists and can be inserted - but I assume this doesn't work although there is no error message when performing modprobe.
Than I thought "Well, maybe this isn't that bad - just try to boot and see what happens" and surprise, surprise...the screen went black and nothing was there to boot from. This was the time when I decided to get some help from you guys
What am I doing wrong and what the heck do I have to do to get this thing to boot correctly?! |
|
Back to top |
|
|
JelteF n00b
Joined: 15 May 2013 Posts: 18
|
|
Back to top |
|
|
caph n00b
Joined: 06 Jan 2015 Posts: 4
|
Posted: Tue Jan 06, 2015 3:35 pm Post subject: |
|
|
There is only /sys/firmware/{acpi,memmap} outside the chroot and as I said modprobe efivars says "no such device" when using the livecd image. This problem seems to be pretty old as an entry in the discussion in the wiki suggests. But even when including efivarfs (which works) doesn't give me any new folder in /sys/firmware....
Just to clarify my request: I would be fine without grub, too. Using an direct boot setup like it is described in the Handbook would also work perfectly here. But sadly the same problem appears when using efibootmgr |
|
Back to top |
|
|
JelteF n00b
Joined: 15 May 2013 Posts: 18
|
Posted: Tue Jan 06, 2015 3:48 pm Post subject: |
|
|
Hmm okay, sounds fair. I don't have much experience with EFI/UEFI, two things that I would try. The first one is use modprobe efivarfs (with an F) as suggested in the wiki. The next would be to use a livecd for a different and easier distro (like mint/ubuntu/debian), since they probably have the needed modules. I have actually always installed gentoo this way (except for the first time). That way you have working WiFi, a terminal that scrolls up and browser that is not command line based, which makes googling and copy pasting a lot easier. |
|
Back to top |
|
|
ct85711 Veteran
Joined: 27 Sep 2005 Posts: 1791
|
Posted: Tue Jan 06, 2015 5:06 pm Post subject: |
|
|
Like Jeltef mentioned, you going need to use another distro's livecd to setup EFI; gentoo's cd's (I don't know if systemrescue cd supports it or not) does NOT support EFI. Sadly, to setup EFI, you need to first boot with a EFI compatible boot cd. Once in EFI mode, modprobe efivars, then you can go ahead and use efibootmgr. |
|
Back to top |
|
|
caph n00b
Joined: 06 Jan 2015 Posts: 4
|
Posted: Thu Jan 08, 2015 4:10 pm Post subject: |
|
|
Actually, efivars now is completely outdated and succeeded by the efivarfs module -- this happened in mid 2013 as far as I read. The efivarfs module loads perfectly under a recent Arch iso for example. The problem is, even with this module loaded and mounted into the chroot, efibootmgr still shows the very same message.
Although ls /sys/firmware/efi/efivars shows that this very folder is populated within the chroot environment. I don't get what the bloody problem is...
I mounted /mnt/gentoo{sys,proc,dev} and even the efivarfs folder within the fitting subfolder via mount -t efivarfs none /mnt/gentoo/sys/firmware/efi/efivars. Than I chrooted into the main folder, did a source /etc/profile (not necessary, but shouldn't hurt either) and called efibootmgr -c -d /dev/sda -p 2 -L "Linux" -l "\efi\boot\bootx64.efi". Still it says
Code: | Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root. |
After 2 days trying to simply get a task done which could easily be automated I'm also kind of frustrated. Do you Gentoo guys really still use legacy booting? Somebody must have faced the very same problems, but unfortunaly there is hardly any recent and reliable information about this topic. Not even the handbook mentions the problem and I assume this thing is known for at least half a year when I look at the UEFI posts within this board
Any suggestions what I can try to get UEFI to work? I'm kind of out of ideas now... |
|
Back to top |
|
|
JelteF n00b
Joined: 15 May 2013 Posts: 18
|
Posted: Thu Jan 08, 2015 4:56 pm Post subject: |
|
|
This sounds like there is something wrong with efibootmgr, as it doesn't seem to use the files that are apparently there. Do you have the most recent version of efibootmgr from portage? Gentoo is sometimes quite slow with marking stuff as stable. The latest stable version is 0.5.4-r1 and the newest version is 0.11.0, so that is quite a difference and I can see on GitHub that the 0.5.4 release was in 2008. You can install it like this:
Code: | emerge =sys-boot/efibootmgr-0.11.0 |
It will probably tell you to add something to /etc/portage/package.accept_keywords. This is necessary as this is where portage reads what packages you want the "unstable" version of.
One of the tools you probably want later on is eix, it gives an easy output of the different versions of packages and which are marked as stable and much more other info.
Good luck with your further Gentoo install, normally the first time is the most frustrating. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jan 08, 2015 6:12 pm Post subject: |
|
|
caph wrote: | Actually, efivars now is completely outdated and succeeded by the efivarfs module -- this happened in mid 2013 as far as I read. The efivarfs module loads perfectly under a recent Arch iso for example. The problem is, even with this module loaded and mounted into the chroot, efibootmgr still shows the very same message. |
caph ... not exactly true, both can be enabled, and support for the former hasn't been dropped. This is because most tools are still using efivars and so removing it would result in broken userland apps. However, the reverse is true as even those apps which have been updated to support efivarfs can have issue if efivars is present (and/or will default to using it above efivarfs) ... as I seem to remember reading current wisdom has it that if your using efivarfs then you should disable efivars (not sure this is the case with the arch iso). So, the issue here is probably as JelteF suggests, a disparity between kernel and userland.
caph wrote: | Code: | Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root. |
|
I'm not sure it will help any (as probably the version of efibootmgr has no clue about efivarfs) but do the mounts show in the chroot? I'd suggest ...
Code: | (chroot) # ln -sf /proc/self/mounts /etc/mtab |
caph wrote: | After 2 days trying to simply get a task done which could easily be automated I'm also kind of frustrated. Do you Gentoo guys really still use legacy booting? Somebody must have faced the very same problems, but unfortunately there is hardly any recent and reliable information about this topic. Not even the handbook mentions the problem and I assume this thing is known for at least half a year when I look at the UEFI posts within this board :( |
Honestly this is the first I've heard of the issue, and I've been booting efi for upwards of three years. Though generally its said that "any boot disk" is suitable for installing gentoo, there are exceptions ... you just might run into a case such as this, the kernel and userland are out of sync.
caph wrote: | Any suggestions what I can try to get UEFI to work? I'm kind of out of ideas now... |
You might try another boot disk ... like sysrescuecd ... as it will probably have efivars as opposed to efivarfs ... or update efibootmgr to 0.11.0 as JelteF suggested.
best ... khay |
|
Back to top |
|
|
CH2IS n00b
Joined: 03 Jul 2014 Posts: 4
|
Posted: Thu Jan 08, 2015 6:57 pm Post subject: |
|
|
Hello,
I've been booting an X220 in UEFI mode without many problems.
As mentioned previously, you will need a live USB which will boot in UEFI.
I use Gentoo's "Iron Penguin" ISO which you can find here: https://www.gentoo.org/news/20140826-livedvd.xml - but you could also use another distro such as Fedora.
As an aside, this is a great way to do a Gentoo install because you can get the handbook up in Firefox/Chromium and use the laptop to surf the net, watch videos, listen to music etc while everything's compiling.
Anyway, here's a rough outline of the steps I use:
Code: | create boot partition using cgdisk, when prompted for size say 512M and for Hex code ef00
make filesystem: mkfs.vfat -F32 /dev/sda1
mount
add 'GRUB_PLATFORMS="efi-64"' to /etc/portage/make.conf
emerge grub
grub2-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub --recheck --debug
efibootmgr -v (to double check it worked)
grub2-mkconfig -o /boot/grub/grub.cfg
and finally, unmount and reboot
Note: I use /boot rather than /boot/efi |
One other thing to mention is the Bios settings. There are two of note, one under security>password and another under boot, which lock uefi settings and boot order respectively. In the past, I have found I needed to disable them first because they prevented grub2-install from creating the Uefi entry.
Anyway, hope that helps. If you have any questions, feel free to ask and I'll do what I can.
Regards and good luck! |
|
Back to top |
|
|
caph n00b
Joined: 06 Jan 2015 Posts: 4
|
Posted: Thu Jan 22, 2015 7:36 pm Post subject: |
|
|
Thanks guys, you helped me a lot so far. The efibootmgr of the stage-3 installation was pretty old and I updated to the newest one.
It does run without any errors, but I'm still a bit lost when it comes to UEFI without grub. Is there any guide on what to do exactly to get this thing going? I do have a compiled kernel, a working efibootmgr binary and a virgin fat32 partition which is my /boot (aka /dev/sda1). What are the next steps? The handbook only features a very incomplete quick-version of UEFI unfortunately
CH2IS, your version is using grub which is started by the BIOS and than starts the kernel, right? |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Jan 22, 2015 8:03 pm Post subject: |
|
|
caph wrote: | [...] I'm still a bit lost when it comes to UEFI without grub. Is there any guide on what to do exactly to get this thing going? I do have a compiled kernel, a working efibootmgr binary and a virgin fat32 partition which is my /boot (aka /dev/sda1). What are the next steps? The handbook only features a very incomplete quick-version of UEFI unfortunately |
caph ... the following might be of some help, as it covers many of the bootloaders available, including the kernel EFI stub.
Managing EFI Boot Loaders for Linux
HTH & best ... khay |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|