Unmet dependencies. Unable to install curl on Ubuntu server

What to do when you find the error ‘The following packages have unmet dependencies. Unable to correct problems, you have held broken packages.’ regarding a package install attempt on your Ubuntu server, let’s see an interesting simple solution.

Unmet dependencies. This may mean that you have requested an impossible situation

Last night the cron daemon of one server send me an email with a warning message. Here the text:

/usr/local/vesta/bin/v-check-letsencrypt-domain: line 64: curl: command not found
/usr/local/vesta/bin/v-check-letsencrypt-domain: line 77: curl: command not found
ubuntu.server.org Error: LetsEncrypt challenge request
/usr/local/vesta/bin/v-check-letsencrypt-domain: line 64: curl: command not found
/usr/local/vesta/bin/v-check-letsencrypt-domain: line 77: curl: command not found
ubuntu.server.org Error: LetsEncrypt challenge request
/usr/local/vesta/bin/v-check-letsencrypt-domain: line 64: curl: command not found
/usr/local/vesta/bin/v-check-letsencrypt-domain: line 77: curl: command not found
ubuntu.server.org Error: LetsEncrypt challenge request

So I immediately investigate the issue because curl was installed but log file shows that was also removed due to dependencies issue updating another program. Easy to solve, here the trick:

$ sudo apt install curl

Another issue, an unmet dependencies problem:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
curl : Depends: libcurl3-gnutls (= 7.47.0-1ubuntu2.9) but 7.58.0-2ubuntu3.3 is to be installed
E: Unable to correct problems, you have held broken packages.

Mmm… and now what to do?

$ apt-cache showpkg libcurl3-gnutls

And the result at the bottom is:

Provides:
7.58.0-2ubuntu3.3 -
7.47.0-1ubuntu2.9 -
7.47.0-1ubuntu2 -

Perfect, we need 7.47.0-1ubuntu2.9 so we can install it with:

$ sudo apt install libcurl3-gnutls=7.47.0-1ubuntu2.9

And, finally, again:

$ sudo apt install curl

Give us this:

The following NEW packages will be installed:
curl

Oh, yeah.

Leave a Reply

Your email address will not be published.