$PATH does not contain /usr/games on Ubuntu Oneiric (11.10) - /etc/environment not sourced or environment not preserved

Bug #798277 reported by Hans Joachim Desserud on 2011-06-16
This bug affects 6 people
Affects Status Importance Assigned to Milestone
lightdm (Ubuntu)
Robert Ancell
Robert Ancell

Bug Description

Steps to reproduce:
1. Open a terminal.
2. Run "echo $PATH"

Expected result: the path contains the folder /usr/games like on earlier releases of Ubuntu.
Actual result: PATH does not include /usr/games

path i natty:

path i oneiric:

For some reason /usr/games is missing in Oneiric, which results in games not being run without specifying the complete path. For instance to run gbrainy, /usr/games/gbrainy is necessary.

Also notice that /usr/bin and /usr/sbin have reversed order in Oneiric, though I'm not sure if this is related.

I have unfortunately not been able to discover which package is responsible for path, so I have not assigned this bug to a package.

Charlie Kravetz (charlie-tca) wrote :

Thanks for reporting this bug and any supporting documentation. Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here.

I am seeing this same issue using Xubuntu Oneiric Ocelot, up-to-date as of 2011-06-16. It seems like /etc/environment is being ignored, but maybe what is in there is being over-ridden by something. A path change in /etc/environment is ignored, as are all locale settings such as LC_MESSAGES, LANGUAGE, and others.

Thanks for taking the time to make Ubuntu better!

affects: ubuntu → xdg-utils (Ubuntu)
Changed in xdg-utils (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Ian Corne (icorne) wrote :

Added: When you do run the binaries:

$ cube
Command 'cube' is available in '/usr/games/cube'
The command could not be located because '/usr/games' is not included in the PATH environment variable.
cube: command not found

Jean-Baptiste Lallement (jibel) wrote :

Hans Joachim and Charlie both use lightdm.
$PATH is defined in /etc/environment which is sourced from the upstart job /etc/init/lightdm.conf
related issues in lightdm: bug 794315 and bug 793366

Moving to lightdm.

affects: xdg-utils (Ubuntu) → lightdm (Ubuntu)
Changed in lightdm (Ubuntu):
status: Confirmed → Triaged
summary: - $PATH does not contain /usr/games on Ubuntu Oneiric (11.10)
+ $PATH does not contain /usr/games on Ubuntu Oneiric (11.10) -
+ /etc/environment not sourced or environment not preserved
Robert Ancell (robert-ancell) wrote :

I am still trying to work out how /etc/environment is supposed to be correctly sourced. I can't find out how GDM or even login is loading it. It's very confusing.

Colin Watson (cjwatson) wrote :

It's read by pam_env. /etc/pam.d/lightdm is using that in the same position as /etc/pam.d/gdm, but perhaps lightdm's PAM communication is different such that environment variables set at the auth stage are thrown away by the time it gets to starting a session; it might be productive to try moving pam_env from auth to session?

Colin Watson (cjwatson) wrote :

This probably also causes bug 799608.

Changed in lightdm (Ubuntu Oneiric):
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
Martin Pitt (pitti) on 2011-07-01
Changed in lightdm (Ubuntu Oneiric):
assignee: Canonical Desktop Team (canonical-desktop-team) → Robert Ancell (robert-ancell)
RapierTG (rapier) wrote :

Im using gdm and am facing same issue. echo $PATH gives:


Robert Ancell (robert-ancell) wrote :

This is fixed in master - it was due to incorrect usage of PAM. It will be in the next release.

Changed in lightdm (Ubuntu Oneiric):
status: Triaged → In Progress
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lightdm - 0.4.2-0ubuntu1

lightdm (0.4.2-0ubuntu1) oneiric; urgency=low

  * New upstream release
    - Fixes (LP: #798277)
  * debian/lightdm.upstart:
    - Don't source /etc/environment or /etc/default/locale - this is done in PAM
  * debian/Xsession:
    - Handle X resource directory being empty (LP: #800193)
 -- Robert Ancell <email address hidden> Tue, 05 Jul 2011 15:22:12 +1000

Changed in lightdm (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Yves-Alexis Perez (corsac) wrote :

PATH is not guaranteed to be defined in /etc/environment so it might make sense to default to a sensible value.

Other DMs seem to do something like:


/etc/profile (which is about login shells) do:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" for root
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" for normal users

Yves-Alexis Perez (corsac) wrote :

Something like that should work (but need testing). The default PATHs are currently #define'd in session.h, it might make sense to put them in the config file.

Yves-Alexis Perez (corsac) wrote :

Ok, previous path has no chance to work since env is not yet exported, so g_getenv() won't return anything.

This one should do the work.

Robert Ancell (robert-ancell) wrote :

Hi Yves-Alexis,

I did a lot of work rearranging the code there. It now sets a default PATH. Please open a bug if this is not working.


Lionel Le Folgoc (mrpouit) wrote :

> child_process_set_env (CHILD_PROCESS (display->priv->user_session), "PATH", "/usr/local/bin:/usr/bin:/bin");

The default path in the code is still missing /usr/games. It should probably be something like "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games".

Robert Ancell (robert-ancell) wrote :

This is the default path, it is overriden by PAM who gets the path from /etc/environment

Yves-Alexis Perez (corsac) wrote :

In my case there's nothing in /etc/environment and PATH lacks /usr/games. I see in the code that there's an explicit propagation of PATH from the current environment to the session environment, but it doesn't seem to be enough.

Robert Ancell (robert-ancell) wrote :

It used to propogate the path, but it no longer does this. The default path is hard-coded to "/usr/local/bin:/usr/bin:/bin". This is the same behaviour as GDM and I think this is a sane default. I'm not sure of a standard to refer to to set the default path to.

Yves-Alexis Perez (corsac) wrote :

Well, it seems that it's not a good default, seeing the current bug. I already gave the current defaults in Debian. We currently ship this patch to tune the PATH depending on the user beeing root or not.

Robert Ancell (robert-ancell) wrote :

Colin, can you comment on what the default PATH should contain?

Yves-Alexis Perez (corsac) wrote :

Here's an updated patch

Robert Ancell (robert-ancell) wrote :

Yves-Alexis - can you confirm stock lightdm doesn't do the right thing on Debian? We're using LightDM on Ubuntu without this patch and I do have /usr/games in my path - it's coming from /etc/environment. As I said we're doing the same thing as GDM afaict.

Yves-Alexis Perez (corsac) wrote :

/etc/environment is empty on Debian. I picked up the correct PATH from gdm so at least at one point it was the default used by gdm (2 I guess).

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

Duplicates of this bug

Other bug subscribers