How to install the latest linux kernel (mainline) in Ubuntu (17.10) distro

Sometimes we need to install the latest kernel version of our linux distro (btw it is called “mainline” if you need to google something about it)! Whether we need the latest driver, because we bought a new laptop released for the first time last month with the latest hardware or there is a hot fix of some nasty bug it is of no matter. Here are the steps (and some troubleshooting) about installing the latest kernel to our Ubuntu install 17.10 (with old versions like 16, 15 and 14 should be the same):

  • STEP 1 is to choose our desired kernel from

    http://kernel.ubuntu.com/~kernel-ppa/mainline/

    Open this address in your favorite browser and choose the latest. In our example the latest kernel, which is no release candidate, 4.14.15. Enter the directory

    http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15.1/

    and choose your build, for example amd64 for your 64bit setup (and for most cases choose -generic- one)

    mkdir /root/latestkernel
    cd /root/latestkernel
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15.1/linux-headers-4.15.1-041501_4.15.1-041501.201802031831_all.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15.1/linux-headers-4.15.1-041501-generic_4.15.1-041501.201802031831_amd64.deb
    wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15.1/linux-image-4.15.1-041501-generic_4.15.1-041501.201802031831_amd64.deb
    
  • STEP 2 after successfully downloading the 3 files just install them with “dpkg” (the package manager tool)
    sudo dpkg -i linux-headers-4.15.1*.deb linux-image-4.15.1*.deb
    
  • STEP 3 is just to reboot your machine, the installation setup did everything you needed to load this kernel
    reboot
    

    STEP 4 Verification of running the latest kernel

    root@srv:~# uname -a
    Linux srv.local 4.15.1-041501-generic #201802031831 SMP Sat Feb 3 18:32:13 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    

Install log of the procedure (your output may vary depending on your hardware installed in your system):

root@srv:~/latestkernel# sudo dpkg -i linux-headers-4.15.1*.deb linux-image-4.15.1*.deb
Selecting previously unselected package linux-headers-4.15.1-041501.
(Reading database ... 200430 files and directories currently installed.)
Preparing to unpack linux-headers-4.15.1-041501_4.15.1-041501.201802031831_all.deb ...
Unpacking linux-headers-4.15.1-041501 (4.15.1-041501.201802031831) ...
Selecting previously unselected package linux-headers-4.15.1-041501-generic.
Preparing to unpack linux-headers-4.15.1-041501-generic_4.15.1-041501.201802031831_amd64.deb ...
Unpacking linux-headers-4.15.1-041501-generic (4.15.1-041501.201802031831) ...
Selecting previously unselected package linux-image-4.15.1-041501-generic.
Preparing to unpack linux-image-4.15.1-041501-generic_4.15.1-041501.201802031831_amd64.deb ...
Examining /etc/kernel/preinst.d/
run-parts: executing /etc/kernel/preinst.d/intel-microcode 4.15.1-041501-generic /boot/vmlinuz-4.15.1-041501-generic
Done.
Unpacking linux-image-4.15.1-041501-generic (4.15.1-041501.201802031831) ...
Setting up linux-headers-4.15.1-041501 (4.15.1-041501.201802031831) ...
Setting up linux-headers-4.15.1-041501-generic (4.15.1-041501.201802031831) ...                                                                                             
Setting up linux-image-4.15.1-041501-generic (4.15.1-041501.201802031831) ...                                                                                               
Running depmod.                                                                                                                                                             
update-initramfs: deferring update (hook will be called later)                                                                                                              
Examining /etc/kernel/postinst.d.                                                                                                                                           
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.15.1-041501-generic /boot/vmlinuz-4.15.1-041501-generic                                                      
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.15.1-041501-generic /boot/vmlinuz-4.15.1-041501-generic                                                       
update-initramfs: Generating /boot/initrd.img-4.15.1-041501-generic                                                                                                         
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.15.1-041501-generic /boot/vmlinuz-4.15.1-041501-generic                                                   
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.15.1-041501-generic /boot/vmlinuz-4.15.1-041501-generic                                                       
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.15.1-041501-generic /boot/vmlinuz-4.15.1-041501-generic                                                        
Generating grub configuration file ...                                                                                                                                      
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.                                                                   
Found linux image: /boot/vmlinuz-4.15.1-041501-generic                                                                                                                      
Found initrd image: /boot/initrd.img-4.15.1-041501-generic                                                                                                                  
Found linux image: /boot/vmlinuz-4.14.15-041415-generic                                                                                                                     
Found initrd image: /boot/initrd.img-4.14.15-041415-generic                                                                                                                 
Found linux image: /boot/vmlinuz-4.13.0-32-generic
Found initrd image: /boot/initrd.img-4.13.0-32-generic
Found linux image: /boot/vmlinuz-4.13.0-21-generic
Found initrd image: /boot/initrd.img-4.13.0-21-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
root@srv:~/latestkernel#

