# [SOLVED]Black screen on boot.

## JustCauseWhyNot

I'm running x11-drivers-510.60.02 with kernel 5.17.1, and when I boot up its just a black screen. Here my kernel config. I've read wiki, and tried every combination of drivers only one time did I boot successfully. I'm not sure why it won't anymore it boot. With kernel 5.16.18 I can boot successfully, and the ebuild indicates that kernel 5.17 is supported.

Edit: Fixed 5.17.2 kernel config.Last edited by JustCauseWhyNot on Mon Apr 11, 2022 12:06 am; edited 2 times in total

----------

## CooSee

 *JustCauseWhyNot wrote:*   

> I'm running x11-drivers-510.60.02 with kernel 5.17.1, and when I boot up its just a black screen. Here my kernel config. I've read wiki, and tried every combination of drivers only one time did I boot successfully. I'm not sure why it won't anymore it boot. With kernel 5.16.18 I can boot successfully, and the ebuild indicates that kernel 5.17 is supported.

 

hello and welcome to GenToo.

please also activate CONFIG_FB_EFI=y - the rest of your config is ok, i assume.

greetings

----------

## NeddySeagoon

JustCauseWhyNot,

Turm on 

```
# CONFIG_FB_VESA is not set

# CONFIG_FB_EFI is not set
```

```
CONFIG_FB_SIMPLE=y
```

only works if you tell grub to pass the framebuffer to the kernel.

nouveaudrmfb should take over before you get to the login prompt.

----------

## JustCauseWhyNot

Should I disable CONFIG_FB_SIMPLE if I enable CONFIG_FB_EFI. And do I need to enable both CONFIG_FB_EFI, and CONFIG_FB_VESA. Or just CONFIG_FB_EFI? And I'm only using nouveau module for for config drm kms helper. So could I use the proprietary drm drivers if I've got everything else setup properly.

Here's my nvidia modprobe.conf, modules load, and  EFI stub .Last edited by JustCauseWhyNot on Tue Apr 05, 2022 8:18 pm; edited 1 time in total

----------

## NeddySeagoon

JustCauseWhyNot,

Its safe to enable all three.

FB_EFI can only be used if you boot in EFI mode.

FB_VESA can be used regardless of BIOS or EFI mode.

FB_SIMPLE requires that the boot loader pass a framebuffer to the kernel. Its simple as the kernel will only use it, not set it up.

All the other Framebuffer Hardware options are for hardware over 20 years old.

They interfere with the DRM framebuffers, like nouveaudrmfb, which is what you will be using, and will be required for Xorg to work.

You cannot switch to the binary blob nvidia-drivers while the nouveau driver has control of the GPU and it cannot be unbound while the console in in use.

If you want to use nvidia-drivers, which does not provide a console driver, the nouveau driver must not be allowed to load.

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> And I'm only using nouveau module for for config drm kms helper.

 

We had the same question in our german forum ( https://forums.gentoo.org/viewtopic-t-1147984.html ) and I answered:

There is another way to get DRM_KMS_HELPER

```
Device Driver  --->

Graphics support  --->

[*] Simple framebuffer driver
```

This is "CONFIG_DRM_SIMPLEDRM" and it selects ->

```
Selects: DRM_GEM_SHMEM_HELPER [=y] && DRM_KMS_HELPER [=y]
```

So you dont need to enable "CONFIG_DRM_NOUVEAU=m" to get DRM_KMS_HELPER=y

----------

## JustCauseWhyNot

Thank you everybody for your help. I'll give it a try following the advice from this thread, and update the thread if I was successful or not.

----------

## JustCauseWhyNot

I've got some success. The console seems to try and show up, but it's not working properly. Here's a link to an image of what's happening. And my kernel config. I'm able to reboot my PC using cntrl+alr+printscrn. I've had similar issues but not the same as this before. This time the monitor looks broken despite it not being.

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> [...] And my kernel config. [...]

 

I would like to ask HOW you did this kernel configuration ...

... because I see something very strange; do you really have disabled this ?

```
#

# Gentoo Linux

#

# CONFIG_GENTOO_LINUX is not set

# end of Gentoo Linux
```

Why ?

As far as I see also, you

1. Misses also support for MSDOS-partition

2. You have not included Microcode for your CPU; nor Firmware for your graphics adapter

(3. You dont have a NVMe)

4. Dont use any EXT4 partition

5. use XFS for root partition; and all other

```
# CONFIG_MSDOS_PARTITION is not set

CONFIG_EXTRA_FIRMWARE=""

# CONFIG_BLK_DEV_NVME is not set

# CONFIG_EXT4_FS is not set

CONFIG_XFS_FS=y
```

You have emerged it with USE-flag "experimental" AND it is the newest unstable 5.17.1 ... 

... all in all a strange setting ...

To help you further we need more informations:

a) Which system (Model, system details)

