amdgpu-pro-install on Ubuntu GNOME 16.04 with R9 285 and RX 480

34,870

Quote from http://www.phoronix.com/scan.php?page=article&item=amd-gpu-pro&num=1

At first I was trying an Ubuntu 16.04 daily system with its packaged Xenial kernel. However, even though this packaged AMDGPU binary driver uses DKMS, there is broken compatibility with this kernel driver's code against Linux 4.4. Due to some changes in the DRM kernel interface of Linux 4.4, building the DKMS module failed. This should be fixed by AMD soon as Bridgman noted in the forums, but for now, the easy fix was just installing Linux 4.2 on the Ubuntu 16.04 box

I did not try the easy fix, but I found the hard one earlier in the day, and it worked for me without an issue.

However If you attempt this I recommend backing up your system before trying this.

The problem For AMDGPU-PRO on Ubuntu GNOME is that COGL is failing to compile correctly.

there is a patch file for it:

Fix COGL for AMDGPU-PRO drivers by Ashley Sommer. https://gist.github.com/ashleysommer/25118d366bf8c1608f3b1a64bc52d4e5

    --- a/cogl/driver/gl/gl/cogl-driver-gl.c
    +++ b/cogl/driver/gl/gl/cogl-driver-gl.c
    @@ -403,9 +403,13 @@
                                   &ctx->glsl_minor);
         }

    -  if (COGL_CHECK_GL_VERSION (ctx->glsl_major, ctx->glsl_minor, 1, 2))
    -    /* We want to use version 120 if it is available so that the
    -     * gl_PointCoord can be used. */
    +  if (COGL_CHECK_GL_VERSION (ctx->glsl_major, ctx->glsl_minor, 1, 5))
    +    ctx->glsl_version_to_use = 150;
    +  else if (COGL_CHECK_GL_VERSION (ctx->glsl_major, ctx->glsl_minor, 1, 4))
    +    ctx->glsl_version_to_use = 140; 
    +  else if (COGL_CHECK_GL_VERSION (ctx->glsl_major, ctx->glsl_minor, 1, 3))
    +    ctx->glsl_version_to_use = 130; 
    +  else if (COGL_CHECK_GL_VERSION (ctx->glsl_major, ctx->glsl_minor, 1, 2))
         ctx->glsl_version_to_use = 120;
       else
         ctx->glsl_version_to_use = 110;

There is a guide by user illwieckz on how to apply the fix here:

https://www.phoronix.com/forums/forum/linux-graphics-x-org-drivers/amd-linux/881527-amdgpu-pro-16-30-released-with-rx-480-support/page5

Things to do:

You have to rebuild the libcogl20 package. Since I was not able to successfully rebuild the cogl packages, I just replaced the libcogl.so binary itself.

 sudo apt-get build-dep cogl

if you get: E: Unable to find a source package for cogl

 sudo gedit /etc/apt/sources.list

and add this at the end of the file:

 # COGL
 deb-src ftp://ftp.de.debian.org/debian/ stable main contrib

next:

 sudo apt-get update &&  sudo apt-get build-dep cogl

install a couple packages required to build cogl:

 sudo apt-get install devscripts libcogl-gst-dev

then continue:


 The following commands I executed from the home directory,
 because of permission errors and `command is not found`
 errors I was getting.

 apt-get source cogl
 cd cogl-1.22.0
 wget -O /tmp/cogl.patch https://gist.githubusercontent.com/ashleysommer/25118d366bf8c1608f3b1a64bc52d4e5/raw/e35e535e7ea9684538a63fe6ea0eb2709b1813f1/cogl_driver_gl_gl_cogl-driver-gl.c
 patch -p1 < /tmp/cogl.patch
 dpkg-source --commit
 debuild -us -uc -j$(nproc)

If the build ends successfully for you, you just have to install the generated libcogl20 deb file (in parent directory) with gdebi or dpkg:

 sudo dpkg -i libcogl20_1.22.0-2_amd64.deb

If it fails for you like it failed for me, there is another option remaining, you can do as I did.

Since on my end, the build failed on some unnecessary part, but the patched lib was built fine, I just replaced the binary by hand:

Code:

 sudo cp -a debian/tmp/usr/lib/x86_64-linux-gnu/libcogl.so.20.4.1 /usr/lib/x86_64-linux-gnu/libcogl.so.20.4.1

The desktop freezes for a couple of seconds.

Since I overwritten a file that comes from a package, I marked the package to be “hold” to be sure a future update will not overwrite it, it's a good idea to hold it too if you built successfully the package, for the same reason.

Code:

sudo apt-mark hold libcogl20

If you want to revert the dirty things, you just have to do:

Code:

 sudo apt-mark unhold libcogl20
 sudo apt-get install --reinstall libcogl20

Pro-tip, you can use the debsums tool (from the debsums package) to check if you're running a libcogl.so from a package or a fast- and-dirty patched one like me:

Code:

 debsums -s libcogl20
 debsums: changed file /usr/lib/x86_64-linux-gnu/libcogl.so.20.4.1 (from libcogl20:amd64 package)

