# xdm & utmp: problem with ttyslot number



## igoro (Jan 19, 2010)

Hello,

I've recently set up xdm to manage two local X servers 0 & :1) and noticed that /var/run/utmp has only one slot for both of them. It's so due to login(3) considers /etc/ttys only. It's invoked with tty=":0" or tty=":1" and there is no such tty within /etc/ttys, that's why it uses the same slot for both. And that's a problem with errors like: 
	
	



```
xdm: pam_sm_close_session(): no utmp record for :0
```
 As a result, in some cases it cannot be figured out whether user is logged in.

I see that x11/sessreg also uses file defined as 'DisplayManager.servers' within xdm configuration (e.g. /usr/local/lib/X11/xdm/xdm-config) to calculate slot number within /var/run/utmp. Can it be handled the same way using PAM? Is there an easy option without changing a lot?

Thanks in advance.


----------



## naikon (Jul 15, 2010)

Holy hell, this is a long time coming, but I have a solution. Normally, utmp records are not assigned on login, so you must register an entry for the user. I normally just append this line my my .cshrc/.bashrc:


```
sessreg -a -l $DISPLAY -x /usr/local/lib/X11/xdm/Xservers $USER
```

Logout:


```
sessreg -d -l $DISPLAY -x /usr/local/lib/X11/xdm/Xservers $USER"
```


----------



## naikon (Jul 15, 2010)

Notice the " in the last post. You need to remove that. The above should remove that error message.


----------

