How to Set Nvidia as Primary GPU on Optimus-based Laptops

I followed the guide tilted as above in the fedora docs, here’s a link to it How to Set Nvidia as Primary GPU on Optimus-based Laptops :: Fedora Docs

im on fedora 38 fresh install, lenovo legion y530 nvidia gtx 1050
i followed the steps in the guide and waited 15 minutes on step 5, executed “sudo akmods --force”
and received the following : Checking kmods exist for 6.2.9-300.fc38.x86_64 [ OK ]
Files needed for building modules against kernel
6.2.9-300.fc38.x86_64 could not be found as the following
directories are missing:
/lib/modules/6.2.9-300.fc38.x86_64/build/Is the correct kernel-devel package installed? [FAILED]
Checking kmods exist for 6.2.11-300.fc38.x86_64 [ OK ]

the directory that is in /usr/src/kernels is : 6.2.11-300.fc38.x86_64

kept getting this, tried rebooting and did it again recevied this : Checking kmods exist for 6.2.11-300.fc38.x86_64 [ OK ]

tried to continue and everything went well after, i did the same exact steps mentioned in the guide until the last step, however i still dont get the nvidia driver being used after issuing :

glxinfo | egrep “OpenGL vendor|OpenGL renderer”

i still get :
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)

it does however thi nvidia driver appear in the About section in Settings next to / the intel one

The nvidia GPU cannot be set as primary using that method when using wayland.
If you log out then log back in using xorg it normally will switch to the nvidia GPU as primary.

The message about kernel 6.2.9 is probably due to the fact that you already had the newer kernel installed when you installed the nvidia driver.

You should not need to do any of those steps again except possibly for the verification step with ‘glxinfo’ after you log out and back in using xorg.

There is a note missing from that guide (it was created before wayland became the standard for fedora) about the fact that it only works when using xorg as your DE. Searching through the topics here will give several examples where that is clearly stated.

Please use the instructions from