Ask Your Question

Why shell is crashing using "source /opt/ros/kinetic/setup.bash" after standard installation approach with ubuntu 16.04 xenial?

asked 2017-01-10 06:34:04 -0500

rosrud gravatar image

updated 2017-01-10 08:13:08 -0500

Hey everyone, recently i tried to install ros with the standard installation method from with the follwing steps:

sudo sh -c '. /etc/lsb-release && echo "deb $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'


sudo apt-key adv --keyserver hkp:// --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116


sudo apt-get update


sudo apt-get install ros-kinetic-desktop-full


sudo rosdep init
rosdep update

Warning: running 'rosdep update' as root is not recommended. You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.

sudo rosdep fix-permissions


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

....and this is what i'm encountering in my console:

File "<string>", line 1
    import os; print(os.pathsep.join([x for x in "/opt/ros/kinetic/bin:/home/inecho/bin:/home/inecho/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/sk/android-sdk-linux/tools:/usr/local/cuda/bin:/home/sk/android-sdk-linux/platform-tools".split(os.pathsep) if not any([d for d in ['cturtle', 'diamondback', 'electric', 'fuerte'] if d in x])]))
SyntaxError: invalid syntax
bash: cat: No such file or directory
bash: cat: No such file or directory
bash: python: No such file or directory
bash: awk: No such file or directory
bash: grep: No such file or directory

Afterwards i am not able to type any of shell-commands like ls until i uncomment the line in ~/.bashrc again. This is what happens:

inecho@inecho-P50:~$ ls
bash: ls: No such file or directory

Does anyone has a clue whats happening there?

The last lines of my .bashrcnow with the uncommented setup.bash:

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion

export PATH=${PATH}:/home/sk/android-sdk-linux/tools:/usr/local/cuda/bin
export PATH=${PATH}:/home/sk/android-sdk-linux/platform-tools
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
# source /opt/ros/kinetic/setup.bash
edit retag flag offensive close merge delete



Is your shell actually bash?

Also: it would probably help if you posted some lines from your .bashrc file, preferably the ones surrounding the source /opt/ros/.. line.

gvdhoorn gravatar image gvdhoorn  ( 2017-01-10 07:23:35 -0500 )edit

yes, my shell is bash. i double checked it with echo $SHELL. i updated my post with the last lines of my .bashrc if it helps

rosrud gravatar image rosrud  ( 2017-01-10 08:09:02 -0500 )edit

Where is your JAVA_HOME being set? What does your /etc/environment file look like? What about echo $PATH

Michael Johnson gravatar image Michael Johnson  ( 2017-01-10 08:20:36 -0500 )edit

my /etc/enviroment says PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java". How can i interpret this? Btw. i'm using linux for a half a year actively so i'm quite unexperienced :)

rosrud gravatar image rosrud  ( 2017-01-10 08:40:42 -0500 )edit

If that is all one line, try splitting it in two and then source /etc/environment. I think that should fix it.

Michael Johnson gravatar image Michael Johnson  ( 2017-01-10 08:48:33 -0500 )edit

i changed it without any improvement. still the same error..

rosrud gravatar image rosrud  ( 2017-01-10 09:09:41 -0500 )edit

Hmm, what does echo $PATH output?

Michael Johnson gravatar image Michael Johnson  ( 2017-01-10 09:12:52 -0500 )edit

the same as above for PATH and additionallyJAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/sk/android-sdk-linux/tools:/usr/local/cuda/bin:/home/sk/android-sdk-linux/platform-tools

rosrud gravatar image rosrud  ( 2017-01-10 09:33:51 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-11 04:34:33 -0500

Michael Johnson gravatar image

So I managed to reproduce this problem by modifying my /etc/environment file to match your one line and then restarting:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java"



To fix this I was able to split the line in two and then restart (relog should work as well).

This seems to be a bug in either python os library or the ROS scripts usage of it as sourcing that file should work even if they are on a single line.

p.s. if your terminal can't find the commands again you can copy/paste PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" to get them back.

edit flag offensive delete link more


Thanks a lot! It worked. It was important to perform a reboot, after i seperated the line in two rows and everything went well. So was it the python split-function which couldn't handle this?

rosrud gravatar image rosrud  ( 2017-01-11 05:32:55 -0500 )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

1 follower


Asked: 2017-01-10 06:18:51 -0500

Seen: 1,096 times

Last updated: Jan 11 '17