How to install OpenCV on Pop!OS

I bought a shiny new 6900xt and figure to help pay it off I will mine for a bit with ethermine! I also want to use it to play with blender and CAD, maybe some computer vision, as well as gaming in Linux, of course!

I have Pop!OS 20.10 with kernel 5.11.0-7612. Installation of amdgpu drivers went reasonably smoothly, but noticed when executing ethermine that no OpenCV is detected. this was validated in Blender where no GPU acceleration was available under the preferences. So I attempted to install the amdgpu drivers directly from AMD provided packages. It failed since I was not on a supported distribution. Modifying the driver to allow pop was easy enough, but it still failed. I purged everything related to amdgpu and ended up breaking the graphics. I did resolve the issue by removing the manually added PPAs and reinstalling the relevant packages in the default distros, and modprobe amdgpu.

Curiously, I do see OpenCV as an option in Blender “unknown GPU,” (maybe the 6900xt is too new?) but it does not perform that well. The BMW benchmark takes 5 minutes to complete, the same as just regular CPU. It isn’t working correctly, no doubt.

So I come here. I am trying to install OpenCV following this guide and get the following errors:

[email protected]:~$ sudo apt install rocm-dkms && sudo reboot
[sudo] password for maxim: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
rocm-dkms is already the newest version (4.1.0.40100-26).
The following packages were automatically installed and are no longer required:
  blender-data fonts-dejavu gdal-data libarmadillo9 libblosc1 libcharls2 libdap25 libdapclient6v5 libdcmtk14 libepsilon1 libfreexl1 libfyba0 libgdal27 libgdcm3.0 libgeos-3.8.1 libgeos-c1v5 libgeotiff5 libhdf4-0-alt
  libhdf5-hl-100 libjemalloc2 libkmlbase1 libkmldom1 libkmlengine1 liblog4cplus-1.1-9 libnetcdf18 libogdi4.1 libopencolorio1v5 libopencv-core4.2 libopencv-imgcodecs4.2 libopencv-imgproc4.2 libopencv-videoio4.2
  libopenimageio2.1 libopenvdb7.0 libosdcpu3.4.3 libosdgpu3.4.3 libproj19 librttopo1 libsocket++1 libspatialite7 libspnav0 libsuperlu5 libtbb2 libtinyxml2.6.2v5 liburiparser1 libxerces-c3.2 odbcinst odbcinst1debian2
  proj-bin proj-data
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up rock-dkms (1:4.1-26) ...
Removing old amdgpu-4.1-26 DKMS files...

------------------------------
Deleting module version: 4.1-26
completely from the DKMS tree.
------------------------------
Done.
Loading new amdgpu-4.1-26 DKMS files...
Building for 5.11.0-7612-generic
Building for architecture amd64
Building initial module for 5.11.0-7612-generic
ERROR (dkms apport): kernel package linux-headers-5.11.0-7612-generic is not supported
Error! Bad return status for module build on kernel: 5.11.0-7612-generic (amd64)
Consult /var/lib/dkms/amdgpu/4.1-26/build/make.log for more information.
dpkg: error processing package rock-dkms (--configure):
 installed rock-dkms package post-installation script subprocess returned error exit status 10
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of rocm-dkms:
 rocm-dkms depends on rock-dkms; however:
  Package rock-dkms is not configured yet.

dpkg: error processing package rocm-dkms (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 rock-dkms
 rocm-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

Do I need to downgrade to a less bleeding edge kernel? I honestly have no idea what kernel Pop!OS 20:10 is supposed to ship with, it was upgraded when I replaced my 2070 Super with the 6900XT as a lazy attempt to get it to install the AMD drivers.

As a side thing, I now have to load amdgpu manually every time I boot. Once booted I am presented with a blank screen and have to jump over to TTY2 and login and sudo modprobe amdgpu to load that module. Why is it so? I checked the blacklist.conf and I don’t see it there. Is there a list of drivers that are loaded at boot? I suspect the entry was removed back when I broke the driver and I would like to add it back in.

So as I dig into the issue, it seems that the problem is that I have the mesa OpenCL 1.1 implementation, and there are quite a few open issues on the ethminer github. I also came across a reddit thread discussing the issue and a patched fork of the project, but it apparently suffers from really poor performance.

How do I install the AMD ROCm OpenCV on Pop!OS?

1 Like

This topic was automatically closed 273 days after the last reply. New replies are no longer allowed.