You are not logged in.

#1 2016-10-13 14:17:28

StR@ng3r
Member
Registered: 2011-11-12
Posts: 65

GDM with Gnome on wayland: /etc/profile not being sourced

Hey archers,

I am using Gnome with Wayland and GDM.

/etc/profile does not get sourced as to my understanding Wayland does not utilize a login shell, resulting in an incomplete $PATH since the environment variables aren't set. How do you guys solve that?

Does anybody know how Fedora 25 handles it?

Offline

#2 2016-10-13 21:00:14

TheDemz
Member
Registered: 2015-08-22
Posts: 12

Re: GDM with Gnome on wayland: /etc/profile not being sourced

After update, my .Xresources was not loaded on startup.

Also using Gnome and GDM.

Uncommented the WaylandEnable=false in /etc/gdm/custom.conf and then the resources was loaded.

Dont know what is going on with Wayland.

Last edited by TheDemz (2016-10-13 21:00:42)

Offline

#3 2016-10-13 22:30:13

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 675

Re: GDM with Gnome on wayland: /etc/profile not being sourced

OP, this is https://bugzilla.gnome.org/show_bug.cgi?id=736660.

After the Wayland update yesterday, I just moved my personal additions (e.g. add ~/bin to PATH) from ~/.profile to ~/.bashrc. Not sure if this is the best fix.

Offline

#4 2016-10-14 01:40:27

-MacNuke-
Member
Registered: 2013-01-29
Posts: 25

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Well, this can be a pretty serious problem I think... even if you not changed anything by yourself there are a couple of paths missing (i.e. if you have Java installed)

For me:
Wayland $PATH: /usr/local/bin:/usr/local/sbin:/usr/bin

Xorg $PATH: /usr/lib/hardening-wrapper/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

So... any package related PATH setting is gone under a Wayland session. I think ArchLinux should react somehow instead of leaving users with incomplete environments.

Last edited by -MacNuke- (2016-10-14 01:44:01)

Offline

#5 2016-10-14 06:18:28

lyman
Member
From: China
Registered: 2008-01-13
Posts: 21
Website

Re: GDM with Gnome on wayland: /etc/profile not being sourced

This works! Thank you for saving me from being not able to use IM (input method, configured in ~/.xprofile)!

TheDemz wrote:

After update, my .Xresources was not loaded on startup.

Also using Gnome and GDM.

Uncommented the WaylandEnable=false in /etc/gdm/custom.conf and then the resources was loaded.

Dont know what is going on with Wayland.


arch x86_64 on Dell E7450

Offline

#6 2016-10-14 16:00:50

StR@ng3r
Member
Registered: 2011-11-12
Posts: 65

Re: GDM with Gnome on wayland: /etc/profile not being sourced

While this works, that's hardly a solution, is it?

Offline

#7 2016-10-19 03:28:08

Dreaming in Code
Member
Registered: 2014-08-16
Posts: 22

Re: GDM with Gnome on wayland: /etc/profile not being sourced

I can source it manually in bash with