Ryzen Threadripper kernel problems with PCIe – wifi, network, video problems

If you have Ryzen Threadripper (in my case 1950X) and Ubuntu 17.10 (because the others versions do not boot at all!) with the latest kernel 4.15.x and the default vmlinuz-4.13.0-21-generic you might experience frequently wifi, network cards and video cards problems like wifi disconnects and network cards lost connections and some kind of freezes for a second or two of the video! If you have Ryzen Threadripper 1950X and or ASUS ROG ZENITH EXTREME (or any other motherboard with the chipset AMD X399) and ubuntu 17.10 or probably any linux distro with any kernel you might experience really unstable system. Look at your dmesg and if you see something like

[   18.669950] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[   18.669966] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[   18.669970] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[   18.669973] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[   18.669975] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[   23.805640] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[   23.805664] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[   23.805669] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[   23.805674] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[   23.805678] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[   23.838698] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[   23.838716] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[   23.838720] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[   23.838725] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[   23.838728] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[   36.124101] atlantic: link change old 0 new 100
[   36.124222] IPv6: ADDRCONF(NETDEV_CHANGE): enp65s0: link becomes ready
[   52.294413] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[   52.294436] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[   52.294441] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[   52.294446] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[   52.294449] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[   53.275256] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[   53.275289] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[   53.275293] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[   53.275298] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[   53.275301] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[   53.418493] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[   53.418517] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[   53.418522] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[   53.418527] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[   53.418530] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[   53.649938] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[   53.649962] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[   53.649967] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[   53.649972] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[   53.649975] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[  113.294411] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[  113.294434] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[  113.294439] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[  113.294444] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000040/00006000
[  113.294450] pcieport 0000:00:01.1:    [ 6] Bad TLP               
[  265.469397] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[  265.469419] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[  265.469424] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Transmitter ID)
[  265.469429] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00001000/00006000
[  265.469438] pcieport 0000:00:01.1:    [12] Replay Timer Timeout  
[  533.031982] dpc 0000:00:01.1:pcie010: DPC containment event, status:0x1f00 source:0x0000
[  533.032004] pcieport 0000:00:01.1: AER: Corrected error received: id=0000
[  533.032009] pcieport 0000:00:01.1: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0009(Receiver ID)
[  533.032014] pcieport 0000:00:01.1:   device [1022:1453] error status/mask=00000080/00006000
[  533.032022] pcieport 0000:00:01.1:    [ 7] Bad DLLP      

Apparently everything on the pci express could be affected! So till the kernel team fixes the issues, you can use the following workaround: add to the kernel boot parameters

pcie_aspm=off

Under Ubuntu you can add in the file

/etc/default/grub

the following line

GRUB_CMDLINE_LINUX="pcie_aspm=off"

And then execute

update-grub

the changes to take effect in the grub configuration. Then reboot the machine!

Under CentOS 7 the configuration file and the line to put are the same just the update of the grub configuration is different:

  • For UEFI-based systems execute:
    grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
    
  • For legacy-BIOS systems execute:
    grub2-mkconfig -o /boot/grub2/grub.cfg
    

*You should know what is your setup, probably UEFI-based, you could check in your boot directory, if there is /boot/efi/EFI/centos/grub.cfg you probably should use the option for UEFI-based, if you do not have any “efi” directory under “/boot” use the second option for legacy-BIOS.
Then reboot the machine!

xmr-stak GPU disabled after kernel or driver updated

Sometime when the user upgrades the kernel or the graphic card driver (NVIDIA or ATI) under Ubuntu (it is essentially the same with the other distros) we may encounter errors with xmr-stak and even not to be able to use our graphic card for mining!
Here we have an UBUNTU 17.10.1 and when we updated the kernel to the latest our mining xmr-stak software stopped using the NVIDIA card:

-------------------------------------------------------------------
[2018-02-16 12:17:11] : Start mining: MONERO
WARNING: NVIDIA Insufficient driver!
WARNING: NVIDIA no device found
[2018-02-16 12:17:11] : WARNING: backend NVIDIA disabled.
[2018-02-16 12:17:11] : WARNING: UNKNOWN_ERROR when calling clGetPlatformIDs for number of platforms.
[2018-02-16 12:17:11] : WARNING: No OpenCL platform found.
[2018-02-16 12:17:11] : WARNING: No AMD OpenCL platform found. Possible driver issues or wrong vendor driver.
[2018-02-16 12:17:11] : WARNING: backend AMD disabled.
[2018-02-16 12:17:11] : Starting 1x thread, affinity: 0.
[2018-02-16 12:17:11] : hwloc: memory pinned

As you can see the NVIDIA backend is disabled! In fact the driver seemed OK and loaded and even the X was working.
So in such a situation just reinstall the NVIDIA driver and install the software dependecies for the mining xmr-software (detailed explanation here)
Here what you can do:

sudo apt-get purge nvidia-*
sudo apt-get -y install libboost-all-dev libleveldb-dev libcurl4-openssl-dev libmicrohttpd-dev libminiupnpc-dev libgmp-dev  cuda nvidia-opencl-dev libmicrohttpd-dev libssl-dev cmake build-essential
sudo reboot

And you’ll have again an usable and properly installed GPU mining system.

Here is the log of the reinstallation, check it if you think you are going in the wrong direction, when purging the driver:

root@srv2:~/xmr-stak/build/bin# apt-get purge nvidia-*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bbswitch-dkms cuda-command-line-tools-9-1 cuda-compiler-9-1 cuda-cublas-9-1 cuda-cublas-dev-9-1 cuda-cudart-9-1 cuda-cudart-dev-9-1 cuda-cufft-9-1 cuda-cufft-dev-9-1
  cuda-cuobjdump-9-1 cuda-cupti-9-1 cuda-curand-9-1 cuda-curand-dev-9-1 cuda-cusolver-9-1 cuda-cusolver-dev-9-1 cuda-cusparse-9-1 cuda-cusparse-dev-9-1
  cuda-documentation-9-1 cuda-driver-dev-9-1 cuda-gdb-9-1 cuda-gpu-library-advisor-9-1 cuda-libraries-9-1 cuda-libraries-dev-9-1 cuda-license-9-1 cuda-memcheck-9-1
  cuda-misc-headers-9-1 cuda-npp-9-1 cuda-npp-dev-9-1 cuda-nsight-9-1 cuda-nvcc-9-1 cuda-nvdisasm-9-1 cuda-nvgraph-9-1 cuda-nvgraph-dev-9-1 cuda-nvml-dev-9-1
  cuda-nvprof-9-1 cuda-nvprune-9-1 cuda-nvrtc-9-1 cuda-nvrtc-dev-9-1 cuda-nvtx-9-1 cuda-nvvp-9-1 cuda-samples-9-1 cuda-toolkit-9-1 cuda-tools-9-1 cuda-visual-tools-9-1
  dkms freeglut3 freeglut3-dev lib32gcc1 libc6-i386 libglu1-mesa-dev libice-dev libsm-dev libvdpau1 libxi-dev libxmu-dev libxmu-headers libxnvctrl0 libxt-dev
  linux-headers-4.13.0-21 linux-headers-4.13.0-21-generic linux-image-4.13.0-21-generic linux-image-extra-4.13.0-21-generic linux-signed-image-4.13.0-21-generic
  linux-signed-image-4.13.0-31-generic mesa-vdpau-drivers nvidia-modprobe nvidia-prime nvidia-settings screen-resolution-extra vdpau-driver-all
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  cuda* cuda-9-1* cuda-demo-suite-9-1* cuda-drivers* cuda-runtime-9-1* libcuda1-390* nvidia-390* nvidia-390-dev* nvidia-opencl-icd-390*
0 upgraded, 0 newly installed, 9 to remove and 14 not upgraded.
After this operation, 369 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 311518 files and directories currently installed.)
Removing cuda (9.1.85-1) ...
Removing cuda-9-1 (9.1.85-1) ...
Removing cuda-demo-suite-9-1 (9.1.85-1) ...
Removing cuda-runtime-9-1 (9.1.85-1) ...
Removing cuda-drivers (390.12-1) ...
Removing libcuda1-390 (390.25-0ubuntu0~gpu17.10.1) ...
Removing nvidia-opencl-icd-390 (390.25-0ubuntu0~gpu17.10.1) ...
Removing nvidia-390-dev (390.25-0ubuntu0~gpu17.10.1) ...
Removing nvidia-390 (390.30-0ubuntu1) ...
Removing all DKMS Modules
Done.
update-alternatives: using /usr/lib/nvidia-390-prime/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390-prime/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390-prime/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390-prime/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_EGL.conf (i386-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/x86_64-linux-gnu/mesa-egl/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto mode
INFO:Disable nvidia-390
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.125ubuntu12) ...
update-initramfs: Generating /boot/initrd.img-4.15.3-041503-generic
cryptsetup: WARNING: target cryptswap1 has a random key, skipped
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
Processing triggers for man-db (2.7.6.1-2) ...
(Reading database ... 310876 files and directories currently installed.)
Purging configuration files for nvidia-opencl-icd-390 (390.25-0ubuntu0~gpu17.10.1) ...
Purging configuration files for nvidia-390 (390.30-0ubuntu1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.125ubuntu12) ...
update-initramfs: Generating /boot/initrd.img-4.15.3-041503-generic
cryptsetup: WARNING: target cryptswap1 has a random key, skipped
root@srv2:~/xmr-stak/build/bin# apt-get -y install libboost-all-dev libleveldb-dev libcurl4-openssl-dev libmicrohttpd-dev libminiupnpc-dev libgmp-dev  cuda nvidia-opencl-dev libmicrohttpd-dev libssl-dev cmake build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
cmake is already the newest version (3.9.1-1).
libgmp-dev is already the newest version (2:6.1.2+dfsg-1).
libleveldb-dev is already the newest version (1.20-1).
libboost-all-dev is already the newest version (1.62.0.1).
libmicrohttpd-dev is already the newest version (0.9.55-1).
nvidia-opencl-dev is already the newest version (8.0.61-1).
libcurl4-openssl-dev is already the newest version (7.55.1-1ubuntu2.3).
libminiupnpc-dev is already the newest version (1.9.20140610-4ubuntu1.1).
libssl-dev is already the newest version (1.0.2g-1ubuntu13.3).
The following packages were automatically installed and are no longer required:
  linux-headers-4.13.0-21 linux-headers-4.13.0-21-generic linux-image-4.13.0-21-generic linux-image-extra-4.13.0-21-generic linux-signed-image-4.13.0-21-generic
  linux-signed-image-4.13.0-31-generic
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  cuda cuda-9-1 cuda-demo-suite-9-1 cuda-drivers cuda-runtime-9-1 libcuda1-390 nvidia-390 nvidia-390-dev nvidia-opencl-icd-390
The following packages will be upgraded:
  nvidia-modprobe nvidia-settings
