nvidia-graphics-drivers fail to build [error: implicit declaration of function ‘init_timer’]

Bug #1737750 reported by Seth Forshee on 2017-12-12
322
This bug affects 75 people
Affects Status Importance Assigned to Milestone
nvidia-graphics-drivers-304 (Ubuntu)
Medium
Seth Forshee
nvidia-graphics-drivers-340 (Ubuntu)
Undecided
Unassigned
Revision history for this message
Seth Forshee (sforshee) wrote :
tags: added: kernel-adt-failure
Revision history for this message
Seth Forshee (sforshee) wrote :
Changed in nvidia-graphics-drivers-304 (Ubuntu):
assignee: nobody → Seth Forshee (sforshee)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Seth Forshee (sforshee) wrote :

Note that I've compile tested the attached fix but don't have hardware to do run-time testing.

tags: added: patch
Revision history for this message
Unit 193 (unit193) wrote :

I can confirm Seth's findings, as well as the fact it functions.

nvidia-304, 304.137, 4.15.0-10-generic, x86_64: installed

[ 40.440] (II) NVIDIA dlloader X Driver 304.137 Thu Sep 14 13:52:41 PDT 2017
[ 40.440] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[ 40.440] (II) NOUVEAU driver Date: Fri Apr 21 14:41:17 2017 -0400

00:0d.0 VGA compatible controller: NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) (prog-if 00 [VGA controller])
 Kernel driver in use: nvidia

Thanks for the patch!

Revision history for this message
Seth Forshee (sforshee) wrote :

It's been suggested that this driver should be removed as it's not longer maintained (bug 1748000), so I'm not sure what the fate of this patch will be.

Revision history for this message
matt r. (triplr) wrote :

it is maintained by nvidia, i submitted a report to them .

how do I install the patch and where, driver kernel etc ?
i have compiled kernels, but not a patch as of yet

i have the hardware.

Revision history for this message
matt r. (triplr) wrote :

build reject for this patch in the driver

Revision history for this message
matt r. (triplr) wrote :

thank you google and duck duck gogo, i found the patch instructions here

https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/4/

Revision history for this message
Ricardo Almeida (ric-almeida) wrote :

Could a ppa be created for the easy distribution of the patched version?

Revision history for this message
Bill Miller (wbmilleriii) wrote :

I'd love to have it too. It controlled the heating on my laptop better than any other version.

Revision history for this message
jfrantzius (jfrantzius) wrote :

Could some friendly soul provide instructions on how to apply the patch from comment #2 ?

Or are there any chances it will be applied in a way that the proprietary driver manager will find the (patched) 304.137 driver again?

(the alleged patch on if-not-true-then-false seems to be something entirely different. I downloaded the patched driver there, and it fails with same 3 error messages)

summary: nvidia-graphics-drivers-304 304.137-0ubuntu2 ADT test failure with linux
- 4.15.0-1.2
+ 4.15.0-1.2 [error: implicit declaration of function ‘init_timer’]
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: nvidia-graphics-drivers-304 304.137-0ubuntu2 ADT test failure with linux 4.15.0-1.2 [error: implicit declaration of function ‘init_timer’]

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nvidia-graphics-drivers-340 (Ubuntu):
status: New → Confirmed
Revision history for this message
Andy Dufresne (adufray) wrote :

@jfrantzius and others, I wrote a quick blog post to document the steps required to apply Seth's wonderful patch:

https://adufray.com/blog/2018/06/02/nvidia-304-127-on-bionic

Hope that helps.

Thank you for your efforts, Seth! It is a shame this patch and package will not longer be included in the PPA; it seems they've marked the other bug as Won't Fix. This driver version is the latest available for my aging GeForce 7300 GT.

Revision history for this message
Bill Miller (wbmilleriii) wrote :

I really appreciate your doing this. I am trying it right now and the patch process just stops. I looked at the combined patch file and it seems to end with an unterminated left parenthesis. Does the file end prematurely?

Revision history for this message
Bill Miller (wbmilleriii) wrote :

