[Nix-dev] What kills my xserver?

Arie Middelkoop amiddelk at gmail.com
Wed May 9 14:25:16 CEST 2012


Hi Nixos-ers,

I've never been able to reboot my machine from inside a KDE session in 
combination with KDM. Also, a logout takes excessively long (10 
seconds). Lately, I investigated the crime scene, found some good leads, 
but now I'm stuck.

I'll first illustrate the problem, which I'll do with simple xterm 
sessions instead of a full KDE session.

So what does work:
* start an "xterm" session from KDM
* kdmctl shutdown reboot 0 0 ask
* exit xterm
As a result, the machine restarts, as expected.
Alternatively, I can leave out the kdmctl call. Then there is a 'logout' 
to KDM, as expected.
Nice.

So what does *not* work:
* start an "xterm" session
** switch to a console with alt+shift+F1, and then switch back to xterm 
with alt+F7
* kdmctl shutdown reboot 0 0 ask
* exit xterm
The xterm disappears, I get an empty screen for 10 secons, and then KDM 
reappears. Slow, and no reboot.

What is it doing? In the time to end the session, it could reboot the 
machine several times, build the entire nixpkgs collection from scratch, 
etc. It's definitely not waiting on any network I/O.

No. KDM turned out to be an important witness when given a couple of 
debug flags. The long delay is in fact just KDM calling "sleep(10)" as 
part of an error handler when it notices that the xserver is dead after 
the session ended. Then the xserver is restarted and the reboot request 
erased.

Now, you might think that the switch to a virtual terminal and back is 
not a big issue, because that's something you'd normally not do if 
you're in a graphical environment. Indeed.
However, the logout/reboot problem shows up in my case as well when 
using a KDE session. It's the same result, although I'm not sure if it's 
the same cause:

When the KDE session ends, first ksmserver performs some shutdown 
actions, then the startkde script resumes and kills off the remaining 
kdeinit processes and probably a bit more. I've verified that ksmserver 
succesfully registers a shutdown with KDM. Also, startkde runs the 
shutdown till completion, as visible in the session log. And then ... 
nothing for the by now familiar ten seconds.

Because it's easy to change different configurations with Nixos, I tried 
several setups without noticing any different results:
* KDE 4.7 and KDE 4.8. With 4.7 I sometimes get a message from KDE 
bughandler that ksmserver crashed, but I can only click around in it in 
the ten seconds that KDM is sleeping. Actually, I'm wondering why I 
actually get graphical output because isn't KDM waiting because the 
xserver had died...
* Nixos default linux kernel 2.6, 3.2 and 3.3, and my own customized 3.2 
kernel
* DRI enabled/disabled
* Intel display driver 2.17 (needed for dri), and the 2.15 version 
(nixos default). There is by now also a 2.19 version that is strongly 
recommended but I cannot easily try it because it requires a newer 
pixman. Given that there is no difference between 2.15 and 2.17, I doubt 
that changing to 2.19 will have any effect.
* with my own .kde folder and starting with an empty .kde folder
* with the KDE default kwin as window manager, and with xmonad. Running 
a xmonad-only session without desktop manager works perfectly, like with 
xterm.
* killing manually most processes before logging out. I'm sure that in 
the end all applications using the xserver are gone. Actually, killing 
some of the kde processes do bring me back quickly to KDM, so I do have 
the impression that some shutdown actions are causing the problems.

The big questions is thus:
* why does the xserver die prematurely? There is nothing in my session 
log, kde log, X11 log, or messages log related to this.

Perhaps that question can be answered if I would know:
* why does this only show up with KDE and not with xterm or xmonad?
* is it in any way related to hardware/driver issues, like when 
switching to a virtual terminal?
* why do others not have this problem?

If you have an idea, solution or suggestion, please let me know. Surely 
I can shutdown my machine with shutdown and the like, but that's not 
very nice...

Arie


More information about the nix-dev mailing list