7

So, I'm an idiot, and I accidentally deleted the file libcurl-gnutls.so.4 on my Ubuntu system. Now I can't figure out how to recreate it. The actual error I'm getting is when I'm trying to use git:

git-remote-https: error while loading shared libraries: libcurl-gnutls.so.4: cannot open shared object file: No such file or directory

And it's right! That file doesn't exist. But I don't know how to create it. I've tried using apt-get to install libcurl-gnutls, and while it says that it succeeds, it doesn't create the library. I also downloaded curl and built/installed it, but that also didn't create the library I need. Any ideas on how I can fix this?

Thank you so much for any help.

user2701114
  • 141
  • 1
  • 1
  • 5

2 Answers2

10

I think, it is libcurl3-gnutls - Give it a try - sudo apt-get install libcurl3-gnutls.

This is how I figured it out, hoping this may help others:

Step1: Looked for the libcurl-gnutls.so.4 on my machine(Ubuntu 16.04).

ravitezu@Neutron:~$ locate libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.4.0

Step2: Check which package provides this file, when installed.

ravitezu@Neutron:~$ dpkg -S /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
libcurl3-gnutls:amd64: /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4

So, it gave me the package name libcurl3-gnutls which provides that file.

Here are the files, which will be deployed when you install libcurl3-gnutls:

ravitezu@Neutron:~$ dpkg -c libcurl3-gnutls_7.47.0-1ubuntu2_amd64.deb 
drwxr-xr-x root/root         0 2016-02-18 13:48 ./
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/lib/
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/lib/x86_64-linux-gnu/
-rw-r--r-- root/root    444800 2016-02-18 13:48 ./usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.4.0
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/share/
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/share/lintian/
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/share/lintian/overrides/
-rw-r--r-- root/root        67 2016-01-27 17:17 ./usr/share/lintian/overrides/libcurl3-gnutls
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/share/doc/
drwxr-xr-x root/root         0 2016-02-18 13:48 ./usr/share/doc/libcurl3-gnutls/
-rw-r--r-- root/root     10954 2016-01-27 17:17 ./usr/share/doc/libcurl3-gnutls/copyright
-rw-r--r-- root/root      1019 2016-02-18 13:48 ./usr/share/doc/libcurl3-gnutls/changelog.Debian.gz
-rw-r--r-- root/root       590 2016-01-27 17:17 ./usr/share/doc/libcurl3-gnutls/NEWS.Debian.gz
lrwxrwxrwx root/root         0 2016-02-18 13:48 ./usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 -> libcurl-gnutls.so.4.4.0
lrwxrwxrwx root/root         0 2016-02-18 13:48 ./usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3 -> libcurl-gnutls.so.4
RaviTezu
  • 3,047
  • 19
  • 26
  • I tried this, and it tells me that "libcurl3-gnutls is already the newest version", but the problem persists when I try to use git. It seems like it thinks that that library already exists, even though it doesn't. Is there any way to force the installation to recreate that library? I've tried purging then installing again, but that hasn't worked so far. – user2701114 May 03 '16 at 20:17
  • You try a quick hack: 1. Download the .deb package using `apt-get download libcurl3-gnutls`. 2. Extract the libcurl-gnutls.so.4 from the .deb package using `dpkg -x libcurl3-gnutls_7.47.0-1ubuntu2_amd64.deb /tmp/libcurl3` 3. You may try manually placing the file. I have updated the answer with the files which the libcurl3-gnutls deploys when installed, I see the `libcurl-gnutls.so.4` has a symb link, you may need to try creating that sym link as well. – RaviTezu May 04 '16 at 03:40
  • Awesome! Glad you got it fixed :) – RaviTezu May 04 '16 at 16:03
7

Another reason for this issue is that your sistem only has the 64 bit version of the library and the program requires the 32 bit version. In this case you might see an error similar to the following:

error while loading shared libraries: libcurl-gnutls.so.4: wrong ELF class: ELFCLASS64

Installing the 32 bit version will fix it:

apt-get install libcurl3-gnutls:i386
BlackBear
  • 22,411
  • 10
  • 48
  • 86
  • sudo apt-get install libcurl3-gnutls:i386 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libcurl3-gnutls – tibbon Oct 30 '16 at 21:22
  • @tibbon depends on your linux version. This package definitely exists for Ubuntu-based distros since 12.04: https://launchpad.net/ubuntu/precise/i386/libcurl3-gnutls – BlackBear Oct 30 '16 at 22:42