b) Output of "lspci -k" (after booting your old version)

c) Output of "dmesg" (after booting your old version)

----------

## JustCauseWhyNot

I'm running an x86 desktop with a ryzen 7 3700x, gtx 1660 super, and 16gb of memory. Here's output of 'lspci -k', and dmesg. All kernel config changes are intentional. If you need anymore information let me know. Thank you for your help.

----------

## pietinger

I see you are using an initrd/initramfs which loads needed kernel modules. Here you have to check how you have created it. You have to create it AGAIN for your new kernel version because all modules you are using in your initrd MUST match to your kernel version.

If you need help for this, I would recommend to describe all steps you have done for:

1. Building your initial kernel installation (5.16.18 ?), AND

2. Updating to 5.17.1

----------

## JustCauseWhyNot

I shouldn't be using an initramfs. The output is from the gentoo install iso. That's the only way for me to chroot in and fix install. It might be the reason an initramfs shows up. Or maybe I missed something.

----------

## pietinger

So, you are not able to boot your old 5.16.18 ? (Why ?)

----------

## JustCauseWhyNot

Because I've got yet to reinstall 5.16.18. I've been trying to fix install from the chroot. But I guess I should reinstall 5.16.18

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> [...] But I guess I should reinstall 5.16.18

 

Most important is to BACKUP your old working .config ! With this you should be able to find the reason for not booting with (a new/changed config for) 15.17.1 ...

----------

## JustCauseWhyNot

I've made a realization. I don't have to delete my old kernel everytime I upgrade. That's why I've been chrooting into system from install. I'm fixing that right now.

----------

## pietinger

Never delete your old working kernel before a new one will boot correct ...   :Cool: 

(SCNR)

----------

## JustCauseWhyNot

It's taken me too long realize this. I'm recompiling kernel 5.16.18, and I'll boot into that. Thank you for your patience.

----------

## JustCauseWhyNot

I've successfully rebuilt, and rebooted into kernel 5.16.18. Here's the output of 'lspci -k'', and dmesg.

----------

## pietinger

One question before I write too much: Do you use grub2 ? (or anything else?)

----------

## JustCauseWhyNot

I use efistub, and efibootmgr to mange boot entries.

----------

## NeddySeagoon

JustCauseWhyNot,

Tell us how you get from the 5.16.18-gentoo-r1 kernel to 5.17.1.

What do you do?

Your sound card drivers are not listed in dmesg but they are in lspci.

----------

## JustCauseWhyNot

In make.conf I've got ACCEPT_KEYWORDS="*". Then I run portage and update to kernel 5.17.1,  and then I "$ cp /usr/src/linux-5. 16.18-gentoo-rl/.config /usr/src/linux-5.17.1-gentoo-r1/". After that I run " $ cd /usr/src/linux" " $ make modules_prepare && make && make modules_install". Than " $ cp arch/x86/boot/bzImage /boot/efi/boot/bootx64.efi" "$ emerge @module-rebuild" "$ modprobe -r nvidia" " $ modprobe nvidia" "$ /boot/stub "$ reboot".

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> I use efistub, and efibootmgr to mange boot entries.

 

This means you have at least one entry in your UEFI BIOS table (see with "efibootmgr -v") ... AND ... I see that you dont have configured your root-partition in your kernel configuration:

```
# CONFIG_CMDLINE_BOOL is not set
```

... BUT ... you are able to boot with this (from "dmesg"):

```
root=PARTUUID=f0c9dd3a-5063-5647-9c3b-ca874f94c0e9
```

... SO THIS MEANS you configured this boot parameter ALSO into your UEFI entry.

To have two kernels for booting available I recommend to "cp" your 5.16-kernel to a new name, e.g. "bzImage-old.efi" and create a second UEFI entry with something like this; edit it for your needs; Y is your partition nr.):

```
# efibootmgr -c -d /dev/sdX -p Y -L "OLDLINUX" -l '\EFI\Boot\bzImage-old.efi -u 'root=PARTUUID=f0c9dd3a-5063-5647-9c3b-ca874f94c0e9'
```

Then do your new kernel this way (my recommendation):

Clean all old config and GIVE US ALL output of your "make oldconfig" (with your answers):

```
# cd /usr/src/linux-5.17.1

# make distclean

# cp /usr/src/linux-5.16.8/.config .

# make oldconfig
```

Then compile and install it like you always do (e.g.: make -j X; mount /boot; make modules_install; cp xxxx bzImage.efi; umount /boot; reboot) and try to boot it again (maybe some problems with nvidia; but you should see CLI; I am not a nvidia expert, so we need others for nvidia).

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> [...] /boot/efi/boot/bootx64.efi [...]

 

Aaah ... this is bad. Does your system really need it ? Its better to use an own directoy like /boot/efi/gentoo and use there bzImage.efi

See more here: https://wiki.gentoo.org/wiki/Efibootmgr

and here: https://wiki.gentoo.org/wiki/EFI_stub_kernel

----------

## JustCauseWhyNot

I'll gladly change it. I was just following from wiki. From either efibootmgr, efistub, or amd64 handbook boot article. One of those is where I got that idea. I'll change it.

----------

## JustCauseWhyNot

Here's my make oldconfig https://gist.github.com/JustCauseWhyNot/f5d37fd08b79a4324625aff58f0bca8b, kernel config 5.16.18 https://gist.github.com/JustCauseWhyNot/98ec5c1e543b8b05ce6677ab428c7eb9, and boot stub https://gist.github.com/JustCauseWhyNot/378fb2ec9d038cf877476767e0538d5c. I noticed with kernel 5.16.18 im not getting high res console with new location of .efi file.

----------

## pietinger

Two (three) questions:

1. Does 5.17.1 work or not ? (If not what you have/see now ?)

2. What was the output of "make oldconfig" ? (you did, did you ?)

----------

## JustCauseWhyNot

5.17.1 didn't show anything. It stayed black. Then I booted up 5.16.18, and it booted properly. 5.16.18 was not in high resolution even though I only changed efi stub location, and high resolution always has worked. And with 5.17.1 I ran make oldconfif, and was prompted with questions. I said no to all but amd p-state. I tried wgetpaste command of make oldconfig, but it didn't work.Last edited by JustCauseWhyNot on Wed Apr 06, 2022 8:02 pm; edited 1 time in total

----------

## NeddySeagoon

JustCauseWhyNot,

 "\EFI\Gentoo\bzImage.efi"

A better name is 

 "\EFI\Gentoo\<kernel-ver>.efi" As long an it ends in .efi

That way you can have several EFI stub kernels and tell them apart.

----------

## JustCauseWhyNot

You're right, but currently I'm just naming 5.17.1 bzImage.efi, and 5.16.18 bzImage-old.efi.

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> 5.17.1 didn't show anything. It stayed black. 

 

Can you do a warm boot ? If yes, then we have "only" a display problem (and your kernel booted).

Try this: Enable (static):

```
Device Driver  --->

Graphics support  --->

[*] Simple framebuffer driver
```

(maybe we need moore; but only one change after another)

----------

## JustCauseWhyNot

If by warm boot you mean I can my reboot with cntrl+alt+prntscrn, and my keyboard lights up then no I can't. In this case it just seems to fail to initialize. And don't worry I'm making eselect kernel is set to correct kernel.

