14

In order to speed up Android development, I've edited my ~/.bashrc to add some paths to PATH:

export PATH=${PATH}:/opt/android-sdk/tools:/opt/android-sdk/platform-tools

This works just fine from the command line (I can just type android and, no matter where I am, the Android SDK and AVD Manager will start up just fine.

However, if I try to type android in the Alt+F2 dialog (Run Application), it gives the following error:

Could not open location 'file:///home/felix/android'

Error stating file '/home/felix/android': No such file or directory

Why is that? What PATH does the Run Application dialog use?

3 Answers 3

19

I assume the bashrc is not read by Gnome, and why should it, since it is a config file for bash.

I define my path in ~/.profile. This file is definitely read by the Gnome and XFCE environments and should by others as well. (But it is read only on login, so you have to log out and back in any the changes to take effect!)

3
  • I moved the PATH= statement to ~/.profile and it works both in Alt+F2 and a terminal. Thanks.
    – Felix
    Jan 6, 2011 at 9:49
  • In my case, I couldn't figure out how to make the X session to start with a login shell so it would read the ~/.profile, so I had to change /bin/sh to point to /bin/dash
    – elias
    Jul 12, 2016 at 14:27
  • 1
    Hey, this is Gnome 3.30.1 speaking, and setting the PATH in ~/.profile does not work anymore. Is there any update on this?
    – iago-lito
    Oct 6, 2018 at 18:34
2

~/.bashrc is included by ~/.profile by default. The ~/bin directory is added to PATH by default too. Create the ~/bin directory and add sym-links (ln -s) to applications you intent to use, or modify your ~/.bashrc.

The default content of the mentioned files can be found in /etc/skel -- used while creating new account and their home directories.

1
  • 1
    Yes, if .profile is being executed by a bash! The conditional checks for the $BASH_VERSION being defined, which Gnome won't do. And by the way, removing the condition will result in problems with some desktop environments, such as LXDE. Jan 6, 2011 at 10:25
0

I had the same issue with Linux Mint (Cinnamon 2.8.8), and there was no way I could get it working with the usual fixes (using a .profile, changing Xsession shebang to /bin/sh -l).

The issue is that /bin/sh, which is usually a symlink to /bin/dash reads ~/.profile if it's a login shell (i.e., given the -l option).

You can check that with strace:

$ strace -e open dash
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/dev/tty", O_RDWR)                = 3
$ ^D
+++ exited with 0 +++
$ strace -e open dash -l
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/dev/tty", O_RDWR)                = 3
open("/etc/profile", O_RDONLY)          = 3
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12260, si_status=0, si_utime=0, si_stime=0} ---
open("/etc/profile.d/Z97-byobu.sh", O_RDONLY) = 3
open("/etc/profile.d/bash_completion.sh", O_RDONLY) = 3
open("/etc/profile.d/vte.sh", O_RDONLY) = 3
open("/home/elias/.profile", O_RDONLY)  = 3
$ ^D
+++ exited with 0 +++

I couldn't figure out which script to change (tried a bunch of them under /etc/X11 and /etc/mdm), but no luck.

So I threw the towel and changed /bin/sh to point to /bin/bash instead of /bin/dash and it's working now. :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .