# [WORKED-AROUND]Nvidia-drivers+efifb no console at boot

## AndrewAmmerlaan

For various reasons I wanted to move the framebuffer console from the monitor connected to my iGPU to the monitor connected to my nvidia GPU. 

I used to have BIOS/GRUB output on the nvidia card (because it was set as default in bios), and then have the kernel and openrc messages on the iGPU. Now I would like to have it all on the same monitor, to do that I enabled efifb in the kernel. 

This sort of did what I wanted: early kernel messages are now printed on the monitor connected to the nvidia card, but then at the point where openrc should start the monitor just goes black and stays that way until sddm starts. 

Now the strange thing is that it works just fine after that, once SDDM/X has started I can switch to a tty (on the monitor connected to the nvidia card) and that will work just fine, and at shutdown I can see all the messages that openrc prints there. The only time it doesn't work is at boot.

If sddm is removed from the runlevel it will just stay black forever.

```

andrew-gentoo-pc andrew # dmesg | grep efifb

[    0.254725] pci 0000:01:00.0: BAR 3: assigned to efifb

[    0.362960] efifb: probing for efifb

[    0.362968] efifb: framebuffer at 0xd1000000, using 5632k, total 5632k

[    0.362970] efifb: mode is 1600x900x32, linelength=6400, pages=1

[    0.362970] efifb: scrolling: redraw

[    0.362972] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
```

Full dmesg: http://dpaste.com/2EESQXB

There are now 2 framebuffer devices, as expected:

```

andrew-gentoo-pc ~ # ls /dev/fb*

/dev/fb0  /dev/fb1
```

Does anyone know how I can get rid of the black screen between early-boot and sddm?

(I already tried removing the 'nvidia-drm.modeset=1' parameter)

--------------[EDIT]--------------

Adding nvidia, nvidia_modeset and nvidia_drm to /etc/modules-load.d gives me the following in rc.log:

```

* Loading module nvidia ...

* Failed to load nvidia

[ !! ]

* Loading module nvidia_modeset ...

[ ok ]

* Loading module nvidia_drm ...

[ ok ]
```

(Apparently it gives this error because the module is already loaded)

--------------[EDIT2]--------------

Same with simplefb:

```

andrew@andrew-gentoo-pc ~ % dmesg | grep simple

[    0.358479] simple-framebuffer simple-framebuffer.0: framebuffer at 0xd1000000, 0x57f000 bytes, mapped to 0x0000000039b4e62f

[    0.358481] simple-framebuffer simple-framebuffer.0: format=a8r8g8b8, mode=1600x900x32, linelength=6400

[    0.362380] simple-framebuffer simple-framebuffer.0: fb0: simplefb registered!

```

No errors, but somehow the screen still goes black between early-boot and sddm

Same problem with a different monitor

Same problem if GRUB_GFXPAYLOAD_LINUX=keep is commented out

If GRUB_GFXPAYLOAD_LINUX=text I don't get any console at all

x11-drivers/nvidia-drivers-430.34

----------

## nvaert1986

Did you emerge nvidia-drivers with the kms and uvm USE flags enabled? As I'm completely sure kms is required, but also noticed some functionality is not working when the uvm USE flag is not set.

Also try generating an initramfs using dracut (I've seen too much issues with genkernel) and include all the nvidia kernel modules to see what it does.

Also try compiling your kernel with the efifb disabled, because in some cases the efifb can give issues with the nvidia-kms driver.

Also make sure you start your system in UEFI mode with CSM disabled (for native resolution) and set the native resolution in your grub configuration and set the GFXPAYLOAD to keep

That should generally work.

----------

## AndrewAmmerlaan

 *nvaert1986 wrote:*   

> Did you emerge nvidia-drivers with the kms and uvm USE flags enabled? As I'm completely sure kms is required, but also noticed some functionality is not working when the uvm USE flag is not set.

 

ksm is enabled, uvm wasn't, I have enabled it now. I'll check if it works now.

[EDIT] No that didn't do it

 *nvaert1986 wrote:*   

> Also try generating an initramfs using dracut (I've seen too much issues with genkernel) and include all the nvidia kernel modules to see what it does.

 

Don't have an initramfs at all atm, I will look into it.

 *nvaert1986 wrote:*   

> Also try compiling your kernel with the efifb disabled, because in some cases the efifb can give issues with the nvidia-kms driver.

 

I could do this, but that will give me no framebuffer at all on the monitor connected to the nvidia card, which was the whole point of the operation.

 *nvaert1986 wrote:*   

> Also make sure you start your system in UEFI mode with CSM disabled (for native resolution) and set the native resolution in your grub configuration and set the GFXPAYLOAD to keep

 

System is set to UEFI only, and grub boots with the correct resolution, gfxpayload is set to keep.

----------

## AndrewAmmerlaan

Alright, I didn't solve this per se, but I did achieve the desired result of having bios and boot console on the same monitor(s) by setting the intel card as the boot GPU.

----------

## nvaert1986

Hmm, that's odd. 

Did you rum grub-mkconfig after generating the initramfs? 

Did grub-mkconfig detect the initramfs and add it to your grub config file?

Did you explicitly state to add the 4 nvidia-drivers to the initramfs in the config file or on the command line (otherwise chances are they're not added)?

Did you verify the files were added to the initramfs?

Could you share the contents of your grub.cfg?

EDIT: Also be sure to read: https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers

For (U)EFI systems, uvesafb will not work. Be warned that enabling efifb support in kernel (CONFIG_FB_EFI=y) causes intermittent problems with the initialization of the NVIDIA drivers. There are reports of success from marking legacy framebuffers as generic and enabling the simple framebuffer while disabling all others.

----------

## AndrewAmmerlaan

 *nvaert1986 wrote:*   

> Hmm, that's odd. 
> 
> Did you rum grub-mkconfig after generating the initramfs? 
> 
> Did grub-mkconfig detect the initramfs and add it to your grub config file?
> ...

 

I haven't tried a initramfs yet, but to my understanding this will only load the drivers earlier in the boot process, and the thing is the framebuffer (efifb/simplefb) works just fine up to the point were openrc starts and the nvidia-drivers get loaded. Therefore, I think that loading the drivers earlier might do nothing at best and at worst just make the problem occur earlier.

In any case the system is working to my satisfaction by setting the intel GPU as the boot GPU, now both the BIOS and the kernel boot messages are displayed on the same monitors and there is no more switching between monitors during the boot process.

 *nvaert1986 wrote:*   

> 
> 
> EDIT: Also be sure to read: https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers
> 
> For (U)EFI systems, uvesafb will not work. Be warned that enabling efifb support in kernel (CONFIG_FB_EFI=y) causes intermittent problems with the initialization of the NVIDIA drivers. There are reports of success from marking legacy framebuffers as generic and enabling the simple framebuffer while disabling all others.

 

I know, however the gentoo wiki is the only page I can find stating this, the arch wiki for instance seems to imply that efifb works just fine, in any case simplefb exhibits exactly the same behaviour.[/quote]

----------

