Installation of Nvidia driver 304.317 on Lubuntu 16.04/18.04 failed

5,430

I would strongly recommend you use the ubuntu-drivers tool instead. It is safer and will install the suitable NVIDIA or nouveau driver for your card.

However, you need to clean up and purge the current NVIDIA driver first by running the following in the terminal:

sudo apt purge nvidia-*

Then you can run the tool in the terminal like this:

sudo ubuntu-drivers autoinstall

Reboot your system after that for the changes to take effect.

Notice:

304.* is no longer supported by NVIDIA and no releases are available for newer kernels sudo ubuntu-drivers autoinstall will install the nouveau driver which I think should have good enough support for such an old GPU.

If ,however, you must do it the way you describe in your question. You might need to take a look at your BIOS settings and disable secure boot. source

An alternate option is to go back to Ubuntu 16.04:

If you chose to do so, you may want to enable the restricted Ubuntu repository. You can do this from the software and updates options in the GUI or add the repository in the terminal as follows:

echo "deb http://security.ubuntu.com/ubuntu xenial-security main restricted" | sudo tee -a  /etc/apt/sources.list

After that update the apt packages list:

sudo apt update

Then install the driver like so:

sudo ubuntu-drivers autoinstall

or

sudo apt install nvidia-304

or

Get the package at nvidia-304_304.135-0ubuntu0.16.04.1_amd64

Share:
5,430
bestucki
Author by

bestucki

Updated on September 18, 2022