----------

## pietinger

Neddy,

 *NeddySeagoon wrote:*   

> A better name is 
> 
>  "\EFI\Gentoo\<kernel-ver>.efi" As long an it ends in .efi
> 
> That way you can have several EFI stub kernels and tell them apart.

 

I highly DONT recommend this. You dont want to make a new UEFI entry for every new kernel version. Its better to have two (or maybe three) names, like "bzImage.efi" and "bzImage-old.efi" with two FIXED entries in UEFI =>

When you do a new kernel, THEN you only cp your current kernel to bzImage-old.efi and your new to bzImage.efi WITHOUT a need to do new UEFI boot-entries.

There is also another solution I REALLY DO for myself:

After a standard installation with our AMD64 handbook, we have a grub2 (with an UEFI entry for it). You have to know that grub2 is able to boot a stub-kernel like every "normal" kernel also.

So I have two UEFI entries: ONE for grub (coming from standard installation) and ONE for my stub-kernel (made with "efibootmgr -c ..."). When a NEW stub-kernel has successful  booted I simply add it into grub2 with:

```
# mount /boot

# cd /usr/src/linux

# make install

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

# umount /boot
```

If now my NEXT stub-kernel doesnt boot, I switch in my BIOS to grub2 and boot with it my last working kernel.

----------

## JustCauseWhyNot

I'm following your advice pietinger. Except I don't really need grub I just use kt bios ro switch different kernels.

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> Except I don't really need grub I just use kt bios ro switch different kernels.

 

To be honest, my last kernel I added to grub2 is very old, BECAUSE I have three UEFI entries ... long story: I am using IMA in kernel (command line: "... ima_appraise=enforce") and therefore need an additionaly unlocked kernel when I want to update; so my second (third) entry is used as a backup also. Here is my output:

```
# efibootmgr -v

BootCurrent: 0001

Timeout: 1 seconds

BootOrder: 0001,0002,0000

Boot0000* gentoo        HD(2,GPT,e6cccc9a-40e0-4b59-b6d2-082596500077,0x1800,0x1fe800)/File(\EFI\gentoo\grubx64.efi)

Boot0001* DIRECT        HD(2,GPT,e6cccc9a-40e0-4b59-b6d2-082596500077,0x1800,0x1fe800)/File(\EFI\Boot\bzImage.efi)

Boot0002* UNLOCKED      HD(2,GPT,e6cccc9a-40e0-4b59-b6d2-082596500077,0x1800,0x1fe800)/File(\EFI\unlocked\bzImage.efi)
```

----------

## JustCauseWhyNot

I do get a warm boot with 5.17.1 and setting CONFIG_DRM_SIMPLEDRM. But the screen isn't just blacked out it's glitched. link to picture of screen.

----------

## pietinger

Ok. Next two trys:

1. emerge 5.17.1-r1 WITHOUT "experimental" !!

2. Do the complete action again AND watch if there was an option with default Y; if yes take it; if not takeover all N defaults (even AMD-P-state; this can be enabled later also):

```
# cd /usr/src/linux-5.17.1-r1

# make distclean

# cp /usr/src/linux-5.16.8/.config .

# make oldconfig
```

----------

## JustCauseWhyNot

Should I rebuild kernel after following steps?

----------

## pietinger

The reason for P-States is: It is possible it works only if you have an actual microcode for your AMD CPU.

So next try will be:

Install as built-in: https://wiki.gentoo.org/wiki/AMD_microcode#Configuration_.28built_into_kernel.29

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> Should I rebuild kernel after following steps?

 

Yes. (you must) Or we could not test it.

----------

## JustCauseWhyNot

Got it.

----------

## JustCauseWhyNot

I followed instructions, and both dead boot.

----------

## pietinger

I cant believe 5.17.1 has such problems. As a beg: Can you be a little more detailed ? (So, what of all you have done: AMD microcode loading?)

Was there one (or more) options with default Y(es) ? 

