lightdm forgets to source /etc/profile and ~/.profile

Bug #794315 reported by Anders Kaseorg
74
This bug affects 14 people
Affects Status Importance Assigned to Milestone
Light Display Manager
Fix Released
Medium
Unassigned
lightdm (Debian)
Fix Released
Unknown
lightdm (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: lightdm

/etc/gdm/Xsession had this code:
  # First read /etc/profile and .profile
  test -f /etc/profile && . /etc/profile
  test -f "$HOME/.profile" && . "$HOME/.profile"
  # Second read /etc/xprofile and .xprofile for X specific setup
  test -f /etc/xprofile && . /etc/xprofile
  test -f "$HOME/.xprofile" && . "$HOME/.xprofile"
so that, for example, ~/bin gets added to the path (by the default ~/.profile), and any user-customized environment setup gets run.

After switching from gdm to lightdm, this no longer happens. This is going to be a regression now that lightdm is becoming the default display manager.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: lightdm 0.3.7-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.39-3.10-generic 2.6.39
Uname: Linux 2.6.39-3-generic x86_64
NonfreeKernelModules: openafs
Architecture: amd64
Date: Tue Jun 7 19:27:11 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20101202)
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, no user)
 LANG=en_US.utf8
 LC_MESSAGES=en_US.utf8
 SHELL=/bin/bash
