Rosanswers logo

I have Ubuntu 18.04 running on my machine and unable to install ros-melodic.

When I run this command "sudo apt-get install ros-melodic-desktop-full", I am getting this following error:

Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package ros-melodic-desktop-full

I have even tried using aptitude and I still get the same unable to locate error. I have also tried downloading with and without -full and other flags. Still no use.

Please help!

Originally posted by omkard on ROS Answers with karma: 64 on 2020-03-03

Post score: 1

Original comments

Comment by jarvisschultz on 2020-03-03:
Please add the output of cat /etc/apt/sources.list.d/ros-latest.list to your original question. Likely the issue is that this file is missing or incorrect, or perhaps that you have not run sudo apt update to download an up-to-date list of available packages.

Comment by omkard on 2020-03-03:
Hi @jarvisschultz,

I have run sudo apt update and When I cd into /etc/apt/sources.list.d,I do not see ros-latest.list.

Is this the issue?

Please advise.

Comment by omkard on 2020-03-03:
Hi @jarvisschultz, I did the following which added me the ros-latest.list.

      echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros-latest.list

I then ran

 sudo apt update

and tried installing ros again.

Worked like charm.

Thank you.

Comment by jarvisschultz on 2020-03-03:
Glad you figured it out. As I suspected, it sounds like the file was missing.

Comment by droneguy6374 on 2021-12-02:
hi @jarvisschultz, i am having the exact same issue as @omkard. I have tried the solution and get this line: "deb http://packages.ros.org/ros/ubuntu focal main"

What does it mean and why doesn't the following command work: "sudo apt install ros-melodic-desktop-full" from https://github.com/PX4/PX4-Avoidance#obstacle-detection-and-avoidance

Comment by jarvisschultz on 2021-12-07:
Are you using ROS melodic or noetic? Your ros-latest.list seems to indicate you are using Ubuntu focal which should use Noetic by default yet you are trying to install a package from melodic. Maybe try sudo apt install ros-noetic-desktop-full. If this doesn't clear things up, perhaps it's best to open your own question following the support guidelines: https://wiki.ros.org/Support

Comment by Hedwin on 2023-06-03:
@jarvisschultz, I'm in the same case than @droneguy6374, and indeed, I managed to install noetic but not melodic. But I want to run a rosject that use melodic, how can I install melodic instead of noetic ? The only thing I see is "E: Unable to locate package ros-melodic-desktop-full or ros-melodic-desktop".

Comment by jarvisschultz on 2023-06-12:
@Hedwin REP 0003 lists the target platforms for all ROS releases. If you are on Focal (Ubuntu 20.04), the only version of ROS with required support is Noetic. If you specifically need Melodic, then you can either (a) use a supported Ubuntu version such as Bionic (Ubuntu 18.04), (b) attempt to build Melodic from source on 20.04 (likely a painful process), or (c) ask yourself why you need Melodic and not Noetic and see if there are other ways around this. For (c), for example, it might be that you just need to build a couple of packages from source that were released for Melodic but not Noetic, and this is likely much more appealing than building the entire ROS distribution.

One other thought, you could look into using Docker to more flexibly run ROS versions on whatever OS you are using.


1 Answer 1


Rosanswers logo

Solved by doing the following

echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros-latest.list

Originally posted by omkard with karma: 64 on 2020-03-03

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by vered on 2020-08-06:
hi, i tried that and when i made sudo apt update i've got
Err:4 http://packages.ros.org/ros/ubuntu bionic InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 Reading package lists... Done W: GPG error: http://packages.ros.org/ros/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654 E: The repository 'http://packages.ros.org/ros/ubuntu bionic InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.

what's now?

Comment by joedavid91 on 2020-11-07:
You are probably missing the second step

  1. Setup your sources list sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  2. Set up your keys sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  3. Run sudo apt update
  4. Install your ros version sudo apt install ros-melodic-desktop-full

Comment by Ahmed Ghanem on 2022-03-03:
thank you its worked with me

Comment by itsBaron on 2023-01-10:
Hello, I am facing similar issue while installing ROS Noetic on Ubuntu 20.04. Setting up the source list is done. I wanted to know if the command to setup the keys is same and if there is some other issue to fix.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.