Ask Your Question

I have followed all the command to install ros melodic in Ubuntu bionic but stucked at setting up environment variables.

asked 2019-08-02 05:56:56 -0600

1at7 gravatar image

updated 2019-08-02 22:22:17 -0600


echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

Then after

source ~/.bashrc


bash: /otp/ros/melodic/setup.bash: No such file or directory.
edit retag flag offensive close merge delete



is this a typo in your question or what you're actually seeing it should be /opt/ros.... This could be causing your problem.

If you look at the contents of your .bashrc script you can check and fix the typo if that's the case

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-08-02 07:10:07 -0600 )edit

i copy pasted from and it is like

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
1at7 gravatar image 1at7  ( 2019-08-02 11:04:37 -0600 )edit


So what is the output of ls -al /opt/ros/melodic/setup.bash?

And the output of lsb_release -a?

And of uname -a?

gvdhoorn gravatar image gvdhoorn  ( 2019-08-03 05:31:46 -0600 )edit

Output of 1st ls: cannot access '/opt/ros/melodic/setup.bash' : No such file or directory 2nd No LSB modules are available. And for 3rd one.. my PC name, Ubuntu version, GNU/Linux

1at7 gravatar image 1at7  ( 2019-08-03 05:44:31 -0600 )edit

We need the verbatim, exact copy-paste of the uname -a output. You can change your PC name, but leave the rest.

As to the rest: it would appear that you haven't installed ROS.

gvdhoorn gravatar image gvdhoorn  ( 2019-08-03 05:46:14 -0600 )edit

unaame -a output as

Linux *********  #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
1at7 gravatar image 1at7  ( 2019-08-03 05:51:46 -0600 )edit

i even tried instaling LSB but it shows

E: Malformed entry 1 in list file /etc/apt/sources.list.d/ros-latest.list (Suite)
E: The list of sources could not be read.
1at7 gravatar image 1at7  ( 2019-08-03 05:53:16 -0600 )edit

Ah, that would appear to be your problem: it's likely that apt install ros-melodic-desktop-full didn't actually succeed. Didn't you get an error?

I'm pretty sure that the fact that lsb_release doesn't work is the cause of your problems.

What is the output of cat /etc/apt/sources.list.d/ros-latest.list?

gvdhoorn gravatar image gvdhoorn  ( 2019-08-03 06:05:21 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-08-03 06:23:07 -0600

gvdhoorn gravatar image

updated 2019-08-03 06:26:45 -0600

it gives


(lsb_release -sc) main

The problem most likely is that lsb_release has not been setup/installed correctly, which causes the command given in the installation tutorials to produce incorrect output, leading to a malformed ros-latest.list, which then causes apt to fail downloading indices from the ROS package repositories, leading to apt install never succeeding to install ROS.

Steps to fix:

sudo sh -c 'echo "deb bionic main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt clean && sudo apt update

Pay special attention to the output of apt update. It should not report any errors or warnings.

Now you should be able to run sudo apt install ros-melodic-desktop-full successfully, and a source /opt/ros/melodic/setup.bash should also succeed.

Note that we're avoiding the use of lsb_release -sc here by just specifying the bionic value (which is the codename of your Ubuntu distribution). If you'd like to fix lsb_release (and are sure lsb_release -sc doesn't actually output anything) you could try to do something like sudo apt install --reinstall lsb-release lsb-core and see if lsb_release -sc starts working.

edit flag offensive delete link more


thank god it worked finally.. i am really noob in linux X)

1at7 gravatar image 1at7  ( 2019-08-03 06:33:51 -0600 )edit

Does it now work?

i am really noob in linux

If you're planning on using ROS, it would be good to get familiar with Linux (or just Ubuntu) a bit more. It will probably help make all of this less 'magic' and complicated.

gvdhoorn gravatar image gvdhoorn  ( 2019-08-03 06:34:32 -0600 )edit

ya sure. btw thanks for support and quick response. and it worked and now I have running ros core. thanks again..

1at7 gravatar image 1at7  ( 2019-08-03 06:45:57 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-08-02 05:56:56 -0600

Seen: 2,158 times

Last updated: Aug 03 '19