Comments

  • bestucki
    bestucki over 1 year

    I tried to install the Nvidia driver 304.317 according this post: Can't install Nvidia drivers on Ubuntu 18.04

    During installation, several errors occurred:

    Error message 1:

    ERROR: Failed to run '/usr/sbin/dkms build -m nvidia -v 304.137 -k 5.0.0-23-generic':
    Kernel preparation unnecessary for this kernel. Skipping ...
    Building module:
    cleaning build area...
    make -j2 KERNELRELEASE=5.0.0-23-generic module SYSSRC=/lib/modules/5.0.0-23-generic/build...................(bad exit status: 2)
    ERROR (dkms apport): binary package for nvidia: 304.137 not found
    Error! Bad return status for module build on kernel: 5.0.0-23-generic (i686)
    Consult /var/lib/dkms/nvidia/304.137/build/make.log for more information.
    

    Error message 2:

    ERROR: Failed to install the kernel module through DKMS.
    No kernel module was installed: please try to installing again without DKMS, or check the DKMS logs for more information.
    

    Error message 3:

    ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log for details.
    You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.
    

    nvidia-installer.log

    nvidia-installer log file '/var/log/nvidia-installer.log'
    creation time: Sat Aug 10 21:13:58 2019
    installer version: 304.137
    
    PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
    
    nvidia-installer command line:
        ./nvidia-installer
    
    Unable to load: nvidia-installer ncurses v6 user interface
    
    Using: nvidia-installer ncurses user interface
    -> License accepted.
    -> Installing NVIDIA driver version 304.137.
    -> Running distribution scripts
       executing: '/usr/lib/nvidia/pre-install'...
    -> done.
    -> The distribution-provided pre-install script failed!  Continue installation anyway? (Answer: Yes)
    -> Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later. (Answer: Yes)
    -> Installing both new and classic TLS OpenGL libraries.
    -> Searching for conflicting X files:
    -> done.
    -> Searching for conflicting OpenGL files:
    -> done.
    -> Installing 'NVIDIA Accelerated Graphics Driver for Linux-x86' (304.137):
       executing: '/sbin/ldconfig'...
       executing: '/sbin/depmod -aq'...
       depmod: WARNING: Ignored deprecated option -q
    -> done.
    -> Driver file installation is complete.
    -> Installing DKMS kernel module:
    ERROR: Failed to run `/usr/sbin/dkms build -m nvidia -v 304.137 -k 5.0.0-23-generic`: 
    Kernel preparation unnecessary for this kernel.  Skipping...
    
    Building module:
    cleaning build area...
    make -j2 KERNELRELEASE=5.0.0-23-generic module SYSSRC=/lib/modules/5.0.0-23-generic/build...................(bad exit status: 2)
    ERROR (dkms apport): binary package for nvidia: 304.137 not found
    Error! Bad return status for module build on kernel: 5.0.0-23-generic (i686)
    Consult /var/lib/dkms/nvidia/304.137/build/make.log for more information.
    -> error.
    ERROR: Failed to install the kernel module through DKMS. No kernel module was installed; please try installing again without DKMS, or check the DKMS logs for more information.
    ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.  You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.
    

    make.log

    DKMS make.log for nvidia-304.137 for kernel 5.0.0-23-generic (i686)
    Sa 10. Aug 21:14:49 CEST 2019
    NVIDIA: calling KBUILD...
    Makefile:223: ================= WARNING ================
    Makefile:224: 'SUBDIRS' will be removed after Linux 5.3
    Makefile:225: Please use 'M=' or 'KBUILD_EXTMOD' instead
    Makefile:226: ==========================================
    test -e include/generated/autoconf.h -a -e include/config/auto.conf || (        \
    echo >&2;                           \
    echo >&2 "  ERROR: Kernel configuration is invalid.";       \
    echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
    echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
    echo >&2 ;                          \
    /bin/false)
    mkdir -p /var/lib/dkms/nvidia/304.137/build/.tmp_versions ; rm -f /var/lib/dkms/nvidia/304.137/build/.tmp_versions/*
    make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia/304.137/build
    (cat /dev/null;   echo kernel//var/lib/dkms/nvidia/304.137/build/nvidia.ko;) > /var/lib/dkms/nvidia/304.137/build/modules.order
    [several compiler calls]
      cc -Wp,-MD,/var/lib/dkms/nvidia/304.137/build/.os-interface.o.d  -nostdinc -isystem /usr/lib/gcc/i686-linux-gnu/7/include  -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -Iubuntu/include  -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror-implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m32 -msoft-float -mregparm=3 -freg-struct-return -fno-pic -mpreferred-stack-boundary=2 -march=i686 -mtune=generic -Wa,-mtune=generic32 -ffreestanding -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -I/var/lib/dkms/nvidia/304.137/build -Wall -MD -Wsign-compare -Wno-cast-qual -Wno-error -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"304.137\" -Wno-unused-function -Wuninitialized -UDEBUG -U_DEBUG -DNDEBUG  -DMODULE  -DKBUILD_BASENAME='"os_interface"' -DKBUILD_MODNAME='"nvidia"' -c -o /var/lib/dkms/nvidia/304.137/build/os-interface.o /var/lib/dkms/nvidia/304.137/build/os-interface.c
    [several compiler warnings -Wsign-compare]
    /var/lib/dkms/nvidia/304.137/build/os-interface.c: In function ‘os_get_current_time’:
    /var/lib/dkms/nvidia/304.137/build/os-interface.c:667:5: error: implicit declaration of function ‘do_gettimeofday’; did you mean ‘efi_gettimeofday’? [-Werror=implicit-function-declaration]
         do_gettimeofday(&tm);
         ^~~~~~~~~~~~~~~
         efi_gettimeofday
    [several compiler calls]
    Makefile:1606: recipe for target '_module_/var/lib/dkms/nvidia/304.137/build' failed
    make[2]: *** [_module_/var/lib/dkms/nvidia/304.137/build] Error 2
    NVIDIA: left KBUILD.
    nvidia.ko failed to build!
    Makefile:262: recipe for target 'module' failed
    make[1]: *** [module] Error 1
    makefile:59: recipe for target 'module' failed
    make: *** [module] Error 2
    

    I tried to install the driver without dkms, but I had the same problem. The readme from nvidia couldn't help me out. Any suggestions?

    EDIT:

    I set up 16.04 (which I had installed before my HDD crashed) and have the same problem. Doesn't matter if I install it with ubuntu-dirivers autoinstall, apt-get install nvidia-304 or fully manual. Also if I try to install the previous version 304.135 (actual is 304.137). Before my HDD crashed, I had version 304.134 (because 304.135 made some problems) but it seems this version isn't in the repository any more. The nouveau driver works fine (with 16.04 and 18.04), even with a second screen, but the performance is miserable.

    Update

    After several test and attempts on both Lubuntu versions (16.04 and 18.04) and different nvidia-304 versions, I think the problem is the used compiler version which should be gcc-4.6 (can't find the link any more), 16.04 uses gcc-5.0, 18.04 uses gcc-7.4. I give up to install the proprietary driver due to high effort.
    While my research, I recognized, the nouveau driver was never installed on the system. ubuntu-drivers autoinstall won't install the nouveau driver. I installed manually (on 18.04) with apt-get install xserver-xorg-video-nouveau, following packages were removed and the system was broken after installation:

    lubuntu-desktop lubuntu-gtk-core lubuntu-gtk-desktop
    xserver-xorg-core-hwe-18.04 xserver-xorg-input-all-hwe-18.04
    xserver-xorg-input-libinput-hwe-18.04 xserver-xorg-input-synaptics-hwe-18.04
    xserver-xorg-video-all-hwe-18.04 xserver-xorg-video-amdgpu-hwe-18.04
    xserver-xorg-video-ati-hwe-18.04 xserver-xorg-video-fbdev-hwe-18.04
    xserver-xorg-video-intel-hwe-18.04 xserver-xorg-video-nouveau-hwe-18.04
    xserver-xorg-video-qxl-hwe-18.04 xserver-xorg-video-radeon-hwe-18.04
    xserver-xorg-video-vesa-hwe-18.04 xserver-xorg-video-vmware-hwe-18.04
    
    • guiverc
      guiverc over 4 years
      This is just a comment, Lubuntu 16.04 LTS is EOL as it is a flavor with only 3 years of support. The 5 years of support for 16.04 LTS applies to standard Unity desktop, Kylin & server (no desktop). The last official Lubuntu release statement is lubuntu.me/xenial-5-released which notes support ends April 2019.
  • bestucki
    bestucki over 4 years
    ubuntu-drivers doesn't work in this case, because nvidia-304 is not supported by 18.04. I have an old notebook without secure boot.
  • Raffa
    Raffa over 4 years
    It is no longer supported by NVIDIA nvidia.custhelp.com/app/answers/detail/a_id/3142/~/… and no releases available for newer kernels sudo ubuntu-drivers autoinstall will install the nouveau driver which I think should have good enough support for such an old GPU. Best of luck
  • bestucki
    bestucki over 4 years
    sudo ubuntu-drivers autoinstall tries to install nvidia-304, but fails because of dependencies. nouveau is installed automatically after setting up Lubuntu.
  • Raffa
    Raffa over 4 years
    @bestucki I added instructions for Ubuntu 16.04. Please have a look.