title: dealing with broken dpkg due to cuda/nvidia
body: <p>I just inherited a laptop with a broken cuda install and am trying to deal with it without wiping and reinstalling ubuntu20. </p>
  
  <pre><code>jeremy@jeremy-Blade:~/Dropbox/projects/PycharmProjects/robot_arm/ssd.pytorch$ sudo apt --fix-broken install
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  Correcting dependencies... Done
  The following packages were automatically installed and are no longer required:
    cuda-command-line-tools-10-2 cuda-compiler-10-2 cuda-cudart-10-2 cuda-cudart-dev-10-2 cuda-cufft-10-2 cuda-cufft-dev-10-2 cuda-cuobjdump-10-2
    cuda-cupti-10-2 cuda-cupti-dev-10-2 cuda-curand-10-2 cuda-curand-dev-10-2 cuda-cusolver-10-2 cuda-cusolver-dev-10-2 cuda-cusparse-10-2
    cuda-cusparse-dev-10-2 cuda-demo-suite-10-2 cuda-documentation-10-2 cuda-driver-dev-10-2 cuda-drivers cuda-gdb-10-2 cuda-libraries-10-2
    cuda-libraries-dev-10-2 cuda-license-10-2 cuda-memcheck-10-2 cuda-misc-headers-10-2 cuda-npp-10-2 cuda-npp-dev-10-2 cuda-nsight-10-2
    cuda-nsight-compute-10-2 cuda-nsight-systems-10-2 cuda-nvcc-10-2 cuda-nvdisasm-10-2 cuda-nvgraph-10-2 cuda-nvgraph-dev-10-2 cuda-nvjpeg-10-2
    cuda-nvjpeg-dev-10-2 cuda-nvml-dev-10-2 cuda-nvprof-10-2 cuda-nvprune-10-2 cuda-nvrtc-10-2 cuda-nvrtc-dev-10-2 cuda-nvtx-10-2 cuda-nvvp-10-2
    cuda-runtime-10-2 cuda-samples-10-2 cuda-sanitizer-api-10-2 cuda-tools-10-2 cuda-visual-tools-10-2 freeglut3 freeglut3-dev gir1.2-geocodeglib-1.0
    libcublas-dev libcublas10 libfwup1 libglu1-mesa-dev libxmu-dev libxmu-headers libxt-dev nsight-compute-2019.5.0 nsight-systems-2019.5.2
    nvidia-modprobe ubuntu-web-launchers
  Use 'sudo apt autoremove' to remove them.
  The following additional packages will be installed:
    libcublas-dev
  The following NEW packages will be installed:
    libcublas-dev
  0 upgraded, 1 newly installed, 0 to remove and 170 not upgraded.
  74 not fully installed or removed.
  Need to get 42.3 MB of archives.
  After this operation, 114 MB of additional disk space will be used.
  Do you want to continue? [Y/n] 
  Get:1 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  libcublas-dev 10.2.2.89-1 [42.3 MB]
  Fetched 42.3 MB in 18s (2,392 kB/s)                                                                                                                      
  (Reading database ... 298525 files and directories currently installed.)
  Preparing to unpack .../libcublas-dev_10.2.2.89-1_amd64.deb ...
  Unpacking libcublas-dev (10.2.2.89-1) ...
  dpkg: error processing archive /var/cache/apt/archives/libcublas-dev_10.2.2.89-1_amd64.deb (--unpack):
   trying to overwrite '/usr/include/nvblas.h', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
  dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
  Errors were encountered while processing:
   /var/cache/apt/archives/libcublas-dev_10.2.2.89-1_amd64.deb
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  </code></pre>
  
  <p>Some things I've tried:</p>
  
  <pre><code>jeremy@jeremy-Blade:~/Dropbox/projects/PycharmProjects/robot_arm/ssd.pytorch$ sudo apt autoremove
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  You might want to run 'apt --fix-broken install' to correct these.
  The following packages have unmet dependencies:
   cuda-libraries-dev-10-2 : Depends: libcublas-dev (&gt;= 10.2.2.89) but it is not installed
   cuda-samples-10-2 : Depends: libcublas-dev (&gt;= 10.2.2.89) but it is not installed
   cuda-visual-tools-10-2 : Depends: libcublas-dev (&gt;= 10.2.2.89) but it is not installed
  E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  </code></pre>
  
  <p>and then </p>
  
  <pre><code> 1844  sudo rm /var/cache/apt/archives/libcublas*
   1845  sudo rm /usr/include/nvblas.h
   1846  sudo apt --fix-broken install
   1847  sudo apt-get purge libcublas*
   1848  sudo apt-get purge libcublas10
   1849  sudo apt-get purge libcublas9.1
   1850  sudo apt-get remove libcublas9.1
   1851  sudo apt-get remove libcublas10
   1852  sudo rm /usr/include/nvblas.h
   1853  sudo rm /var/cache/apt/archives/libcublas*
   1854  sudo rm /var/cache/apt/archives/libnvidia-*
   1855  sudo apt-get purge libcublas10
   1856  sudo apt --fix-broken install
   1857  sudo apt -remove-broken install
   1858  sudo apt-get -f install
   1859  sudo apt --fix-broken install
   1860  sudo rm /var/cache/apt/archives/libcublas*
   1861  sudo rm /usr/include/nvblas.h
   1866  sudo dpkg --remove --force-remove-reinstreq nvidia-cuda
   1867  ls /var/lib/dpkg/info/|grep nvidia*
   1868  sudo dpkg --remove --force-remove-reinstreq nvidia*
   1869  sudo dpkg --remove --force-remove-reinstreq nvidia-common
   1877  sudo dpkg --remove --force-remove-reinstreq nvidia-visual-profiler.list
   1878  ls /var/lib/dpkg/info/|grep cuda*
   1882  sudo dpkg --remove --force-remove-reinstreq cuda
   1883  sudo dpkg --remove --force-remove-reinstreq cuda-10-2
   1884  sudo dpkg --remove --force-remove-reinstreq cuda-toolkit-10-2
  </code></pre>
  
  <p>all to no avail.  The software updates gui says nvidia-driver-440 is in use, any help appreciated. I'd be fine with a working dpkg and no nvidia at all for starters.</p>