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

Bug #1737750 reported by Seth Forshee on 2017-12-12
262
This bug affects 61 people
Affects Status Importance Assigned to Milestone
nvidia-graphics-drivers-304 (Ubuntu)
Medium
Seth Forshee
nvidia-graphics-drivers-340 (Ubuntu)
Undecided
Unassigned
Seth Forshee (sforshee) wrote :
tags: added: kernel-adt-failure
Seth Forshee (sforshee) wrote :
Changed in nvidia-graphics-drivers-304 (Ubuntu):
assignee: nobody → Seth Forshee (sforshee)
importance: Undecided → Medium
status: New → In Progress
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
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!

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.

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.

matt r. (triplr) wrote :

build reject for this patch in the driver

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/

Ricardo Almeida (ric-almeida) wrote :

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

Bill Miller (wbmilleriii) wrote :

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

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’]

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

Changed in nvidia-graphics-drivers-340 (Ubuntu):
status: New → Confirmed
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.

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?

Bill Miller (wbmilleriii) wrote :

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

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(

Bill Miller (wbmilleriii) wrote :

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

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?

teramind (soeren-w) wrote :

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

Bill Miller (wbmilleriii) wrote :

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

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...

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.

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

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.

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

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

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

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!

Jim Kyle (jim-jimkyle) wrote :

s/metter/better/!!!

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.

Chugajstyr (chugajstyr) wrote :
Chugajstyr (chugajstyr) wrote :
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?

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?

iGadget (igadget) wrote :

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

Eggsome (eggsome) wrote :

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

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.

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."

Jarno Suni (jarnos) wrote :

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

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.

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’]
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

Pawel (alama1psa) wrote :

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

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;
                  ^

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.

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!

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.

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!!!

To post a comment you must log in.