And, the build process failed with Unable to build the NVIDIA kernel module. Sigh.

Revision history for this message
Andy Dufresne (adufray) wrote :

When you say the patch process just stops, does it print out any kind of message? The patch should end with this line, which is just contextual information:

 static int nv_drm_load(

Revision history for this message
Bill Miller (wbmilleriii) wrote :

With offline help from @audfray I got this to work. Really appreciate the help.

Revision history for this message
iGadget (igadget) wrote :

So even while this bug has been known to exist for more than half a year, it still managed to slip into the automatic updates of an LTS (16.04) release: https://bugs.launchpad.net/bugs/1779687

Ouch.

I hope this doesn't mean systems with older nVidia cards are just out of luck?

Revision history for this message
teramind (soeren-w) wrote :

How to solve this? Is anyone working on it? Is it enough do downgrade the kernel?

Revision history for this message
Bill Miller (wbmilleriii) wrote :

Patch and compile the driver as explained in the link from comment #13

Revision history for this message
Attila K (attila-kilo) wrote :

Downgrading the kernel is sufficient too, aka if you boot with kernel version 4.13.0 through GRUB, and then remove everything related to 4.15.0, the driver will work fine.

There was a 340 issue with the 4.13 kernel update too back in January, and it was fixed in a couple of days (https://bugs.launchpad.net/bugs/1741671), I'm hopeful here too, as this affects a LTS release now...

Revision history for this message
iGadget (igadget) wrote :

I was hoping this would have been fixed with today's updates, as the xorg update mentioned something in the terms of 'prevent nvidia regression'. But alas, still need to manually boot kernel 4.13 to get beyond lightdm.

Revision history for this message
Benchrest (benchrest) wrote :

I think this bug describes my failure. I am using Linux Mint Cinnamon 18.3 w NVIDIA-340.104
Using the latest kernel at the time, 4.15.0-24 cinnamon crashes at boot. Also with 4.15.0-20, the kernel that comes with LM 19 and Ubuntu 18.04 I understand. I just tried the new 4.15.0-29 and have the same failure. I get a message in xorg.log that the nvidia driver failed to load, see the syslog for more error messages, but I find nothing there.

Works ok if I use the Nouveau driver or revert back to 4.13.0-45 and use the nvidia-340 driver. I am hesitant to go to the new LM 19 for this problem.

I am seeing conflicting information. The kernel inadvertently dropped support for nvidia-340 and will be fixed or support for nvidia-340 is being dropped permanently.

Can anyone comment on if this problem will be fixed or do I need to make other plans? Not trying to rush a fix just want to know if I wait if something will happen.
Rich

Revision history for this message
Bill Miller (wbmilleriii) wrote :

Not an authority, but I don't think it will be fixed. Patch and compile the driver as explained in the link from comment #13 and then use any kernel you like.

Revision history for this message
Jarno Suni (jarnos) wrote :

This bug started to show up in Xenial with linux-generic-hwe-16.04, and not just linux-generic-hwe-16.04-edge, as the former was updated to version 4.15.0.29.51 in xenial-security:

$ apt-cache policy linux-generic-hwe-16.04
linux-generic-hwe-16.04:
  Installed: 4.15.0.29.51
  Candidate: 4.15.0.29.51
  Version table:
 *** 4.15.0.29.51 500
        500 http://ubuntu.trumpetti.atm.tut.fi/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     4.13.0.45.64 500
        500 http://ubuntu.trumpetti.atm.tut.fi/ubuntu xenial-security/main amd64 Packages

Revision history for this message
Linard Verstraete (linardv) wrote :

I have hardware (nVidia GeForce 8400M GS) for a runtime test.
The card is supported upstream by the 340.x branch until 2019 [1].
The release notes of the latest released patch (340.107-0) seem to be mention that they resolved the problem [2].
The patch is available and packaged for Ubuntu, currently only for 18.10 "Cosmic Cuttlefish" [3].

To confirm, I ran Ubuntu 18.10 from the daily liveDVD [4], verified it ran linux-4.15.x, installed nvidia-340 340.107-0ubuntu1 and noted that it built successfully [5].

Anyone an idea who can make the "nvidia-340 340.107-0ubuntu1" package available affected versions:
* Ubuntu 16.04 LTS Xenial Xerus (HWE introduced kernel 4.15 there [6])
* Ubuntu 18.04 LTS Bionic Beaver (started on kernel 4.15)

Thanks,
Linard.

[1] http://nvidia.custhelp.com/app/answers/detail/a_id/3142
[2] http://www.nvidia.co.uk/download/driverResults.aspx/135245/en-uk
[3] https://launchpad.net/ubuntu/+source/nvidia-graphics-drivers-340/+publishinghistory
[4] http://cdimage.ubuntu.com/daily-live/current/
[5] See attachment to this bug report: "nvidia-340.1070-linux-4.15-install-log.txt"
[6] https://wiki.ubuntu.com/Kernel/Support?action=AttachFile&do=view&target=16.04.x+Ubuntu+Kernel+Support+Schedule.svg

Revision history for this message
Wouter Depuydt (narrenschip) wrote :

A 'backport' of "nvidia-340_340.106-0ubuntu3_amd64.deb" from Bionic should do the trick as this is fixed by NVidia in nvidia-340.106:
http://www.nvidia.com/Download/driverResults.aspx/130042/en-us
"Release Highlights: Fixed a compatibility problem between the nvidia.ko's Page Attribute Table (PAT) support and the kernel Page Table Isolation (PTI) patches."

Forcing the installation of "nvidia-340_340.106-0ubuntu3_amd64.deb" from Bionic on Xenial seems to work:
  sudo dpkg -i --force-depends nvidia-340_340.106-0ubuntu3_amd64.deb
This then needs a little massaging:
  sudo ln -s /usr/lib/nvidia-340/xorg /etc/alternatives/x86_64-linux-gnu_xorg_extra_modules
  sudo ln -s /etc/alternatives/x86_64-linux-gnu_xorg_extra_modules /usr/lib/x86_64-linux-gnu/xorg/extra-modules
And commenting out
  ModulePath "/usr/lib/nvidia-340/xorg"
in /usr/share/X11/xorg.conf.d/nvidia-drm-outputclass-ubuntu.conf

Revision history for this message
Jim Kyle (jim-jimkyle) wrote :

I've encountered this bug on the past TWO kernel updates of my Xubuntu 16.04.4 (now .5) system that uses an Nvidia card. Initially I found that falling back to the previous kernel was a satisfactory workaround. This morning, I tried using the "Additional drivers" system setting to change from the Nvidia driver to the noveau driver -- and that has worked perfectly so far. This might be a possible recommended solution. I had originally switched from noveau to the proprietary driver because noveau didn't work properly, but that was several years ago and it has obviously gotten much metter!

Revision history for this message
Jim Kyle (jim-jimkyle) wrote :

s/metter/better/!!!

Revision history for this message
Chugajstyr (chugajstyr) wrote :

I've got same issue on Linux Mint 18.3 x86_64 (Ubuntu 16.04 based) with nvidia-340 "340.104-0ubuntu0.16.04.1", and for me very helps debdiff patch of Seth Forshee from this bug report: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-340/+bug/1737751. I also forced to find and add another one patch for kernel 4.14, because it is not exist anymore in current nvidia-340 sources, but mentioned in Seth patch.

So, I saw 2 ways to fix current nvidia driver for Ubuntu 16.04 v.340.104:
1) quick
  1.1) use chunks from Seth patch to fix nvidia sources right in DKMS directory /usr/src/nvidia-340-340.104/ (if you got error from this topic, you already have them there),
  1.2) build & install nvidia kernel module with DKMS.

