After a computer reboot last week, my Ubuntu 18.04 LTS system had suddenly forgotten everything about my monitors and only produced an image for an "Unknown" monitor, so I removed everything having to do with NVIDIA, including CUDA and cuDNN (which I need to run TensorFlow on the GPU), and attempted to reinstall everything from scratch. I successfully reinstalled the GPU drivers and retained my monitor settings.
However, I'm having problems installing CUDA. When I run
sudo apt-get install cuda-toolkit-10-0
I get
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package cuda-toolkit-10-0 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'cuda-toolkit-10-0' has no installation candidate
Which is weird, since I think this is the command I used when installing CUDA before (although I don't remember what finally made CUDA work last time). So I tried to find the package that refers to cuda-toolkit-10-0
by running
apt-cache search cuda-toolkit-10-0
but this doesn't output anything (which is also weird, if what is stated in the linked question is correct).
I've also tried to start from NVIDIA's CUDA Toolkit archive page and follow the instructions for installing a local deb file:
$ sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
[sudo] password for kristofer:
(Reading database ... 249237 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48 (1.0-1) over (1.0-1) ...
Setting up cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48 (1.0-1) ...
$ sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
OK
$ sudo apt-get update
Hit:1 http://se.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://linux.teamviewer.com/deb stable InRelease
Hit:3 http://se.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://se.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:6 http://ppa.launchpad.net/jonathonf/gcc-7.3/ubuntu bionic InRelease
Hit:7 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:8 http://repository.spotify.com stable InRelease
Hit:9 http://archive.canonical.com/ubuntu bionic InRelease
Hit:10 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Reading package lists... Done
$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package cuda
so apt-get cannot find the package cuda.
So, how do install CUDA 10.0?