for file in /etc/profile.d/*.sh; do source "${file}"; done

But some of my launchers disappear because gnome cannot find the command, and any program starting from gnome won't get the envs.

Offline

#8 2016-10-19 20:32:01

TheDemz
Member
Registered: 2015-08-22
Posts: 12

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Environment variables

For setting up session-wide environment variables, gdm supports the /usr/share/gdm/env.d/ drop-in directory. Files dropped in there are text files containing a series of VARIABLE=VALUE assignments.

A complication with environment variables is that both systemd -user and D-Bus have their own 'activation environments': the environments that are inherited by the services they start. Use dbus-update-activation-environment --systemd DISPLAY LANG WHATEVER or dbus-update-activation-environment --systemd --all to update both.

Starting session services

For starting services, there are various alternatives: D-Bus activation, systemd user services, xdg autostart files. Autostart files and systemd services can have conditions that control their activation.

https://wiki.gnome.org/Initiatives/Wayland/SessionStart

So to run a script per user, create a user specific systemd ?
If any could make an example would be awesome.

https://wiki.archlinux.org/index.php/Systemd/User

Check if it realy is a wayland GDM session ?

X-GDM-Session-Type=wayland

https://wiki.gnome.org/Initiatives/Wayland/gdm

Offline

#9 2016-10-19 20:42:07

TheDemz
Member
Registered: 2015-08-22
Posts: 12

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Provide means to handle user environment configuration

At the moment there's no good answer for users who want to set
environment variables for their session. Users have in the past used
their .bashrc or .bash_profile to accomplish this task, but sourcing
a tower of shell scripts at login time is suboptimal, so wayland
sessions aren't run through a login shell.

Some distributions use pam_env, but the way it's set up from distro to
distro varies, and its file format is strange.

See https://bugzilla.gnome.org/show_bug.cgi?id=736660

Furthermore, services themselves may want to affect the user session
environment. flatpak, for instance, needs to modify XDG_DATA_DIRS to
work correctly. There's no good way to achieve this at the moment.

See alexlarsson/xdg-app#147

This patchset tries to solve the problem in systemd by:

Augmenting the DefaultEnvironment option of user.conf to have a new
DefaultEnvironmentFile next to it. It follows the same format as
EnvironmentFile inside service files.

Augmenting user.conf to support certain specifiers. This is needed
to allow %h (the home dir) to be referenced from user.conf

Augmenting EnvironmentFile (and DefaultEnvironmentFile) to support
environment variable expansion using the ${VAR} format. This is
handled in a backward compatible way by requiring the glob pattern to
be prefixed with a special character (':').

For symmetry, augmenting Environment (and DefaultEnvironment) to
support environment variable expansion if a ':' prefix is provided.

Shipping a default user.conf.d snippet that configures user sessions
to read environment variables from:

/etc/environment (to take over from pam_env)
~/.config/environment.d (to give the user a place to put additions)
/usr/lib/environment.d (to give services a place to put additions)

Changing pam_systemd to import the systemd --user environment into
sessions as they get opened.

https://github.com/systemd/systemd/pull/3904

Offline

#10 2016-10-24 06:11:26

TheDemz
Member
Registered: 2015-08-22
Posts: 12

Re: GDM with Gnome on wayland: /etc/profile not being sourced

https://wiki.archlinux.org/index.php/En … ng_pam_env

~/.pam_environment

XENVIRONMENT             DEFAULT=@{HOME}/.Xresources

By setting the environment variable per user, the .Xresources is available again.

Offline

#11 2016-11-17 19:28:00

DJ_L
Member
Registered: 2014-03-22
Posts: 10

Re: GDM with Gnome on wayland: /etc/profile not being sourced

I realize a bit late, but until upstream formally decides on a unified method, exact old behavior can be obtained by modifying gnome-session (it's just a shell script). Discussed it with another dev last night, and I think the KISS method is likely to win out in our little camp for the time being. That said, it'll probably be decided tomorrow now that I finally found this thread again and posted this! :-) Could use /etc/gdm/Xsession as a guide (don't source directly though, that's GDM's environment, not a user's).

HTH

Offline

#12 2016-11-18 01:45:27

Dreaming in Code
Member
Registered: 2014-08-16
Posts: 22

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Note that `/etc/profile.d` has been working now with GNOME 3.22.2.

Sorry for being misleading, it might be because of my switching back to Xorg due to another issue.

Last edited by Dreaming in Code (2016-11-29 02:40:50)

Offline

#13 2016-11-22 15:48:45

-MacNuke-
Member
Registered: 2013-01-29
Posts: 25

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Are you sure it works now? Do I miss something here? It does not work for me. My PATH is still "/usr/local/bin:/usr/local/sbin:/usr/bin".

Last edited by -MacNuke- (2016-11-22 15:49:28)

Offline

#14 2016-11-28 15:08:38

kgizdov
Package Maintainer (PM)
From: Edinburgh, UK
Registered: 2015-12-08
Posts: 113

Re: GDM with Gnome on wayland: /etc/profile not being sourced

-MacNuke- wrote:

Are you sure it works now? Do I miss something here? It does not work for me. My PATH is still "/usr/local/bin:/usr/local/sbin:/usr/bin".

I just came here because it suddenly started working for me big_smile. I think you might have your path setup statically somewhere and you need to remove it. For example, oh-my-zsh sets a static PATH on update, hence if you updated while having the previous version running, you will end up with the wrong static PATH. Check also your /etc/environment and ~/.pam_environment files. For me it works really well now.

Sorry, it does not work for me either. I was logged in through Xorg. Can the people for which it works give some details on their setup?

Last edited by kgizdov (2016-11-28 15:42:11)

Offline

#15 2016-12-05 13:25:06

jugs
Member
Registered: 2007-12-05
Posts: 39

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Are there any updates on this? It's a pretty major bug.

Offline

#16 2016-12-05 15:14:38

seth
Member
Registered: 2012-09-03
Posts: 58,779

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Did you try looking at the upstream bug (linked here before) ...?
https://bugzilla.gnome.org/show_bug.cgi?id=736660

Offline

#17 2016-12-22 14:43:36

kgizdov
Package Maintainer (PM)
From: Edinburgh, UK
Registered: 2015-12-08
Posts: 113

Re: GDM with Gnome on wayland: /etc/profile not being sourced

@seth, I just had a look again at that thread and tried the last solution. It seems to work. I will test for a few days before sticking with it, but I think for now I am satisfied. What I did was this:

--- /usr/bin/gnome-session.old  2016-12-22 14:30:16.118497829 +0000
+++ /usr/bin/gnome-session      2016-12-22 14:35:16.069513827 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/zsh -l
 
 SETTING=$(gsettings get org.gnome.system.locale region)
 REGION=${SETTING#\'}

Obviously, this assumes you are using ZSH as your user shell.

Last edited by kgizdov (2016-12-22 14:56:03)

Offline

#18 2017-01-19 10:13:14

j1simon
Member
From: Denmark
Registered: 2016-01-28
Posts: 189

Re: GDM with Gnome on wayland: /etc/profile not being sourced

kgizdov wrote:

@seth, I just had a look again at that thread and tried the last solution. It seems to work. I will test for a few days before sticking with it, but I think for now I am satisfied. What I did was this:

--- /usr/bin/gnome-session.old  2016-12-22 14:30:16.118497829 +0000
+++ /usr/bin/gnome-session      2016-12-22 14:35:16.069513827 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/zsh -l
 
 SETTING=$(gsettings get org.gnome.system.locale region)
 REGION=${SETTING#\'}

Obviously, this assumes you are using ZSH as your user shell.

Thanks, I had the same problem and with your solution, it works well now.

Offline

#19 2017-02-07 10:15:48

Depado
Member
Registered: 2013-02-28
Posts: 49

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Hey there I'm having the same issue here.

Environment variables
For setting up session-wide environment variables, gdm supports the /usr/share/gdm/env.d/ drop-in directory. Files dropped in there are text files containing a series of VARIABLE=VALUE assignments.
From this page : Wayland Session start

Did anyone give that solution a try ? As I understand this, you can set session wide environment variables from within that file although I quite don't see how it's possible to have some user-specific environment variables.
Or maybe someone solved that issue ?

Offline

#20 2017-02-07 23:38:04

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 675

Re: GDM with Gnome on wayland: /etc/profile not being sourced

Depado wrote:

Or maybe someone solved that issue ?

This is my temporary solution to this problem until the GNOME devs fix it properly. See https://github.com/rmarquis/pacaur/issu … -277485530.

Offline

Board footer

Powered by FluxBB