If you successfully built the package and installed it the dpkg way, debsums will not complain.

The last part of the amdgpu-pro instalation looks like this


Setting up amdgpu-pro (16.30.3-315407) ...

Setting up amdgpu-pro-dkms (16.30.3-315407) ...

Loading new amdgpu-pro-16.30.3-315407 DKMS files...

First Installation: checking all kernels...

Building for 4.4.0-36-generic and 4.8.0-rc5

Building for architecture x86_64

Building initial module for 4.4.0-36-generic

Done.


amdgpu:

Running module version sanity check.

- Original module

- Installation

- Installing to /lib/modules/4.4.0-36-generic/updates/dkms/


depmod....


DKMS: install completed.

Building initial module for 4.8.0-rc5

ERROR: Cannot create report: [Errno 17] File exists:
 '/var/crash/amdgpu-pro-dkms.0.crash'

Error! Bad return status for module build on kernel: 4.8.0-rc5 (x86_64)
Consult /var/lib/dkms/amdgpu-pro/16.30.3-315407/build/make.log for more information.

update-initramfs: deferring update (trigger activated)

Setting up amdgpu-pro-lib32:i386 (16.30.3-315407) ...

Processing triggers for libc-bin (2.23-0ubuntu3) ...

Processing triggers for initramfs-tools (0.122ubuntu8.1) ...

update-initramfs: Generating /boot/initrd.img-4.8.0-rc5

Warning: Not updating LILO; /etc/lilo.conf not found!

Update 10-9-2016: Using RX 480.

enter image description here

The installation is a success with a 4.4.0-36-generic kernel,

but the module building for kernel 4.8.0-rc5 fails.

Make sure you have: sudo apt-mark hold libcogl20

This command prevents the gnome package updater from replacing the compiled libgogl20 with a newer version.

It also prevents other packages from being installed because of some packages depend on a more recent version of cogl and so on.

We just have to wait for an official fix for this issue, until then this is a good way to get the amdgpu-pro driver working on Ubuntu Gnome 16.04.

Share:
34,870

Related videos on Youtube

KB_
Author by

KB_

I am Interested in everything JavaScript related.

Updated on September 18, 2022