AMD P-State is disabled ? ... OR even BETTER: Can you post the actual kernel configuration ?

----------

## JustCauseWhyNot

Here's config https://gist.github.com/JustCauseWhyNot/11ceba41168aa555974ec833ec3cb915.. There were some options I was promoted with. Likely 5-15, and a with default yes. I did default for all of them. I tried first no amd microcode, and second with amd microcode. Each time I booted I would be stuck at black screen. If I enable CONFIG_DRM_SIMPLEDRM that gives me a graphically glitched black screen.

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> There were some options I was promoted with. Likely 5-15, and a with default yes. I did default for all of them.

 

You dont care much about them ... hmm ... maybe it is not important ... because ...

 *JustCauseWhyNot wrote:*   

> If I enable CONFIG_DRM_SIMPLEDRM that gives me a graphically glitched black screen.

 

... this looks like a problem with NVIDIA ... maybe this driver doesnt work with 5.17.1 ... ?

I see two chances:

1. Check the old system boot in /var/log/messages, and/or

2. Disable NVIDIA completly (and maybe disable the start of your graphical DE to land on a "naked" terminal).

At the moment I have no more ideas ... Hopefully we will find something in /var/log/messages

----------

## JustCauseWhyNot

/car/log/boot is empty. I'm also currently booting into tty. And I did manage one boot into 5.17.1 a few days ago, but I don't know why it stopped working. The ebuild also says it supports kernel 5.17. Thank you for your help.

----------

## pietinger

 *JustCauseWhyNot wrote:*   

> /car/log/boot is empty. 

 

You dont have a /var/log/messages ?

Yeah, I will go to bed also now ... maybe see you tomorrow.

----------

## JustCauseWhyNot

No there's not a /var/log/messages. I appreciate the time you've given to help me.

----------

## figueroa

What logger are you using?  Is there a /var/log/syslog or /var/log/boot?

----------

## JustCauseWhyNot

Syslog-ng. Although I'm not entirely sure I've setup it up.

----------

## figueroa

Is it running? Look at the output of rc-update.  The configuration files are at /etc/syslog-ng/. I'm running metalog which is quite different, but I think more users are using syslog-ng which should give you the traditional /var/log/messages and /var/log/syslog.

----------

## pietinger

JustCauseWhyNot,

can you try again with new 5.17.2 ?

(its a very huge update; very seldom; see: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-5.17.y )

----------

## JustCauseWhyNot

I will give it a shot with the new update.

----------

## JustCauseWhyNot

I've setup metalog, because I didn't have syslog-ng setup. Here's my 5.17.2 config. I can't find any log of kernel 5.17.2 when it fails to boot. When I try and boot it sticks on black screen. Not even a "warm boot" were I've got some input control.

----------

## NeddySeagoon

JustCauseWhyNot,

```
CONFIG_NET_SELFTESTS=y

CONFIG_DRM_DEBUG_SELFTEST=y
```

Do those seftests take minutes, hours, days or weeks to run?

Anything to do with debug or self tests should be off unless you know why you need it. 

```
CONFIG_DRM_EXPORT_FOR_TESTS=y

CONFIG_PNP_DEBUG_MESSAGES=y

CONFIG_DEBUG_KERNEL=y

CONFIG_DEBUG_MISC=y

...
```

Debug always generates logspam and its allowed to interfere with normal operation too.

----------

## JustCauseWhyNot

I've disabled those selftests, except CONFIG_NET_SELFTEST as that required me disabling CONFIG_INET. I had CONFIG_DRM_DEBUG_SELFTEST enabled inorder to turn on CONFIG_DRM_KMS_HELPER, and I didn't need to enable simpledrm which is mutually exclusive with simplefb. And I need simplefb to boot. But I've disabled CONFIG_DRM_DEBUG_SELFTEST, and everything listed in second box.

----------

## pietinger

JustCauseWhyNot,

I had an intensive look to your kernel config ... AND for me its ok (to boot). Yes, there are some options you dont need all, like these:

```
CONFIG_SND_HDA_CODEC_REALTEK=y

CONFIG_SND_HDA_CODEC_ANALOG=y

CONFIG_SND_HDA_CODEC_SIGMATEL=y

CONFIG_SND_HDA_CODEC_VIA=y

CONFIG_SND_HDA_CODEC_HDMI=y

CONFIG_SND_HDA_CODEC_CIRRUS=y

CONFIG_SND_HDA_CODEC_CS8409=y

CONFIG_SND_HDA_CODEC_CONEXANT=y

CONFIG_SND_HDA_CODEC_CA0110=y

CONFIG_SND_HDA_CODEC_CA0132=y

CONFIG_SND_HDA_CODEC_CA0132_DSP=y

CONFIG_SND_HDA_CODEC_CMEDIA=y

CONFIG_SND_HDA_CODEC_SI3054=y
```

and some options should be inverted (disable all enabled; enable all disabled), like these:

```
# CONFIG_CPU_ISOLATION is not set

# CONFIG_CHECKPOINT_RESTORE is not set

CONFIG_BLK_DEBUG_FS=y

# CONFIG_MSDOS_PARTITION is not set

CONFIG_DEVMEM=y

# CONFIG_USB_UAS is not set
```

... BUT ... these all do NOT cause your problem of a black screen. As I said before I believe its NVIDIA ... NOW we need your systemlog. Simpler than metalog is sysklogd:

https://wiki.gentoo.org/wiki/Sysklogd

(but its your choice).

----------

## pietinger

Neddy,

you are right with DEBUG options ... in most cases ... BUT some are needed, AND some will INCREASE Kernel Security, like these:

```
CONFIG_SLUB_DEBUG=y

CONFIG_PNP_DEBUG_MESSAGES=y

CONFIG_DEBUG_KERNEL=y

CONFIG_DEBUG_MISC=y

CONFIG_DEBUG_WX=y

CONFIG_SCHED_DEBUG=y

CONFIG_DEBUG_LIST=y

CONFIG_DEBUG_SG=y

CONFIG_DEBUG_NOTIFIERS=y

CONFIG_DEBUG_CREDENTIALS=y
```

See more here:

https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings

----------

## JustCauseWhyNot

It's solved! I disbaled CONFIG_DRM_DEBUG_SELFTEST, and that seems to be the issue. I don't have CONFIG_DRM_KMS_HELPER=Y, but I can boot up to the tty in high resolution. I tested turning on simpledrm, but when the nvidia-drm module loaded I got a graphical error, and it freezes up. I'll share config within a short amount of time, but I need to take a break. Thank you pietinger, and NeddySeagoon.

----------

## JustCauseWhyNot

I'm able to boot using simplefb. If I try and use simpledrm though I get a graphical error, and the startup log freezes. Here's the kernel config I'm using. I need CONFIG_DRM_FBDEV_EMULATION=Y or I get a glitched black screen without startup log.

----------

## pietinger

JustCauseWhyNot,

thank you very much for reporting back. Maybe this will help some others in the future.

Many Greetings,

Peter

----------

## JustCauseWhyNot

I do hope this helps anyone else. But I sent config also to get help. I still can't boot properly while having COMFIG_DRM_KMS_HELPER=Y.

----------

## pietinger

Sorry for this misunderstanding (I thought it was solved). At the moment I have no ideas, but I know there is actual many changes in kernel for FrameBuffer (AFAIK its not finished right now).

So maybe it is best to boot your old kernel and wait for:

a) new kernel versions, and/or

b) new NVIDIA versions

Sorry for no better service ...  :Sad: 

----------

## JustCauseWhyNot

The core problem is solved. I wasn't able to boot with anything I tried , but I've got a configuration that works properly now. I didn't clarify well enough. The problem was I get an error about CONFIG_DRM_KMS_HELPER not being set when I rebuild nvidia. It's not a huge deal though. For now I'm just going to use simplefb, and hopefully the drivers will get better support in future. Thank you for your help.

----------

## JustCauseWhyNot

Last post. Here's a 5.17.2 kernel config that doesn't have any issues. I've solved all the issues I've had.

----------

