RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1728330 - $HOME/.profile not sourced on graphical login - .bash_profile is sourced
Summary: $HOME/.profile not sourced on graphical login - .bash_profile is sourced
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: gdm
Version: 8.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: Ray Strode [halfline]
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-09 17:18 UTC by Paulo Andrade
Modified: 2023-10-06 18:25 UTC (History)
8 users (show)

Fixed In Version: gdm-3.28.3-28.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:09:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
The proposed fix does not sort the bug for me - see comment (4.22 KB, application/octet-stream)
2020-03-21 15:50 UTC, Roger Sewell
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-24226 0 None None None 2021-10-26 08:10:53 UTC
Red Hat Product Errata RHSA-2020:1766 0 None None None 2020-04-28 16:10:07 UTC

Description Paulo Andrade 2019-07-09 17:18:38 UTC
User tells .profile is sourced with Gnome classic but not with
Gnome standard login.

  The issue happens when the user has /bin/ksh as login shell, as only
ksh loads .profile on login shells.

  It works as expected for bash, but for ksh needs customizations. It
should work for ksh users as well, that is, when starting a terminal,
environment variables set in ~/.profile should be available.

  If the issue is for another component, please reassign.

Comment 1 Florian Müllner 2019-07-10 16:40:46 UTC
Moving to gdm, which afaics is the only component that sources any shell configuration.

Comment 2 Ray Strode [halfline] 2019-07-10 17:31:16 UTC
it's actually /usr/bin/gnome-session that does it:

    exec bash -c "exec -l '$SHELL' -c '$0 -l $*'"•

But since it does it, i'm a little confused why it's not working.

is /bin/ksh in /etc/shells?

Comment 3 Paulo Andrade 2019-07-10 18:04:43 UTC
  Thanks for the analysis.

  Better checking, I believe this is actually an issue with ksh.

  For example, in rhel8 (but same on recent fedora or rhel7):

[pcpa@rhel8 ~]$ env -i bash -l -c 'echo $SHELL'
/bin/bash

[pcpa@rhel8 ~]$ env -i ksh -l -c 'echo $SHELL'
/etc/profile[59]: id: not found [No such file or directory]
/etc/profile[59]: id: not found [No such file or directory]
/usr/libexec/grepconf.sh: line 5: grep: command not found
/usr/libexec/grepconf.sh: line 5: grep: command not found
/usr/libexec/grepconf.sh: line 5: grep: command not found
/etc/profile[70]: .[248]: sed: not found [No such file or directory]
/bin/sh

ksh does not have a reasonable default $PATH and "really" sets $SHELL to
bash as /bin/sh is a symlink to bash.

Comment 4 Paulo Andrade 2019-07-10 18:12:10 UTC
  This issue was initially reported to gnome-session, but the problem should
be indeed with ksh.

  In the previous comment it shows that ksh does not have some good defaults
for both $PATH and the default $SHELL actually is /bin/sh.

  This causes problems on graphical login, as .profile ends up not being sourced
when an user has /bin/ksh as user login shell.

Comment 5 Ray Strode [halfline] 2019-07-10 18:44:55 UTC
not sure i understand what you're saying.

SHELL and PATH are set by GDM before ksh even enters the picture.

can you attach /etc/shells and the output of

$ getent passwd kshuserhere

Comment 7 Ray Strode [halfline] 2019-07-12 17:01:02 UTC
hmm seems to work here.  is this wayland or xorg ?

echo $XDG_SESSION_TYPE

Comment 8 Paulo Andrade 2019-07-12 18:10:56 UTC
While checking a strace, I noticed the user has it set to x11, and
asked the user to test this pseudo patch to /usr/bin/gnome-session:

- if [ "x$XDG_SESSION_TYPE" = "xwayland" ] &&
- if [ "x$XDG_SESSION_TYPE" = "xwayland" -o "x$XDG_SESSION_TYPE" = "xx11" ] &&

BTW, on my tests, it always executes xinitrc-common, but that is not
the case for the user. Any idea of what might cause that? I ask because
/etc/X11/xinitrc-common sources $HOME/.profile if it exists.

Comment 9 Ray Strode [halfline] 2019-07-12 19:37:36 UTC
normally it would be decided by the X-GDM-BypassXsession key in the session file in /usr/share/xsessions (defaults to false meaning "run xsession" for x sessions)

Comment 10 Paulo Andrade 2019-07-15 14:16:27 UTC
User tells the suggest patch to /usr/bin/gnome-session corrects the problem.

Do you have some suggestion on how to further investigate it? I mean, in my
tests, adding:

WaylandEnable=false

to /etc/gdm/custom.conf still properly did source ~/.profile, and the user
does not have any X-GDM-BypassXsession key in the session files under
/usr/share/xsessions.

Comment 11 Ray Strode [halfline] 2019-07-15 14:18:10 UTC
can you have them put Enable=true in the [debug] section of /etc/gdm/custom.conf, reboot, reproduce and then attach the full journalctl -b output?

Comment 21 Roger Sewell 2020-03-21 15:50:48 UTC
Created attachment 1672224 [details]
The proposed fix does not sort the bug for me - see comment

I saw this bug, and I (a different user) am seeing something very similar which is NOT fixed by the proposed fix.

If I understand it right the proposed fix is to recursively call gnome-session via a login shell when XDG_SESSION_TYPE is x11 as well as when it's wayland.

This works for me when my shell is set to /bin/bash . However, it does not work when my shell is set to /bin/tcsh (having yum installed the relevant package).

I was at the time using the X11 GNOME standard Xorg choice at the login screen, and CentOS 8.1 .

The result is that my ~/.login file doesn't get sourced, and my path doesn't start from where it should do.

In order to try to get further with understanding what is going on, I made alternative versions of /usr/bin/gnome-session (and some of the files in /etc/X11/xinit, which I think are irrelevant, though they were relevant when comparing what happens with CentOS 7.7), with filenames appended with .debugging in the attachment, which I put in place of the originals. I put a command to add ~/quack to my path in my ~/.login file. I then tried logging in to see what happens. The resulting file of logging points is attached as /home/rfs/temp/templog . At each logging point the last output is 0 if quack is on the path, and 1 if quack is not on the path.

In tcsh $version gives me "tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec". yum list installed tcsh gives me "tcsh.x86_64 6.20.00-9.el8 @AppStream".

As far as I can tell, when my shell is set to /bin/tcsh, when the recursive call to gnome-session is made at line 36 of the debugging version of the file (which has the additional x11 reason for doing a recursive call):

a) The call to /bin/tcsh is indeed made in such a way that the zeroth parameter arriving in /bin/tcsh is -/bin/tcsh, as it should be, to flag that a login shell is wanted;

b) When called at this point /bin/tcsh does NOT result in ~/.login being sourced; but

c) When called by a similar call from a script in my home directory, a virtually identical call does result in ~/.login being sourced (as recorded in the logging file).

I'm afraid that's as far as I've been able to get - the behaviour seems very odd.

Comment 25 errata-xmlrpc 2020-04-28 16:09:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1766


Note You need to log in before you can comment on or make changes to this bug.