2) longer, but you've got ready-to-use nvidia deb-packages.
  2.1) fix nvidia source deb-packages with modified Seth's debdiff patch
  2.2) rebuild nvidia deb-packages, purge original & install rebuilded ones

I used second way, now I have working nvidia-340 driver with 4.15 kernel.
Also, after installing rebuilded packages, nvidia module not loaded, even manually - I got error "modprobe: ERROR: could not insert 'nvidia_340': No such device" - I forced to remove loaded module "nouveau", load "nvidia-340", then rebuild initrd image.

Revision history for this message
Chugajstyr (chugajstyr) wrote :
Revision history for this message
Chugajstyr (chugajstyr) wrote :
Revision history for this message
wally (xxsjsxx) wrote :

As others report, this has now happened with two attempted updates to kernel 4.15.
In one case the updater reported errors as it tried to load the update but then improperly ignored the errors and the update - known to be wrong - was then finalized and grub was updated to use the known wrong files.
Why put out the error notification if it is then ignored?

Revision history for this message
Eggsome (eggsome) wrote :

I thought the whole point of an LTS release is that nothing major breaks?
Really disappointing to do an apt-get update and break my laptop :(
I have a GeForce 310M and this is the only supported driver.
What is the likelihood that the patch from comment #2 will make it into the mainstream patch cycle for 16.04 repositories?

Revision history for this message
iGadget (igadget) wrote :

And again with today's updates. 8 months and still no fix. What a mess.

Revision history for this message
Eggsome (eggsome) wrote :

Is there a bug bounty somewhere that I can contribute to?

Revision history for this message
Hans P. Möller (hmollercl) wrote :

The problem here is that nvidia drop maintining 304.x, so they will not update the 304 driver with the kernel 4.15 standard. Currently there are some patches that fix the issue but in the future we don't know.
Remember that nvidia304 is propietary and thus w/o nvidia there is no much we can make but pinning the Kernel so it doesn't update to 4.15 or above.

The other option is to use noveau and help the fix the issues they currently have with this chips.

Revision history for this message
Hans P. Möller (hmollercl) wrote :

Here is nvidia release info for the latest driver 304.137 released in 2017-9-19:
https://www.nvidia.com/Download/driverResults.aspx/123709/en-us
Last bullet in "release highlights says:
"Removed support for checking for and downloading updated driver packages and precompiled kernel interfaces from nvidia-installer. This functionality was limited to unencrypted ftp and http, and was implemented using code that is no longer actively maintained."

Revision history for this message
Jarno Suni (jarnos) wrote :

Bugs of nvidia-340 have been marked as duplicate of this bug. Should they be separated?

Revision history for this message
Benchrest (benchrest) wrote :

While it is true that nvidia dropped support for 304 ( and maybe 340) the existing level of 304 and 340 work fine, so why not include in 4.15 as is? 4.15 is a requirement for the latest Ubuntu and Linux Mint releases so this prevents otherwise good computers from upgrading.
Further if I upgrade my computer to a new graphics card, how to if that card will not be obsolete next year.

Revision history for this message
Jarno Suni (jarnos) wrote :

I used nvidia-bug-report.sh to report this bug to nvidia. (I had to email to an address reported by the script.)

Release highlights for the 340 driver:
https://www.nvidia.com/Download/driverResults.aspx/135161/en-us
" The 340.xx legacy Unified Memory kernel module is incompatible with recent Linux kernels, and the GPU hardware generations that the 340.xx legacy driver series is intended to support do not support Unified Memory."

tags: added: xenial
summary: - nvidia-graphics-drivers-304 304.137-0ubuntu2 ADT test failure with linux
- 4.15.0-1.2 [error: implicit declaration of function ‘init_timer’]
+ nvidia-graphics-drivers fail to build [error: implicit declaration of
+ function ‘init_timer’]
Revision history for this message
Hans P. Möller (hmollercl) wrote :

For those who wants to participate
Call For Testing: Ubuntu with nVIDIA graphic cards
https://discourse.ubuntu.com/t/call-for-testing-ubuntu-with-nvidia-graphic-cards/7774

Revision history for this message
Pawel (alama1psa) wrote :

There is a chance for fixing this (nvidia-340) or it is a lost case?

Revision history for this message
Max (m-gorodok) wrote :

With the attached patch nvidia-340.104 module may be build with both kernels linux-generic-hwe-16.04 4.15.0 and linux-generic 4.4.0

Tested on "VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2) (prog-if 00 [VGA controller])" (GeForce 210 0x0A65)

It should fix nv_drm_init/exit issues

/var/lib/dkms/nvidia-340/340.104/build/nv-drm.c: In function ‘nv_drm_init’:
/var/lib/dkms/nvidia-340/340.104/build/nv-drm.c:176:11: error: implicit declaration of function ‘drm_pci_init’ [-Werror=implicit-function-declaration]
     ret = drm_pci_init(&nv_drm_driver, pci_driver);
           ^
/var/lib/dkms/nvidia-340/340.104/build/nv-drm.c: In function ‘nv_drm_exit’:
/var/lib/dkms/nvidia-340/340.104/build/nv-drm.c:186:5: error: implicit declaration of function ‘drm_pci_exit’ [-Werror=implicit-function-declaration]
     drm_pci_exit(&nv_drm_driver, pci_driver);

and compile errors related to timers

/var/lib/dkms/nvidia-340/340.104/build/nv.c: In function ‘nv_start_rc_timer’:
/var/lib/dkms/nvidia-340/340.104/build/nv.c:2407:5: error: implicit declaration of function ‘init_timer’ [-Werror=implicit-function-declaration]
     init_timer(&nvl->rc_timer);
     ^
/var/lib/dkms/nvidia-340/340.104/build/nv.c:2408:28: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
     nvl->rc_timer.function = nvidia_rc_timer;
                            ^
/var/lib/dkms/nvidia-340/340.104/build/nv.c:2409:18: error: ‘struct timer_list’ has no member named ‘data’
     nvl->rc_timer.data = (unsigned long) nvl;
                  ^

Revision history for this message
Max (m-gorodok) wrote :

DKMS patch to compile nvidia-340.104 for 4.15 kernel that should be more convenient to read than debdiff. It is based on other sources mentioned in comments to this bug.

Revision history for this message
iGadget (igadget) wrote :

I ran into this bug *again* with today's updates and STILL need to boot the 4.13 kernel to get into my system. Could someone *pretty please* apply the patches Max proposed? Thank you!

Revision history for this message
iGadget (igadget) wrote :

I'm done with this. Took out the nVidia card today, only to run into the same old performance problems (i.e. no smooth video playback) with the i915 driver (which were the initial reasons to switch to nVidia). Even without the card, I'm still running into this bug. Guess I have to manually remove the nVidia drivers as well. What a mess. AMD here I come.

Revision history for this message
Modestas (montvid) wrote :

Hi dear Xenial ubuntu 16.04 LTS maintainers. You broke Nvidia drivers with hwe kernel 4.15. AS it is a LTE please stop wasting time on bug fixing and just import the debian strech stable packages that are fixed for kernel 4.15 and above. see:
https://metadata.ftp-master.debian.org/changelogs//non-free/n/nvidia-graphics-drivers-legacy-304xx/nvidia-graphics-drivers-legacy-304xx_304.137-0~deb8u1_changelog

* Add timer.patch to fix kernel module build on Linux 4.15 and newer (304.137-4).

https://packages.debian.org/jessie/nvidia-legacy-304xx-driver

Pretty please!!!

Revision history for this message
jfrantzius (jfrantzius) wrote :

@Andy Dufresne (adufray): thank you very much for the great description of how to apply Seth's patch, and of course, thank you very much Seth Forshee for providing the patch!

For anybody else so far left in the dust with a deceased nvidia-304 driver: rejoice, and just follow the perfectly working instructions in https://adufray.com/blog/2018/06/02/nvidia-304-127-on-bionic to save your computer from becoming electrical waste.

Revision history for this message
jfrantzius (jfrantzius) wrote :

... but do not upgrade to Ubuntu 18.10, as its XServer comes with a new ABI version that nvidia-304 refuses to work with, and ignoring ABI incompatibility screws up the display (at least with my Geforce Go 7600). I guess this won't be possible to patch without NVidia themselves releasing a new version of the driver (which they won't).

