Bug#724731: XDG_RUNTIME_DIR has incorrect value

Gabriel Mainberger gabisoft at freesurf.ch
Wed Oct 23 13:17:14 UTC 2013


>> What's your $XDG_RUNTIME_DIR environment variable?

My $XDG_RUNTIME_DIR as user gabriel (uid=1000) is "/run/user/0" and 
should in my opinion be "/run/user/1000".

>> If it's /run/user/0, then GLib is behaving as expected, and the bug is
>> in some other component (which should either not set this variable,
>> unset this variable when it switches uid, or set this variable to a more
>> appropriate value for uid 1000).

I agree that Glib is working correctly.

user at machine:~/Work$ echo $XDG_RUNTIME_DIR
/run/user/0
user at machine:~/Work$ ./run
/run/user/0
user at machine:~/Work$ XDG_RUNTIME_DIR=/run/user/1000
user at machine:~/Work$ export XDG_RUNTIME_DIR
user at machine:~/Work$ echo $XDG_RUNTIME_DIR
/run/user/1000
user at machine:~/Work$ ./run
/run/user/1000
user at machine:~/Work$ unset XDG_RUNTIME_DIR
user at machine:~/Work$ ./run
/home/gabriel/.cache

> What seems related is the but in gdm3 which fails to start when
> libpam-systemd is not installed [1].
> libpam-systemd is responsible for creating and setting XDG_RUNTIME_DIR.
> So I assume Gabriel didn't have this package installed. Is that correct?

No, libpam-systemd is installed correctly on my system.

user at machine:~/Work$ dpkg -s libpam-systemd
Package: libpam-systemd
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 64
Maintainer: Debian systemd Maintainers 
<pkg-systemd-maintainers at lists.alioth.debian.org>
Architecture: i386
Multi-Arch: same
Source: systemd
Version: 204-5

> So from a cursory look, it seems like glib is behaving correctly and as
> Simon suspects, some other component simply sets XDG_RUNTIME_DIR to an
> incorrect value.

I agree.

> Some other relevant info:
>
> * is this in X11 or at a text virtual console?

This is in X11.

> * if in X11, which display manager (gdm3, lightdm, xdm, kdm, etc.),
>   or did you use startx or something from a text virtual console?

Currently I get with gdm3 only a black screen. So my only possibility is 
to chmod my /run/user/0 directory. Switch with su - gabriel to my 
account and execute startx.

> * are you using systemd or sysvinit as your init (process 1)?

# ps ax
   PID TTY      STAT   TIME COMMAND
     1 ?        Ss     0:01 init [2]

Should be the good old sysvinit. Never changed to systemd.

> * which PAM modules do you have (dpkg-query -W 'libpam*'), and have
you reconfigured the PAM stack or are you using defaults?

# dpkg-query -W 'libpam*'
libpam-cap:i386	1:2.22-1.2
libpam-ck-connector:i386	0.4.6-3+b1
libpam-dev	
libpam-doc	
libpam-gnome-keyring	3.8.2-2
libpam-mkhomedir	
libpam-modules:i386	1.1.3-10
libpam-modules-bin	1.1.3-10
libpam-motd	
libpam-mount	
libpam-runtime	1.1.3-10
libpam-smbpass	
libpam-ssh	
libpam-systemd:i386	204-5
libpam-umask	
libpam0g:i386	1.1.3-10
libpam0g-dev:i386	1.1.3-10
libpam0g-util	


I have found out, if I do login on tty1 and stop gdm3. And do a login on 
tty2 direct as user the XDG_RUNTIME_DIR variable is set correctly 
"/run/user/1000". I can start X with the command startx without any changes.

But if I switch the user from root with

su - gabriel

the XDG_RUNTIME_DIR variable remains on "/run/user/0".

This could may be an issue for gdm3, when switching user context.

Changed in file /etc/pam.d/common-session

session	optional	pam_systemd.so

to

session	optional	pam_systemd.so debug=1


Set following output in /var/log/auth.log

Oct 23 15:08:03 machine su[5608]: Successful su for gabriel by root
Oct 23 15:08:03 machine su[5608]: + /dev/tty1 root:gabriel
Oct 23 15:08:03 machine su[5608]: pam_env(su:session): Unable to open 
env file: /etc/environment: Datei oder Verzeichnis nicht gefunden
Oct 23 15:08:03 machine su[5608]: pam_unix(su:session): session opened 
for user gabriel by root(uid=0)
Oct 23 15:08:03 machine su[5608]: pam_systemd(su:session): Asking logind 
to create session: uid=1000 pid=5608 service=su type=tty class=user 
seat=seat0 vtnr=1 tty=/dev/tty1 display= remote=no remote_user=root 
remote_host=
Oct 23 15:08:03 machine su[5608]: pam_systemd(su:session): Reply from 
logind: id=c1 object_path=/org/freedesktop/login1/session/c1 
runtime_path=/run/user/0 session_fd=6 seat=seat0 vtnr=1
Oct 23 15:09:01 machine CRON[5680]: pam_env(cron:session): Unable to 
open env file: /etc/environment: Datei oder Verzeichnis nicht gefunden

The runtime_path is set to "/run/user/0".

Don't know if this is correct or wrong.



More information about the pkg-gnome-maintainers mailing list