Comments

  • KB_
    KB_ over 1 year

    I have a problem installing AMD GPU PRO driver for my Ubuntu Gnome 16.04 system. The screen is going black after installation and reboot. The image in GUI mode is incomplete and mostly black with small flickering parts of the login screen. The mouse cursor is visible.

    I can access the tty and uninstall it.

    I downloaded the driver from AMD official website link. They say it is compatible with my graphics card: AMD Radeon™ R9 285 Graphics. I followed the install guide provided on the website. The installation completes without a problem and after restarting, the screen is black.

    Running uname -r gives:

    4.4.0-28-generic
    

    Running dpkg -l amdgpu-pro gives:

    dpkg-query: no packages found matching amdgpu-pro
    

    Running ./amdgpu-pro-install gives:

    Reading package lists... Done
    Building dependency tree
    ...........................
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      gcc-5-base:i386 libdrm-radeon1:i386 libdrm2:i386 libelf1:i386
      libssl1.0.0:i386 libstdc++6:i386 libx11-6:i386 libx11-xcb1:i386 libxau6:i386
      libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386
      libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386
      libxfixes3:i386 libxshmfence1:i386 libxxf86vm1:i386 linux-headers-4.4.0-21
      linux-headers-4.4.0-21-generic linux-image-4.4.0-21-generic
      linux-image-extra-4.4.0-21-generic
    Use 'sudo apt autoremove' to remove them.
    ......................
    Reading package lists... Done
    deb file:/var/opt/amdgpu-pro/ ./ 
    Reading package lists... Done
    W: The repository 'file:/var/opt/amdgpu-pro ./ Release' does not have a Release file.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      linux-headers-4.4.0-21 linux-headers-4.4.0-21-generic
      linux-image-4.4.0-21-generic linux-image-extra-4.4.0-21-generic
    Use 'sudo apt autoremove' to remove them.
    The following additional packages will be installed:
      amdgpu-pro-clinfo amdgpu-pro-computing amdgpu-pro-core amdgpu-pro-firmware
      amdgpu-pro-graphics amdgpu-pro-libopencl-dev amdgpu-pro-libopencl-dev:i386
      amdgpu-pro-libopencl1 amdgpu-pro-libopencl1:i386 amdgpu-pro-opencl-icd
      amdgpu-pro-opencl-icd:i386 amdgpu-pro-vulkan-driver
      amdgpu-pro-vulkan-driver:i386 libdrm-amdgpu-pro-amdgpu1
      libdrm-amdgpu-pro-amdgpu1:i386 libdrm2-amdgpu-pro libdrm2-amdgpu-pro:i386
      libegl1-amdgpu-pro libegl1-amdgpu-pro:i386 libgbm1-amdgpu-pro:i386
      libgbm1-amdgpu-pro libgl1-amdgpu-pro-dev libgl1-amdgpu-pro-dev:i386
      libgl1-amdgpu-pro-dri libgl1-amdgpu-pro-dri:i386 libgl1-amdgpu-pro-glx:i386
      libgl1-amdgpu-pro-glx libgles2-amdgpu-pro libgles2-amdgpu-pro:i386
      libvdpau-amdgpu-pro libvdpau-amdgpu-pro:i386 xserver-xorg-video-amdgpu-pro
    The following NEW packages will be installed
      amdgpu-pro amdgpu-pro-clinfo amdgpu-pro-computing amdgpu-pro-core
      amdgpu-pro-dkms amdgpu-pro-firmware amdgpu-pro-graphics
      amdgpu-pro-lib32:i386 amdgpu-pro-libopencl-dev amdgpu-pro-libopencl-dev:i386
      amdgpu-pro-libopencl1 amdgpu-pro-libopencl1:i386 amdgpu-pro-opencl-icd
      amdgpu-pro-opencl-icd:i386 amdgpu-pro-vulkan-driver
      amdgpu-pro-vulkan-driver:i386 libdrm-amdgpu-pro-amdgpu1
      libdrm-amdgpu-pro-amdgpu1:i386 libdrm2-amdgpu-pro libdrm2-amdgpu-pro:i386
      libegl1-amdgpu-pro libegl1-amdgpu-pro:i386 libgbm1-amdgpu-pro:i386
      libgbm1-amdgpu-pro libgl1-amdgpu-pro-dev libgl1-amdgpu-pro-dev:i386
      libgl1-amdgpu-pro-dri libgl1-amdgpu-pro-dri:i386 libgl1-amdgpu-pro-glx:i386
      libgl1-amdgpu-pro-glx libgles2-amdgpu-pro libgles2-amdgpu-pro:i386
      libvdpau-amdgpu-pro libvdpau-amdgpu-pro:i386 xserver-xorg-video-amdgpu-pro
    0 to upgrade, 35 to newly install, 0 to remove and 0 not to upgrade.
    Need to get 0 B/84.0 MB of archives.
    After this operation, 400 MB of additional disk space will be used.
    

    Question: How to proceed, where should I look for a faulty dependency or something that prevents the driver from running properly, how to make it work?

    So far I have tried this:

    • I have tested with HDMI and DisplayPort and both give the same results.

    • Tried with sudo dpkg --add-architecture i386 and sudo apt -get update.

    dmesg output: (I included snippets from the dmesg log that might be helpful in identifying the issue.)

    amdgpu: module verification failed: signature and/or required key missing - tainting kernel
    [drm] amdgpu kernel modesetting enabled.
    AMD IOMMUv2 driver by Joerg Roedel <[email protected]>
    AMD IOMMUv2 functionality not available on this system
    fb: switching to amdgpudrmfb from VESA VGA
    amdgpu 0000:01:00.0: Invalid ROM contents
    ATOM BIOS: C76601
    amdgpu 0000:01:00.0: VRAM: 2048M 0x0000000000000000 - 0x000000007FFFFFFF (2048M used)
    amdgpu 0000:01:00.0: GTT: 2048M 0x0000000080000000 - 0x00000000FFFFFFFF
    amdgpu 0000:01:00.0: amdgpu: using MSI.
    [drm] amdgpu: irq initialized.
    Can't find requested voltage id in vdd_dep_on_sclk table!
    amdgpu: powerplay initialized
    amdgpu 0000:01:00.0: fence driver on ring 0 use gpu addr 0x0000000080000008, cpu addr 0xffff880425497008
    [drm] [FeatureOverride_overriden feature]   Overridden FEATURE_ENABLE_GPU_SCALING is enabled now
    fbcon: amdgpudrmfb (fb0) is primary device
    amdgpu 0000:01:00.0: fb0: amdgpudrmfb frame buffer device
    [drm] Initialized amdgpu 3.2.0 20150101 for 0000:01:00.0 on minor 0
    
    • MttJocy
      MttJocy almost 8 years
      Given that the link you downloaded the driver from does state the driver is a beta it is entirely possible that this could in fact be a driver bug, have you tried reporting the problem to AMD including the complete dmesg output and the contents of the /var/log/Xorg.0.log file? They may well be in a much better position to help you with issues around their experimental driver code than anyone here.
    • thinkmassive
      thinkmassive almost 7 years
      I encountered the dependency issue on a fresh install of Ubuntu 16.04 (not using Gnome). The problem was obviously related to i386 packages, but I wasn't immediately sure how to resolve it. Luckily your question clued me in to sudo dpkg --add-architecture i386 and that did the trick. Thanks!
  • Jeremy
    Jeremy over 7 years
    Works like a charm, thanks. Do note that depending on your situation, you might need to install more packages first. You will be told which during the build process. If so, you just have to start the build process again afterwards. Also, adding a different repository other than the default available Ubuntu repositories (like your debian one) is not needed and not recommended. You either didn't perform an apt-get update before the build-deb step or you didn't enable/uncomment the deb-src repositories already available in sources.list. Check that first, followed by an apt-get update again.