Frogging-Family / nvidia-all

Nvidia driver latest to 396 series AIO installer
723 stars 62 forks source link

Compiling open kernel modules fails on linux-zen and other non default kernels #243

Closed Alex-MacLean closed 3 weeks ago

Alex-MacLean commented 1 month ago

The Issue

Compiling the open kernel modules fails on non default kernels such as linux-zen due to /usr/src/linux not being present, with linux-zen the appropriate symlink is /usr/src/linux-zen.

My Workaround

I was able to workaround this issue by creating a symlink from /usr/src/linux pointing to /usr/src/linux-zen. This allows the script to properly compile the nvidia open kernel modules as the script is hardcoded to expect the kernel headers to be at /usr/src/linux.

Possible Solutions

This issue could be solved by temporarily linking the detected or chosen headers directory to /usr/src/linux inside the shell instance or by using temporary symlinks. These 2 solutions would be less ideal, but would still work.

Since /usr/src/linux is hardcoded in the open kernel modules script in the SYSSRC variable the most ideal solution would be to detect the installed headers or ask the user if they are using a different kernel and change SYSSRC based on what is detected or what the user inputs.

I would attempt to create a patch myself and make a pull request, but I am very much a beginner when it comes to shellscript and there is a good chance I would introduce some bugs or mess things up so I'd rather leave it to someone more experienced in shellscript.

Tk-Glitch commented 1 month ago

You only need to have the stock kernel headers installed at build time. DKMS will take care of your other kernels just fine when installing the modules. We used to have a check for headers that we had to remove because of custom kernel BS. The sensible solution would be to add the linux-headers package to make dependencies and be done with it.

I have abandoned the idea of adapting to whatever custom kernel is installed as it's simply not possible. Between "broken" headers, kernel naming inconsistencies and other fun new breakage every other day it's a PITA.

Alex-MacLean commented 3 weeks ago

That makes a lot of sense. Accounting for inconsistencies and bs people add to their sometimes broken custom kernels and headers really doesn't sound worth it when nothing is gained. I am not very experienced in kernel space development so that just kind of flew over my head. I'll close this issue since there is no reason for this issue to exist anymore.

Tk-Glitch commented 3 weeks ago

I understand the pain as a user too though :D I'll think about the best way to handle this.

Alex-MacLean commented 3 weeks ago

I'll just keep using my symlink workaround since I don't feel like having another headers package installed and the linux-zen headers tend to work properly as linux-zen is an "official" arch kernel. Maybe customization.cfg would be a good place for options for custom headers since it's out of the way for most users and is there for people who are looking for it.