Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 568  / 3 Years ago, sun, october 17, 2021, 8:22:22

I tried installing nvidia-cudnn and was being a bit fast and lose with the prompts. I accidentally hit reject when trying to install it. Now when I try to uninstall I get the following error:


$ sudo apt purge nvidia-cudnn -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED
nvidia-cudnn*
0 to upgrade, 0 to newly install, 1 to remove and 3 not to upgrade.
After this operation, 45.1 kB disk space will be freed.
(Reading database ... 203730 files and directories currently installed.)
Removing nvidia-cudnn (8.2.4.15~cuda11.4) ...
Purging cuDNN installation from /usr
dpkg: error processing package nvidia-cudnn (--remove):
installed nvidia-cudnn package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
nvidia-cudnn
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Manually removing sudo rm -r /usr/share/doc/nvidia-cudnn and sudo rm /var/lib/dpkg/info/nvidia-cudnn* then sudo apt purge nvidia-cudnn doesn't seem to do the trick. When I try and install it again, i'm not prompted for the license anymore. I've tried rebooting in between "uninstalling" and reinstalling. Where is the license accepted/rejected information kept? How can I force it to prompt me with the license again?


Both before and after the messup I used this command to install cudnn sudo apt install nvidia-cudnn


Now all I get is:


$ sudo apt install nvidia-cudnn 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed
nvidia-cudnn
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 13.2 kB of archives.
After this operation, 45.1 kB of additional disk space will be used.
Get:1 http://gb.archive.ubuntu.com/ubuntu jammy/multiverse amd64 nvidia-cudnn amd64 8.2.4.15~cuda11.4 [13.2 kB]
Fetched 13.2 kB in 0s (971 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nvidia-cudnn.
(Reading database ... 203718 files and directories currently installed.)
Preparing to unpack .../nvidia-cudnn_8.2.4.15~cuda11.4_amd64.deb ...
Unpacking nvidia-cudnn (8.2.4.15~cuda11.4) ...
Setting up nvidia-cudnn (8.2.4.15~cuda11.4) ...

More From » apt

 Answers
2

The uninstall process fails as the pre-removal script (/var/lib/dpkg/info/nvidia-cudnn.prerm) returns non-zero exit status.
Inside, the pre-removal script calls
update-nvidia-cudnn -p located in /usr/sbin/update-nvidia-cudnn
which after line 164 (echo Purging cuDNN installation from ${PREFIX}) runs a command purge_cudnn ${PREFIX} that fails.


I was able to fix the issue by forcing exit 0 from update-nvidia-cudnn -p, by adding exit 0 after line 164 in file /usr/sbin/update-nvidia-cudnn.


To sum up, edit the end of file /usr/sbin/update-nvidia-cudnn to:


...
elif test "${DO_PURGE}" -ne 0; then
echo Purging cuDNN installation from ${PREFIX}
exit 0 # added
purge_cudnn ${PREFIX}
fi

and the uninstall process becomes possible. Then if nvidia-cudnn is installed again, the installer will ask you again to agree to the license.


[#172] Tuesday, October 19, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
luringdge

Total Points: 3
Total Questions: 126
Total Answers: 109

Location: India
Member since Sun, Feb 6, 2022
2 Years ago
;