kdm fails to restart after logout

Usualy, after logging out from the desktop (like from KDE), the display manager (kdm in a usual KDE setup) appears again prompting for a new login. On one of my machines this is not a
case for a while now. Instead of returning to the kdm login screen I end up in a virtual terminal for text input. Since this machine is most of the time simply shut down after use, I didn’t really look into the problem until now.

The problem is well know. It’s for example documented in bugs 295743, 432521 in Ubuntu’s launchpad, bug 253987 in the Gentoo bugzilla, bug 18028 in the freedesktop.org bugzilla and this thread in the German-speaking sidux forum.

The guilty party for causing the problem seems to be the X-Server that can not be properly reset. Not all X-Servers are buggy but at least the SiS-X-Server is (in my case
it’s crashing with „SIS(0): Unable to map IO aperture. Invalid argument (22)“) and the Intel-X-Server was. So the solution would be to fix the X-Servers. However, this is not done yet, even though the bug is quite old.

Lucky us, a workaround exists. Telling kdm with "TerminateServer=true" in kdmrc (see the kdm documentation) to terminate the X-Server instead of restarting it, resolves the issue.

If you apply this workaround, be sure to check the entry in your kdm file after each upgrade of kdm. It might me overwritten through the upgrade mechanisms.

How can I do a remote logout from KDE?

Use the incredible dcop client!

To get an overview what is going on at the specific machine, type

dcop --all-users --list-sessions

This will show all sessions by all users.

If you have the appropriate permissions you can picka specific user and session by typing

dcop --user <username> --session <sessionid>

This will provide you with a list of all dcop-aware programms running in this session.

So let’s get to the logout. This is under controll of the KDE SessionManagemnet server.

dcop --user <username> --session <sessionid>
ksmserver default

provides a list of all available dcop commands to the specific programm. Among the list of ksmserver we will find logout (int,int,int)

The three integers have the following meanings:

  • ShutdownConfirm
    • Default = -1: Obey the user’s confirmation setting.
    • No = 0: Don’t confirm, shutdown without asking.
    • Yes = 1: Always confirm, ask even if the user turned it off.
  • ShutdownType
    • Default = -1: Select previous action or the default if it’s the first time.
    • None = 0: Only log out.
    • Reboot = 1: Log out and reboot the machine.
    • Halt = 2: Log out and halt the machine.
  • ShutdownMode
    • Default = -1: Select previous mode or the default if it’s the first time.
    • Schedule = 0: Schedule a shutdown (halt or reboot) for the time all active sessions have exited.
    • TryNow =
      1: Shut down, if no sessions are active. Otherwise do nothing.
    • ForceNow = 2: Force shutdown. Kill any possibly active sessions.
    • Interactive = 3: Pop up a dialog asking the user what to do if sessions are still active.

These flags are documented at http://developer.kde.org/documentation/library/cvs-api/kdecore/html/classKApplication.html

Thus, a logout could be initiated by

dcop --user <username> --session <sessionid> ksmserver default logout 0 0 -1

More info of dcop at http://developer.kde.org/documentation/library/kdeqt/dcop.html for the protocol and http://www.volny.cz/bwian/dcop.html for the client program.

Bookmarklets in Konqueror

Jetzt habe ich mich schon mehrmals darüber geärgert, dass Bookmarklets in Konqueror nicht funktionieren. Aus der Addressleiste heraus kann man nämlich kein Javascript ausführen.

Nun habe ich endlich mal nach dem Problem gegoogelt und den Artikel „Using Bookmarklets in Konqueror“ gefunden.

Darin wird beschrieben, dass es nämlich doch geht und zwar indem man das Bookmarklet unter Extras > Mini-Dienstprogramme ablegt. Unter ‚Mini-Dienstprogramme bearbeiten‘ erscheint der bekannte Lesezeichen-Editor. Hier eingetragener Bookmarklet-Code funktioniert dann.

Ein Nachteil ist, dass das so angelegte Bookmarklet dann leider nur relativ versteckt unterhalb von Extras > Mini-Dienstprogramme oder dem Mini-Dienstprogramme-Knopf in der Extras-Werkzeugleiste erreichbar ist. Hier wäre eine eigene Mini-Dienstprogramme-Werkzeugleiste sinnvoll.

… wer hat denn nur
diese fürchterliche Namensschöpfung für die Minitools verbrochen? ‚Mini-Dienstprogramm‘ ist ja nun wirklich ein Zungenbrecher (und Fingerbrecher auch).