2 upgraded, 9 newly installed, 0 to remove and 12 not upgraded.
Need to get 3948 kB/88,1 MB of archives.
After this operation, 369 MB of additional disk space will be used.
Get:1 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64  cuda-runtime-9-1 9.1.85-1 [2534 B]
Get:2 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64  cuda-demo-suite-9-1 9.1.85-1 [3943 kB]
Get:3 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1704/x86_64  cuda-9-1 9.1.85-1 [2560 B]
Fetched 3948 kB in 3s (1003 kB/s)  
Selecting previously unselected package nvidia-390.
(Reading database ... 310871 files and directories currently installed.)
Preparing to unpack .../00-nvidia-390_390.30-0ubuntu1_amd64.deb ...
Unpacking nvidia-390 (390.30-0ubuntu1) ...
Selecting previously unselected package nvidia-390-dev.
Preparing to unpack .../01-nvidia-390-dev_390.30-0ubuntu1_amd64.deb ...
Unpacking nvidia-390-dev (390.30-0ubuntu1) ...
Selecting previously unselected package libcuda1-390.
Preparing to unpack .../02-libcuda1-390_390.30-0ubuntu1_amd64.deb ...
Unpacking libcuda1-390 (390.30-0ubuntu1) ...
Preparing to unpack .../03-nvidia-modprobe_390.30-0ubuntu1_amd64.deb ...
Unpacking nvidia-modprobe (390.30-0ubuntu1) over (390.12-0ubuntu1) ...
Preparing to unpack .../04-nvidia-settings_390.30-0ubuntu1_amd64.deb ...
Unpacking nvidia-settings (390.30-0ubuntu1) over (390.25-0ubuntu0~gpu17.10.1) ...
Selecting previously unselected package nvidia-opencl-icd-390.
Preparing to unpack .../05-nvidia-opencl-icd-390_390.30-0ubuntu1_amd64.deb ...
Unpacking nvidia-opencl-icd-390 (390.30-0ubuntu1) ...
Selecting previously unselected package cuda-drivers.
Preparing to unpack .../06-cuda-drivers_390.30-1_amd64.deb ...
Unpacking cuda-drivers (390.30-1) ...
Selecting previously unselected package cuda-runtime-9-1.
Preparing to unpack .../07-cuda-runtime-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-runtime-9-1 (9.1.85-1) ...
Selecting previously unselected package cuda-demo-suite-9-1.
Preparing to unpack .../08-cuda-demo-suite-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-demo-suite-9-1 (9.1.85-1) ...
Selecting previously unselected package cuda-9-1.
Preparing to unpack .../09-cuda-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-9-1 (9.1.85-1) ...
Selecting previously unselected package cuda.
Preparing to unpack .../10-cuda_9.1.85-1_amd64.deb ...
Unpacking cuda (9.1.85-1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3) ...
Setting up nvidia-390 (390.30-0ubuntu1) ...
update-alternatives: using /usr/lib/nvidia-390/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in auto mode
update-alternatives: warning: skip creation of /usr/share/grub-gfxpayload-lists/blacklist/10_proprietary-graphics-drivers because associated file /usr/share/nvidia-390/nvidia-390.grub-gfxpayload (of link group x86_64-linux-gnu_gl_conf) doesn't exist
update-alternatives: using /usr/lib/nvidia-390/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in auto mode
update-alternatives: using /usr/lib/nvidia-390/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_EGL.conf (i386-linux-gnu_egl_conf) in auto mode
update-alternatives: using /usr/share/nvidia-390/glamor.conf to provide /usr/share/X11/xorg.conf.d/glamoregl.conf (glamor_conf) in auto mode
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)