SourcePackage: lightdm
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Anders Kaseorg (andersk) wrote :
Scott Moser (smoser)
Changed in lightdm (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
3vi1 (launchpad-net-eternaldusk) wrote :

I noticed this with the LightDM drops in the oneiric repos today.

Until this is fixed, you don't automatically get ~/bin added to your path.

Revision history for this message
seeker5528 (seeker5528) wrote :

Personally I don't expect '~/.profile' and '/etc/profile' to be sourced if I'm not logging in at the command line.

But I do expect '~/.xprofile' to be sourced when logging in to an X session, which currently doesn't happen.

Revision history for this message
Anders Kaseorg (andersk) wrote :

> Personally I don't expect '~/.profile' and '/etc/profile' to be sourced if I'm not logging in at the command line.

Whether or not you expect it, they were sourced under GDM, so this change is a regression.

(If you have setup that should happen only for interactive shells, it probably belongs in ~/.bashrc, not ~/.profile.)

Changed in lightdm:
status: New → Triaged
importance: Undecided → Medium
Changed in lightdm (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
z3z (z3z) wrote :

Can anyone tell me if this issue relates to a problem I'm having. Basically, my .xmodmap file is not being loaded when I log in (I'm running Oneiric with lightDM). I know there's nothing wrong with my xmodmap file because it works perfectly well in other releases, but it's ignored in Oneiric. There's no error or anything. It's just as if the file isn't there.

Is this likely the same underlying problem or should I submit a separate bug? Would appreciate any advice.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Rrrrube
When using GDM, ~/.Xmodmap is loaded by /etc/gdm/Xsession irrespective of /etc/profile and ~/.profile, so I'd suggest that you file a separate bug.

Revision history for this message
z3z (z3z) wrote :

Will do, thanks.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lightdm - 0.4.0-0ubuntu3

---------------
lightdm (0.4.0-0ubuntu3) oneiric; urgency=low

  * debian/control:
    - Make GTK greeters depend on gnome-icon-theme-full (LP: #796793)
  * debian/Xsession:
  * debian/lightdm.conf:
    - Load profile and X resources when running session (LP: #794315)
      (LP: #795083)
 -- Robert Ancell <email address hidden> Fri, 17 Jun 2011 15:26:59 +1000

Changed in lightdm (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Yves-Alexis Perez (corsac) wrote :

Note that profile is for login shells, it might not be a good idea to source it from DMs, even though gdm does it. PATH might have to be handled differently.

Changed in lightdm:
status: Triaged → Fix Released
Revision history for this message
Markos Chandras (hwoarang) wrote :

Hi,

Please re-open this bug. The bug is still present in 1.0.6

https://bugs.gentoo.org/show_bug.cgi?id=388247

Revision history for this message
Anders Kaseorg (andersk) wrote :

This bug was fixed in the /etc/lightdm/Xsession script, which is part of the Debian/Ubuntu packaging, not upstream:
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/oneiric/lightdm/oneiric/revision/10

So I think this will need to be dealt with on the Gentoo side, and there’s nothing to reopen from here.

Revision history for this message
Markos Chandras (hwoarang) wrote :

Yeah sorry I posted to the wrong bug

Revision history for this message
Marty Vona (vona) wrote :

I thought this was catching me (on oneiric) but it turns out that the only variable that wasn't taking effect from my .profile was LD_LIBRARY_PATH. And that seems to be due to bug 47958.

Revision history for this message
Nikolay Hodyunya (nkhodyunya) wrote :

This bug affects me on 13.04, please re-open.

Revision history for this message
Sergio Callegari (callegar) wrote :

I have .profile not being sourced on kubuntu 13.10 with lightdm-kde.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2014-01-28 18:43, Sergio Callegari wrote:
> I have .profile not being sourced on kubuntu 13.10 with lightdm-kde.

Sounds unlikely to me; it should be sourced in /usr/sbin/lightdm-session.

Please note that this bug was closed 2.5 years ago. You may want to ask for help e.g. at http://askubuntu.com/.

Revision history for this message
Sergio Callegari (callegar) wrote :

You are right. I thought it was not sourced since I was getting an umask different from that set in .profile. But in fact, I am experiencing another bug, where upstart messes the umask set in .profile. Sorry for the noise.

Changed in lightdm (Debian):
status: Unknown → Won't Fix
Revision history for this message
jtniehof (jtniehof) wrote :

Note that the profile is sourced at the top of /usr/sbin/lightdm-session, and the bottom of lightdm-session runs everything in /etc/X11/Xsession.d. The final file is 99x11-common_start, which is exec $STARTUP. Thus this never returns to the exec in lightdm-session. Since 99upstart (from upstart package, so pretty much always present) smashes STARTUP to "init --user", the X session is actually started by upstart--which does not pass through the environment so carefully established in lightdm-session (see "Job environment" in init(5)).

Consensus on askubuntu ( http://askubuntu.com/search?q=profile.d ) seems to be "a graphical login shell is not a login shell," which basically requires the treatment of every new terminal window as a new "login shell" if there's to be a rational environment in there. If this was ever considered a bug, it appears to have reverted now.

I've been digging through this specifically on Xubuntu 14.04, but again, the players involved seem to be pretty deep in the stack.

Changed in lightdm (Debian):
status: Won't Fix → Confirmed
Revision history for this message
seeker5528 (seeker5528) wrote :

Somebody posted a similar issue in the Debian mailing list recently, the recommendation there was to use '~/.xsessionrc'.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2015-03-22 06:06, seeker5528 wrote:
> Somebody posted a similar issue in the Debian mailing list recently,
> the recommendation there was to use '~/.xsessionrc'.

Right. While that works in Ubuntu too, sourcing of /etc/profile and ~/.profile by the DM is established practice in Ubuntu since long, and a difference between the configuration prerequisites in Debian and Ubuntu (unless https://bugs.debian.org/636108 is fixed eventually).

Revision history for this message
seeker5528 (seeker5528) wrote :

Is it a prerequisite?

It was done in the past so there is a strong argument that is should continue.

If it is Ubuntu policy that '~/.profile' get sourced by the display manger, all the display managers should do it and the sample file should not indicate it is intended for the login shell.

Which indicates to me I should not expect '~/.profile' to get sourced if a display manager is handling the login or if I am starting one shell from another shell.

If it is not policy then various places where these things are documented should give more complete information on when you should expect it to work.

https://help.ubuntu.com/community/EnvironmentVariables

Gives the expectation it should work...

But right after they link to

http://userbase.kde.org/Session_Environment_Variables/en

Which does not say anything about '/etc/profile' or '~/.profile'.

So should I take it that I should not expect kdm to source these files or is the sole purpose of the link to give you additional KDE specific options?

And I don't see on the community documentation page anyting about '~/.xsessionrc' (Debian) or '~/.xprofile' (Redhat).

Should we expect one or both of these to work and should we expect them to continue working in the future with Mir and Wayland?

More discussion there than should be had in a bug report for lightdm, presenting them here so the questions are out there for future thought.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2015-03-22 20:02, seeker5528 wrote:
> Is it a prerequisite?

Maybe a bad choice of words.

> It was done in the past so there is a strong argument that is should
> continue.

Right.

> If it is Ubuntu policy that '~/.profile' get sourced by the display
> manger, ...

Well, I'm not the one who should make statements about the "policy", but I made a couple of remarks below.

> https://help.ubuntu.com/community/EnvironmentVariables
>
> Gives the expectation it should work...

Actually I have edited that page, and in connection with doing so I started a thread on the topic at the ubuntu-devel mailing list.

https://lists.ubuntu.com/archives/ubuntu-devel/2013-December/037899.html

> But right after they link to
>
> http://userbase.kde.org/Session_Environment_Variables/en
>
> Which does not say anything about '/etc/profile' or '~/.profile'.
>
> So should I take it that I should not expect kdm to source these files
> or is the sole purpose of the link to give you additional KDE specific
> options?
>
> And I don't see on the community documentation page anyting about
> '~/.xsessionrc' (Debian) or '~/.xprofile' (Redhat).

Well, the page is part of an Ubuntu resource, and not an everything Linux ditto. It's also a wiki page, so you are free to edit it. ;) OTOH, I doubt that adding info about all configuration file variants in every Linux distro would be an improvement...

> More discussion there than should be had in a bug report for lightdm,
> presenting them here so the questions are out there for future thought.

Since this bug report was closed long ago, it's unlikely that this is a proper place for your thoughts. I would recommend that you bring the matter up on the ubuntu-devel or ubuntu-devel-discuss mailing list.

Revision history for this message
Sergio Callegari (callegar) wrote :

Same happens with kubuntu vivid and sddm. Should this be fixed individually in each session manager?

Revision history for this message
Derek Martin (code-pizzashack) wrote :

Sigh. Display managers should NEVER source .profile at all... that file is exclusively for interactive shells, as is explicitly stated in all of the man pages of every shell ever. I just opened Bug #1468832 about this, where I also explained how to properly accomplish what people want here.

Revision history for this message
Derek Martin (code-pizzashack) wrote :

See also Bug #1468834.

Revision history for this message
Daniel Colascione (dancolg) wrote :

Derek, sourcing .profile makes perfect sense. You can't rely on having a terminal or really being interactive or anything else _anyway_, and in practice, long experience shows that sourcing profile in Xsession actually doesn't cause any problems in practice. Display managers should _always_ source .profile.

Changed in lightdm (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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