So, alas, with the above patch, 18.04 finally seems to be the last version you will be able to run nvidia-304 with.

Revision history for this message
Jarno Suni (jarnos) wrote :

3Wouter Depuydt, would the same work for 340.107-0ubuntu0.18.04.1? Doesn't apt report about broken dependencies later?

Revision history for this message
Jarno Suni (jarnos) wrote :

Max, how does end user apply the patches?

Revision history for this message
Jarno Suni (jarnos) wrote :

nvidia-340 from bionic-updates seems to work with linux 4.18.0-13-generic installed as a dependency of package linux-generic-hwe-18.04. It didn't work with 4.15.0-43-generic last time I tried. Even with the newer kernel there is Bug #1811402.

Changed in nvidia-graphics-drivers-340 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Juan López Egea (reaversword3d) wrote :

Dear Seth, thanks for your incredible work.

Driver 304 installs perfectly, and everything points its effectively nvidia driver the one is working.

But there is still some problems, not related with the driver itself, but with -I dare to guess-, probably simlinks and where Ubuntu is looking for some things.

For example, if you open VLC and try to play a video, it tells you is impossible to reach h264 decoder. If you switch back to nouveau, it works (but system is incredibly unstable). Then just reinstall nvidia driver and stop working.

I've observed same behaviour using python kivy (in Geany & VsCode), sometimes is impossible to find a Window where show kivy widgets, sometimes not, not very sure about when it works and when not.