A modprobe blacklist file has been created at /etc/modprobe.d to prevent Nouveau from loading. This can be reverted by deleting /etc/modprobe.d/nvidia-graphics-drivers.conf.
A new initrd image has also been created. To revert, please replace /boot/initrd-4.15.3-041503-generic with /boot/initrd-$(uname -r)-backup.

*****************************************************************************
*** Reboot your computer and verify that the NVIDIA graphics driver can   ***
*** be loaded.                                                            ***
*****************************************************************************

INFO:Enable nvidia-390
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
Adding system user `nvidia-persistenced' (UID 123) ...
Adding new group `nvidia-persistenced' (GID 129) ...
Adding new user `nvidia-persistenced' (UID 123) with group `nvidia-persistenced' ...
Not creating home directory `/'.
Loading new nvidia-390-390.30 DKMS files...
Building for 4.15.3-041503-generic
Building for architecture x86_64
Building initial module for 4.15.3-041503-generic
Done.

nvidia_390:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.15.3-041503-generic/updates/dkms/

nvidia_390_modeset.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.15.3-041503-generic/updates/dkms/

nvidia_390_drm.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.15.3-041503-generic/updates/dkms/

nvidia_390_uvm.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.15.3-041503-generic/updates/dkms/

depmod...

DKMS: install completed.
Setting up nvidia-390-dev (390.30-0ubuntu1) ...
Setting up nvidia-settings (390.30-0ubuntu1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
Setting up nvidia-modprobe (390.30-0ubuntu1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu5) ...
Setting up nvidia-opencl-icd-390 (390.30-0ubuntu1) ...
Setting up libcuda1-390 (390.30-0ubuntu1) ...
Setting up cuda-drivers (390.30-1) ...
Setting up cuda-runtime-9-1 (9.1.85-1) ...
Setting up cuda-demo-suite-9-1 (9.1.85-1) ...
Setting up cuda-9-1 (9.1.85-1) ...
Setting up cuda (9.1.85-1) ...
Processing triggers for initramfs-tools (0.125ubuntu12) ...
update-initramfs: Generating /boot/initrd.img-4.15.3-041503-generic
cryptsetup: WARNING: target cryptswap1 has a random key, skipped
Processing triggers for shim-signed (1.33.1~17.10.1+13-0ubuntu2) ...
Secure Boot not enabled on this system.
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
root@srv2:~/xmr-stak/build/bin#