0

I am following a mariadb documentation in which the starting steps have been completed but when I use this command.

sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 
'https://mariadb.org/mariadb_release_signing_key.asc'

This command gives me an error:

sudo: curl: command not found

I have tried to install curl on my Ubuntu using these commands.

sudo apt update
sudo apt install curl

I am not sure whether it is installed now but it gives me the same error when i try to use the above command again.

For more understanding I am also adding the screenshot of some additional commands too.

Curl commands image

Simon Sudler
  • 3,931
  • 3
  • 21
  • 34
  • This is in fact very strange, but with the provided information it is impossible to fix. Run the following commands and add the output to your question: which curl, curl https://www.google.com, sudo which curl, sudo curl https://www.google.com – Simon Sudler Mar 25 '23 at 12:41
  • I have added the image to the question. It would be great if you can help me with it. – Waleed Ahmed Shahid Mar 25 '23 at 14:06

3 Answers3

0

Something went wrong during the installation of curl as it seems that your systems still misses it.

In order to check if the package curl is installed, you can try to run the following command:

apt-cache policy curl

Which should print something like this:

curl:
  Installed: 7.81.0-1ubuntu1.10
  Candidate: 7.81.0-1ubuntu1.10
  Version table:
 *** 7.81.0-1ubuntu1.10 500
        500 http://it.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages
        100 /var/lib/dpkg/status
     7.81.0-1 500
        500 http://it.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Update

If the package is correctly installed this command should show where the binary is

$ dpkg -L curl | grep bin
/usr/bin
/usr/bin/curl

Check the $PATH variable:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

If it's not present, you can temporarily add /usr/bin to your $PATH variable with:

$ export PATH=/usr/bin:$PATH

To make this change permanent you can edit ~/.profile (user wide) or /etc/environment (system wide)

If everything else fails, you can always manually run the binary file using the full path:

$ /usr/bin/curl
curl: try 'curl --help' or 'curl --manual' for more information
Marco
  • 1
  • I am getting the same response as you are getting waleed@waleed-VirtualBox:~$ apt-cache policy curl curl: Installed: 7.81.0-1ubuntu1.10 Candidate: 7.81.0-1ubuntu1.10 Version table: *** 7.81.0-1ubuntu1.10 500 500 http://pk.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages 100 /var/lib/dpkg/status 7.81.0-1 500 500 http://pk.archive.ubuntu.com/ubuntu jammy/main amd64 Packages – Waleed Ahmed Shahid Mar 25 '23 at 15:45
0

The curl package seems to be broken, therefore reinstall the package with

$ sudo apt install --yes --reinstall curl

This will fix any missing binaries.

However, package binaries going missing is not a "normal" behavior. Someone or something must deliberately delete these files.

Simon Sudler
  • 3,931
  • 3
  • 21
  • 34
0

I have tried all of these commands for the installation of the curl.

sudo apt install curl

I also tried that command which is used for the reinstallation of curl.

sudo apt install --yes --reinstall curl

After that command it was showing that curl was installed as I checked it with the following command.

apt-cache policy curl

It showed the following response which stated that curl is installed now.

curl:
Installed: 7.81.0-1ubuntu1.10
Candidate: 7.81.0-1ubuntu1.10
Version table:
7.81.0-1ubuntu1.10 500
500 http://pk.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages
100 /var/lib/dpkg/status
7.81.0-1 500
500 http://pk.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

But the issue didn't resolve because of that but when I updated my ubuntu to 22.04 then this issue has been resolved and the following command has worked fine.

sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 
'https://mariadb.org/mariadb_release_signing_key.asc'

So, there was an issue with the command I was using with the curl and that's why it was giving the error and it's solved now.