# [Solved] UEFI - black screen

## Buffoon

OK, my first UEFI setup, not working.

I created GPT partition table,

created 200 MB partition type ef00,

formatted it to fat32,

built an EFI stub kernel following Gentoo wiki,

copied it over to EFI/Boot/bootx64.efi.

M/B setup tells me there is UEFI boot hard drive, when I try to boot from it the screen stays blank, kernel is not loading.

What did I do wrong? I tested the kernel with MBR boot, it works.

Kernel config: https://bpaste.net/show/69c56db87bf7Last edited by Buffoon on Sun Feb 21, 2016 6:10 pm; edited 1 time in total

----------

## eccerr0r

Set CONFIG_FB_EFI

VESA BIOS is dead during EFI boot.

----------

## Buffoon

!!! Thanks! Getting on it ...

----------

## Buffoon

Nope. Still same, although you gave me idea it actually was working - and it is. Just have to log in blind and run startx ...

New paste: https://bpaste.net/show/c3e0c43eaf31

What did I miss now?

----------

## VoidMage

Why isn't any of CONFIG_DRM options (those correct for your video card) set ?

Also, set both CONFIG_FB_SIMPLE and CONFIG_X86_SYSFB.Last edited by VoidMage on Sun Feb 21, 2016 3:30 am; edited 1 time in total

----------

## Buffoon

I'm running nvidia blob.

----------

## Buffoon

OK I configured my desktop to autologin to console and autostart X ... I'd like to get back to normal, all ideas are very welcome!

----------

## msst

I cannot really say what is going wrong for you, but a while back it also was a serious effort for me to get UEFI boot going, especially with the console and such working, that I needed for the encrypted root.

[rant on]

UEFI was designed by a bunch of idiots with no idea of how to do something user friendly and robust. They probably could not even spell linux and then they handed their ideas to some total morons designing the motherboard BIOS systems, who seem to get payed by the number of bugs they build into the BIOS.

[/rant off]

Really, it adds more than one layer of complexity and you are at the mercy of the BIOS and how well or not this handles the UEFI boot process. I am not sure if I would want to deal with it again, quite possible that I would just disable UEFI entirely on the motherboard if I again run into trouble with it in the future.

Anyway, I have pastebined my current kernel config. This one works to boot from efi with a compiled in initramfs and a compiled in kernel command line. You obviously need to adjust these to your needs, but the config has a working text console during boot, in the initramfs phase where I enter the password and also afterwords if the xserver should fail to start. That also took me several tries to get right.

https://bpaste.net/show/572321808e61

And I should add I had to boot with a live-usb-stick the first time to get efivars working and then point the UEFI bios to the kernel on the harddrive via efibootmgr. That is also a massive and completely braindead hassle I needed to follow to get it working. Kernel command lines work only when I compile them in the kernel. The UEFI bios I have has zero support for such extravagances. It ignores any attached kernel command line via efibootmgr without giving errors.

----------

## saellaven

I just put together a new system that has UEFI and it took me a couple tries to get it booting without having to go through BIOS emulation.

Quick summary of what worked:

1) I set my SSD to use GPT and made an EFI partition mounted under /boot/EFI

2) I made a kernel with the EFI stub, EFI frame buffer, etc and installed it in /boot/EFI/EFI/Boot/

Not all of these may be necessary to get it to boot, I was spitballing a bit, since I was loading a blank screen that hung the system and haven't refined it yet. note that the PARTUUID is the GPT partition ID, not the filesystem ID

```

CONFIG_EFI_PARTITION=y

CONFIG_EFI=y

CONFIG_EFI_STUB=y

CONFIG_RELOCATABLE=y

CONFIG_CMDLINE_BOOL=y

CONFIG_CMDLINE="root=PARTUUID=a9cb9a9f-cfc6-410e-946b-1ec9e468452a dolvm rootfstype=ext4"

CONFIG_VT_HW_CONSOLE_BINDING=y

CONFIG_FB_EFI=y

CONFIG_FB_SIMPLE=y

CONFIG_FRAMEBUFFER_CONSOLE=y

CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y

CONFIG_EFI_VARS=y

CONFIG_EFI_ESRT=y

CONFIG_EFI_RUNTIME_WRAPPERS=y

CONFIG_EFIVAR_FS=y

CONFIG_EARLY_PRINTK_EFI=y

```

3) I installed sys-boot/refind and ran 

```

refind-install --usedefault /dev/sdc1 --alldriver
```

with sdc1 being the location of my EFI partition, and then added the following to /boot/EFI/EFI/Boot/refind.conf

```

#latest installed version

menuentry Linux {

    icon EFI/refind/icons/os_linux.png

    loader \efi\boot\linux-current.efi

    options "root=PARTUUID=a9cb9a9f-cfc6-410e-946b-1ec9e468452a"

}

#version known to work

menuentry Linux-safe {

    icon EFI/refind/icons/os_linux.png

    loader \efi\boot\linux-4.4.1.efi

    options "root=PARTUUID=a9cb9a9f-cfc6-410e-946b-1ec9e468452a"

}

```

I still need to tweak refind.conf to add in an option for single/repair

4) I set my UEFI/BIOS to disable secure boot and to favor UEFI over BIOS

Now, to get here, I played around with several different rescue/install disks on my USB key. I couldn't get sysrescuecd to boot in UEFI despite recommendations for that on the wiki. I did get a refind key to boot into UEFI but it wouldn't load the kernel (at first, failing with a "loader not found" error). I tried the arch install disk, which did boot and let me load my partitions, so I edited efibootmgr from there, but that didn't result in anything working. I ended up installing elilo, which was more flexible about letting me experiment with a boot command line, which was ultimately how I ended up getting to the working loader lines above, but as I said, it just resulted in a hung screen with no disk activity, so I added in the frame buffer changes and that's what finally got me running.

the system is a FX8350 mounted on a m5a99fx, with a GTX650 using nvidia blob if that helps anyone

----------

## Buffoon

Thanks for your input. See, the UEFI on this mobo is so broken that when I put it in CSM mode it will not find the hard drive unless I go into setup, pick the drive, save and boot. Next reboot I have to do the same again, otherwise it tells me no boot media found. Junk, junk, junk ...

----------

## Buffoon

Solved!

First time when I changed FB in kernel config I just ran make, now I did make clean first and it made the difference. Go figure.

----------

## eccerr0r

Well, time and time again: NEVER EDIT .config manually!!!

Search for it in menuconfig and set it.  There are dependencies and other cleanup that menuconfig/xconfig will do for you.

----------

## Buffoon

 *eccerr0r wrote:*   

> Well, time and time again: NEVER EDIT .config manually!!!
> 
> Search for it in menuconfig and set it.  There are dependencies and other cleanup that menuconfig/xconfig will do for you.

 

Who edited .config manually? I use make nconfig, in case you want to know.

----------

