dockerfile / ubuntu

Ubuntu Dockerfile for trusted automated Docker builds.
http://dockerfile.github.io/#/ubuntu
MIT License
465 stars 1.28k forks source link

Unable to install CUDA in ubuntu docker container #49

Open Dadiao-shuai opened 1 year ago

Dadiao-shuai commented 1 year ago

When I use the latest ubuntu22.04/20.04 docker images to create containers, there is always problem to install cuda11.8 which is compatible for my NVIDIA driver 520.61.05.

root@76fa843f6c13:~# apt-get -y install cuda
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 : Depends: cuda-12-2 (>= 12.2.2) but it is not going to be installed
 cuda-drivers-520 : Depends: libnvidia-compute-520 (>= 520.61.05) but it is not going to be installed
                    Depends: nvidia-compute-utils-520 (>= 520.61.05) but it is not going to be installed
                    Depends: nvidia-utils-520 (>= 520.61.05) but it is not going to be installed
 libnvidia-decode-520 : Depends: libnvidia-compute-520 (= 520.61.05-0ubuntu1) but it is not going to be installed
 nvidia-driver-520 : Depends: libnvidia-compute-520 (= 520.61.05-0ubuntu1) but it is not going to be installed
                     Depends: nvidia-compute-utils-520 (= 520.61.05-0ubuntu1) but it is not going to be installed
                     Depends: nvidia-utils-520 (= 520.61.05-0ubuntu1) but it is not going to be installed
                     Depends: libnvidia-cfg1-520 (= 520.61.05-0ubuntu1) but it is not going to be installed
                     Recommends: libnvidia-compute-520:i386 (= 520.61.05-0ubuntu1)
                     Recommends: libnvidia-decode-520:i386 (= 520.61.05-0ubuntu1)
                     Recommends: libnvidia-encode-520:i386 (= 520.61.05-0ubuntu1)
                     Recommends: libnvidia-fbc1-520:i386 (= 520.61.05-0ubuntu1)
                     Recommends: libnvidia-gl-520:i386 (= 520.61.05-0ubuntu1)
 xserver-xorg-video-nvidia-520 : Depends: libnvidia-cfg1-520 (= 520.61.05-0ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

BUT WHEN I TRY 'apt --fix-broken install':

root@76fa843f6c13:~# apt-get --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libnvidia-cfg1-520 libnvidia-compute-520 nvidia-compute-utils-520 nvidia-utils-520
The following NEW packages will be installed:
  libnvidia-cfg1-520 libnvidia-compute-520 nvidia-compute-utils-520 nvidia-utils-520
0 upgraded, 4 newly installed, 0 to remove and 8 not upgraded.
705 not fully installed or removed.
Need to get 0 B/51.3 MB of archives.
After this operation, 230 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 file:/var/cuda-repo-ubuntu2004-11-8-local  libnvidia-compute-520 520.61.05-0ubuntu1 [50.6 MB]
Get:2 file:/var/cuda-repo-ubuntu2004-11-8-local  nvidia-compute-utils-520 520.61.05-0ubuntu1 [271 kB]
Get:3 file:/var/cuda-repo-ubuntu2004-11-8-local  nvidia-utils-520 520.61.05-0ubuntu1 [341 kB]
Get:4 file:/var/cuda-repo-ubuntu2004-11-8-local  libnvidia-cfg1-520 520.61.05-0ubuntu1 [87.6 kB]
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 110113 files and directories currently installed.)
Preparing to unpack .../libnvidia-compute-520_520.61.05-0ubuntu1_amd64.deb ...
Unpacking libnvidia-compute-520:amd64 (520.61.05-0ubuntu1) ...
dpkg: error processing archive /var/cuda-repo-ubuntu2004-11-8-local/./libnvidia-compute-520_520.61.05-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/lib/x86_64-linux-gnu/libnvidia-ml.so.520.61.05' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../nvidia-compute-utils-520_520.61.05-0ubuntu1_amd64.deb ...
Unpacking nvidia-compute-utils-520 (520.61.05-0ubuntu1) ...
dpkg: error processing archive /var/cuda-repo-ubuntu2004-11-8-local/./nvidia-compute-utils-520_520.61.05-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/nvidia-persistenced' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../nvidia-utils-520_520.61.05-0ubuntu1_amd64.deb ...
Unpacking nvidia-utils-520 (520.61.05-0ubuntu1) ...
dpkg: error processing archive /var/cuda-repo-ubuntu2004-11-8-local/./nvidia-utils-520_520.61.05-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/nvidia-debugdump' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../libnvidia-cfg1-520_520.61.05-0ubuntu1_amd64.deb ...
Unpacking libnvidia-cfg1-520:amd64 (520.61.05-0ubuntu1) ...
dpkg: error processing archive /var/cuda-repo-ubuntu2004-11-8-local/./libnvidia-cfg1-520_520.61.05-0ubuntu1_amd64.deb (--unpack):
 unable to make backup link of './usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.520.61.05' before installing new version: Invalid cross-device link
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 /var/cuda-repo-ubuntu2004-11-8-local/./libnvidia-compute-520_520.61.05-0ubuntu1_amd64.deb
 /var/cuda-repo-ubuntu2004-11-8-local/./nvidia-compute-utils-520_520.61.05-0ubuntu1_amd64.deb
 /var/cuda-repo-ubuntu2004-11-8-local/./nvidia-utils-520_520.61.05-0ubuntu1_amd64.deb
 /var/cuda-repo-ubuntu2004-11-8-local/./libnvidia-cfg1-520_520.61.05-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
uzomaeze commented 3 months ago

I had a similar experience when I tried to install the latest Ubuntu on the Hyper V machine, I noticed from the installation that there was no sound, I finally decided to move to another machine which works perfectly fine, it is possible this installation doesn't work on the particular machine you are using, always seek alternatives, my 2 cents