$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
52
This bug affects 6 people
Affects Status Importance Assigned to Milestone
lightdm (Ubuntu)
Fix Released
High
Robert Ancell
Oneiric
Fix Released
High
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:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

path i oneiric:
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin/bin

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.

Revision history for this message
Charlie Kravetz (cjkgeek) 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
Revision history for this message
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

Revision history for this message
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
Revision history for this message
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.

Revision history for this message
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?

Revision history for this message
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)
Changed in lightdm (Ubuntu Oneiric):
assignee: Canonical Desktop Team (canonical-desktop-team) → Robert Ancell (robert-ancell)
Revision history for this message
RapierTG (rapier) wrote :

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

/usr/local/bin:/usr/bin:/bin

Revision history for this message
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
Revision history for this message
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
Revision history for this message
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:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

/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

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

Thanks!

Revision history for this message
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".

Revision history for this message
Robert Ancell (robert-ancell) wrote :

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

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

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

Revision history for this message
Yves-Alexis Perez (corsac) wrote :

Here's an updated patch

Revision history for this message
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.

Revision history for this message
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  
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.