Probably, your work is done and pretty well done, I'd love to help you with this little details, but unfortunately, I have no deep knowledge about all this. I've researched, believe me, but no luck.

Please, if someone haves the knowledge and abilities to finish the work and help Seth, go on!.

Revision history for this message
Bill Miller (wbmilleriii) wrote :

Word to the wise:

If you successfully compiled the driver, don't update your 18.04 system to the HWE stack. The driver didn't seem to work with the kernel from 18.10

Revision history for this message
Jeff (jaguar07-9) wrote :

Seth thank you for the work you have done and are doing on this. Andy of post 13, thank you for the walk through on your web site. I was about to patch and install for my Geforce 7900 GS on Mint 19.1 using the 4.15.xxx kernel using Andy's guide, successfully.

Revision history for this message
jairud (jairud) wrote :

Hi.

I'm following adufray's instructions (https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-304/+bug/1737750/comments/13), but the module load seems to fail because the module signature is not right.

With dmesg i found:
 PKCS#7 signature not signed with a trusted key
[ 13.580416] nvidia: loading out-of-tree module taints kernel.
[ 13.580422] nvidia: module license 'NVIDIA' taints kernel.
[ 13.580423] Disabling lock debugging due to kernel taint
[ 13.589541] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[ 13.599431] PCI Interrupt Link [LMC9] enabled at IRQ 21
[ 13.599459] nvidia 0000:00:0d.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
[ 13.600203] [drm] Initialized nvidia-drm 0.0.0 20150116 for 0000:00:0d.0 on minor 0
[ 13.600231] NVRM: loading NVIDIA UNIX x86_64 Kernel Module 304.137 Thu Sep 14 13:51:03 PDT 2017

The command 'lshw -c video 2>&1 | grep driver' gave me "configuración: driver=nvidia latency=0"

My graphics card identification is:
00:0d.0 VGA compatible controller: NVIDIA Corporation C61 [GeForce 7025 / nForce 630a] (rev a2)

I can't find how to disable this validation.
This system doesn't user EFI.
Whe I run 'sudo mokutil --disable-validation' it returns
"EFI variables are not supported on this system"

Revision history for this message
Wolf (drechsel) wrote :

Hello,

yesterday I tried to compile the nvidia-304 on my bionic "business"
laptop, which does not work with nvidia-340 and suffers from some flaws
with nouveau.

I kept to your instructions as good as I could, but compiling failed.
Would you mind having a look at the log attached?

To post a comment you must log in.