Cannot start games, wrong $PATH

Bug #778900 reported by Jochen Leonhard
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
ugr-seeds
Confirmed
Critical
Unassigned

Bug Description

can't start foobillard or any other game that is located in /usr/games ,from the menu or from any location Inside a terminal because /usr/games isnt't in the Environment Variable Path.

Revision history for this message
Davide Alberelli (dadexix86) wrote :

Solution/workaround that worked for me:
1) Open the file .bashrc
2) Go to the end of the file
3) Add the direcroty to the path, changing (or adding) this
                          export PATH=$PATH:
into this, adding /usr/games/:
                          export PATH=$PATH:/usr/games/

JC Hulce (soaringsky)
affects: ugr-cantarell → ugr-meta
Revision history for this message
JC Hulce (soaringsky) wrote :

It is known that GNOME 3 messes up the $PATH setting

JC Hulce (soaringsky)
summary: - foobillard doesn't start from the menu
+ Cannot start games, wrong $PATH
Changed in ugr-meta:
status: New → Confirmed
importance: Undecided → High
importance: High → Critical
Revision history for this message
JC Hulce (soaringsky) wrote :

I wonder if it would be possible to ship a patch in a package. I don't think you could ship .bashrc itself, but maybe some symlinks would solve the issue?

Revision history for this message
Davide Alberelli (dadexix86) wrote :

No you can't ship the .bashrc, bacause it is in the user home and it would overwrite the personal one.

Maybe you can symlink the /usr/bin to the /usr/games.
I don't know how the $PATH is generated and from which command.
But i think the best solution is to find this information and add /urs/share/games to the $PATH in this way.

Another way is to create a script (it shouldn't be hard with a little programming skills) that takes the .bashrc file(s), one per user, and search if there is the string
"export PATH*"
If there isn't, it inserts a new line with "export PATH=$PATH:/usr/games/".
If there is, it looks, after that, if there isn't the string ":/usr/games" and adds it.
Otherwise, if this two condition are satisfied, exit without doing anything.

I've got an exam thursday so I can't take this for the moment.
I can do a try after that, but I'll do it in bash. And I don't know how to list all the users in the system (maybe with ls /home can be a good idea).

Revision history for this message
Daniel Sandman (almehdi-deactivatedaccount) wrote :

Wouldn't a *.postinstall or similar with the string: "echo 'export PATH=$PATH:/usr/games/' >> .bashrc" do it? It is a bit ugly but i can't think of a better way.

Revision history for this message
JC Hulce (soaringsky) wrote : Re: [Bug 778900] Re: Cannot start games, wrong $PATH

That seems like one of the better ways to solve this issue. I will start
writing a blueprint in ugr-meta.

Revision history for this message
Davide Alberelli (dadexix86) wrote : Re: [Ubuntugnometeam] [Bug 778900] Re: Cannot start games, wrong $PATH

But you should look before if it isn't already there.
And you should add it to all the users .bashrc :)

2011/5/10 JC Hulce <email address hidden>

> That seems like one of the better ways to solve this issue. I will start
> writing a blueprint in ugr-meta.
>
> --
> You received this bug notification because you are a member of Team UGR,
> which is subscribed to ugr-meta.
> https://bugs.launchpad.net/bugs/778900
>
> Title:
> Cannot start games, wrong $PATH
>
> Status in Ubuntu Gnome Remix Metapackages:
> Confirmed
>
> Bug description:
> can't start foobillard or any other game that is located in /usr/games
> ,from the menu or from any location Inside a terminal because
> /usr/games isnt't in the Environment Variable Path.
>
> --
> Mailing list: https://launchpad.net/~ubuntugnometeam
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~ubuntugnometeam
> More help : https://help.launchpad.net/ListHelp
>

--
Davide Alberelli.
___
OpenPGP: 8CB4467F
___
On Google <http://www.google.com/profiles/dadexix86>,
deviantART<http://dadexix86.deviantart.com/gallery/>and
Facebook <http://www.facebook.com/pages/Davide-Alberelli/135077949894816>.

Revision history for this message
JC Hulce (soaringsky) wrote : [Bug 778900] Re: Cannot start games, wrong $PATH

   @Davide my thoughts exactly - the symlink idea might actually be better.

Revision history for this message
Davide Alberelli (dadexix86) wrote : Re: [Ugr-testing] [Bug 778900] Re: Cannot start games, wrong $PATH

I tried the symlink this way and it doesn't function:
1) $ sudo ln -s /usr/games /usr/bin/games
2) reboot
3) $ ls -l /usr/bin/ | grep games
lrwxrwxrwx 1 root root 11 2011-05-11 01:18 games -> /usr/games/
(so here it is)
4) $ supertuxkart
Command 'supertuxkart' is available in '/usr/games/supertuxkart'
The command could not be located because '/usr/games' is not included in the
PATH environment variable.
supertuxkart: command not found

So this way doesn't function :) Is there another way to create symlinks that
I can try?

2011/5/10 JC Hulce <email address hidden>

> @Davide my thoughts exactly - the symlink idea might actually be
> better.
>
> --
> You received this bug notification because you are a member of Ubuntu
> GNOME Remix: Testing Team, which is subscribed to UGR (Ubuntu Gnome
> Remix) Project.
> https://bugs.launchpad.net/bugs/778900
>
> Title:
> Cannot start games, wrong $PATH
>
> Status in Ubuntu Gnome Remix Metapackages:
> Confirmed
>
> Bug description:
> can't start foobillard or any other game that is located in /usr/games
> ,from the menu or from any location Inside a terminal because
> /usr/games isnt't in the Environment Variable Path.
>
> --
> Mailing list: https://launchpad.net/~ugr-testing
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~ugr-testing
> More help : https://help.launchpad.net/ListHelp
>

--
Davide Alberelli.
___
OpenPGP: 8CB4467F
___
On Google <http://www.google.com/profiles/dadexix86>,
deviantART<http://dadexix86.deviantart.com/gallery/>and
Facebook <http://www.facebook.com/pages/Davide-Alberelli/135077949894816>.

Revision history for this message
Jochen Leonhard (funeralhome) wrote :

I think you are on the wrong The $PATH should be set in /etc/enviroment. take a look here: https://help.ubuntu.com/community/EnvironmentVariables#Session-wide%20environment%20variables. On my system /etc/enviroment contains just one line:
" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" ". That seems OK. The file should be processed by pam : http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/sag-pam_env.html . I don't know why that dosn't work but I try to find it out.
And sorry for picking the wrong package.

Revision history for this message
JC Hulce (soaringsky) wrote :

@Jochen thank you very much

Any new fix ideas anyone?

Changed in ugr-meta:
milestone: none → 1.0.0
Revision history for this message
JC Hulce (soaringsky) wrote :

I did some research on this. See https://help.ubuntu.com/community/EnvironmentVariables
There are several places that we could use to specify $PATH:
===Session-wide environment variables===
    ~/.profile - This is probably the best file for placing environment variable assignments in, since it gets executed automatically by the DisplayManager during the startup process desktop session as well as by the login shell when one logs-in from the textual console.
    ~/.bash_profile or ~./bash_login - If one of these file exist, bash executes it rather then "~/.profile" when it is started as a login shell. (Bash will prefer "~/.bash_profile" to "~/.bash_login"). However, these files won't influence a graphical session by default.
    ~/.bashrc - Because of the way Ubuntu currently sets up the various script files by default, this may be the easiest place to set variables in. The default configuration nearly guarantees that this file will be executed in each and every invocation of bash as well as while logging in to the graphical environment. However, performance-wise this may not be the best thing to do since it will cause values to be unnecessarily set many times.

===System-wide environment variables===
    /etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.
    /etc/profile - This file gets executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the DisplayManager when the desktop session loads. This is probably the file you will get referred to when asking veteran UNIX system administrators about environment variables. In Ubuntu, however, this file does little more then invoke the /etc/bash.bashrc file.
    /etc/bash.bashrc - This is the system-wide version of the ~/.bashrc file. Ubuntu is configured by default to execute this file whenever a user enters a shell or the desktop environment.

Obviously, we shouldn't use the per-user ones because there might be several users on a system. Also, some of these files might already be owned by a package (most are shipped by bash itself). /etc/environment looks like the best option since it is system wide and not owned. Maybe we could ship a custom version of that?

Revision history for this message
Davide Alberelli (dadexix86) wrote : Re: [Ubuntugnometeam] [Bug 778900] Re: Cannot start games, wrong $PATH
Download full text (3.9 KiB)

Ok after this I did a bit try out and /etc/environment doesn't function.

I took away /usr/games from my ~/.bashrc, then restarted and did this:
$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

to be sure /usr/games is in that file.

But it isn't enough:
$ supertuxkart
Command 'supertuxkart' is available in '/usr/games/supertuxkart'
The command could not be located because '/usr/games' is not included in the
PATH environment variable.
supertuxkart: command not found

So any other ideas? :P

2011/5/16 JC Hulce <email address hidden>

> I did some research on this. See
> https://help.ubuntu.com/community/EnvironmentVariables
> There are several places that we could use to specify $PATH:
> ===Session-wide environment variables===
> ~/.profile - This is probably the best file for placing environment
> variable assignments in, since it gets executed automatically by the
> DisplayManager during the startup process desktop session as well as by the
> login shell when one logs-in from the textual console.
> ~/.bash_profile or ~./bash_login - If one of these file exist, bash
> executes it rather then "~/.profile" when it is started as a login shell.
> (Bash will prefer "~/.bash_profile" to "~/.bash_login"). However, these
> files won't influence a graphical session by default.
> ~/.bashrc - Because of the way Ubuntu currently sets up the various
> script files by default, this may be the easiest place to set variables in.
> The default configuration nearly guarantees that this file will be executed
> in each and every invocation of bash as well as while logging in to the
> graphical environment. However, performance-wise this may not be the best
> thing to do since it will cause values to be unnecessarily set many times.
>
> ===System-wide environment variables===
> /etc/environment - This file is specifically meant for system-wide
> environment variable settings. It is not a script file, but rather consists
> of assignment expressions, one per line. Specifically, this file stores the
> system-wide locale and path settings.
> /etc/profile - This file gets executed whenever a bash login shell is
> entered (e.g. when logging in from the console or over ssh), as well as by
> the DisplayManager when the desktop session loads. This is probably the file
> you will get referred to when asking veteran UNIX system administrators
> about environment variables. In Ubuntu, however, this file does little more
> then invoke the /etc/bash.bashrc file.
> /etc/bash.bashrc - This is the system-wide version of the ~/.bashrc
> file. Ubuntu is configured by default to execute this file whenever a user
> enters a shell or the desktop environment.
>
> Obviously, we shouldn't use the per-user ones because there might be
> several users on a system. Also, some of these files might already be
> owned by a package (most are shipped by bash itself). /etc/environment
> looks like the best option since it is system wide and not owned. Maybe
> we could ship a custom version of that?
>
> --
> You received this bug notification because you are a member of Team UGR,
> which is subscribed to ugr-meta.
> ht...

Read more...

Revision history for this message
JC Hulce (soaringsky) wrote :

I really am stuck... /usr/games is in my /etc/environment also, but it appears that file isn't being parsed as expected.

Revision history for this message
Jochen Leonhard (funeralhome) wrote :

I'm stuck too, but it's strange, when I use su $USERNAME the $PATH is correct. It must be overwritten somewhere.

Revision history for this message
Jochen Leonhard (funeralhome) wrote :

GDM overwrittes it. Today i downgraded GDM to the Version natty ships and now $PATH is correct.

Revision history for this message
Jochen Leonhard (funeralhome) wrote :

It is gdm3 there is also a discussion on the gnome3team mailing list:
https://lists.launchpad.net/gnome3-team/msg00217.html

Revision history for this message
Chris Gummin (proxy-qtz-deactivatedaccount) wrote :

Oh! This may be the reason that The Board isn't working!

Revision history for this message
JC Hulce (soaringsky) wrote :

Alright. Because this is caused by GDM (everyone, see this mailing list link if you haven't: https://lists.launchpad.net/gnome3-team/msg00217.html), we can either wait for the GNOME 3 team to fix this or attempt a patch ourselves.

Thanks to everyone for helping out

Revision history for this message
Sander Deryckere (sanderd17) wrote :

If anyone is interested, editng the .profile file to add the path worked for me.

Revision history for this message
23dornot23d (keithaerospace92) wrote :

I did it like this - is this the correct way to do it ?

_________________________________________________

What did you change in here to make it work ok (please) ?
(but editing the .profile file worked)

Needs to do - if it does not exist then add it - otherwise ignore it ......

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

_________________________

so I suppose you could say

# set PATH so it includes /usr/games
if [ -d "/usr/games" ] ; then
PATH="/usr/games:$PATH"
fi

____________________
- will this work ok .... ?

JUST TRIED IT AND IT WORKS SO GUESS SO

Now Alt+F2 works .... gbrainy ...... not that I use it .... but who knows - I might now,

keith@keith-MS-7181:~$ gbrainy
gbrainy 1.65 (built on 2011-04-11 01:01:38 UTC)
Extensions database: /home/keith/.config/gbrainy
Games registered: 157: 60 logic puzzles, 11 calculation trainers, 10 memory trainers, 76 verbal analogies
Startup time 00:00:00.5510620

Revision history for this message
Davide Alberelli (dadexix86) wrote :

The big problem is that if there are more accounts, you have to do it on all
the users accounts.

2011/6/10 23dornot23d <email address hidden>

> I did it like this - is this the correct way to do it ?
>
> _________________________________________________
>
> What did you change in here to make it work ok (please) ?
> (but editing the .profile file worked)
>
> Needs to do - if it does not exist then add it - otherwise ignore it
> ......
>
>
> # ~/.profile: executed by the command interpreter for login shells.
> # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
> # exists.
> # see /usr/share/doc/bash/examples/startup-files for examples.
> # the files are located in the bash-doc package.
>
> # the default umask is set in /etc/profile; for setting the umask
> # for ssh logins, install and configure the libpam-umask package.
> #umask 022
>
> # if running bash
> if [ -n "$BASH_VERSION" ]; then
> # include .bashrc if it exists
> if [ -f "$HOME/.bashrc" ]; then
> . "$HOME/.bashrc"
> fi
> fi
>
> # set PATH so it includes user's private bin if it exists
> if [ -d "$HOME/bin" ] ; then
> PATH="$HOME/bin:$PATH"
> fi
>
>
> _________________________
>
> so I suppose you could say
>
> # set PATH so it includes /usr/games
> if [ -d "/usr/games" ] ; then
> PATH="/usr/games:$PATH"
> fi
>
> ____________________
> - will this work ok .... ?
>
>
> JUST TRIED IT AND IT WORKS SO GUESS SO
>
> Now Alt+F2 works .... gbrainy ...... not that I use it .... but who
> knows - I might now,
>
> keith@keith-MS-7181:~$ gbrainy
> gbrainy 1.65 (built on 2011-04-11 01:01:38 UTC)
> Extensions database: /home/keith/.config/gbrainy
> Games registered: 157: 60 logic puzzles, 11 calculation trainers, 10 memory
> trainers, 76 verbal analogies
> Startup time 00:00:00.5510620
>
> --
> You received this bug notification because you are a member of Team UGR,
> which is subscribed to ugr-meta.
> https://bugs.launchpad.net/bugs/778900
>
> Title:
> Cannot start games, wrong $PATH
>
> Status in Ubuntu Gnome Remix Metapackages:
> Confirmed
>
> Bug description:
> can't start foobillard or any other game that is located in /usr/games
> ,from the menu or from any location Inside a terminal because
> /usr/games isnt't in the Environment Variable Path.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ugr-meta/+bug/778900/+subscriptions
>
> --
> Mailing list: https://launchpad.net/~ubuntugnometeam
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~ubuntugnometeam
> More help : https://help.launchpad.net/ListHelp
>

--
Davide Alberelli.
___
OpenPGP: 8CB4467F
___
On Google <http://www.google.com/profiles/dadexix86>,
deviantART<http://dadexix86.deviantart.com/gallery/>and
Facebook <http://www.facebook.com/pages/Davide-Alberelli/135077949894816>.

Revision history for this message
JC Hulce (soaringsky) wrote :

@Sander/others Does it work if you make the changes in one of the other config files ( https://help.ubuntu.com/community/EnvironmentVariables ) instead? If so, I can make a package that will move aside the original and put in a patched config. Patching ~/.profile is not possible because it is per-user.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.