KDE5 restarts Xorg instead of rebooting or shutting down the computer

With Leap 42.1 freshly installed from scratch, invoking “Restart” or “Shutdown” in KDE5 (either from “Power / Session” menu or directly from K menu shortcuts) yields nothing but a simple log-out, — at least how it looks at first sight, but more careful observation shows that X is first shut down, so that system messages on tty1 are visible again, and then is immediately started once more. On the other hand, pressing “Restart” or “Shutdown” in log-in window always has the desired effect.

The epilog of ~/.xsession-errors-:0 says:

Shutdown called with confirm  -1  type  1  and mode  -1
After modifications confirm is  -1  type is  1  and mode  3
powerdevil: DBus service  ":1.10"  is requesting inhibition
powerdevil: Added inhibition with cookie  1  from  "ksmserver"  with  "Shutting down system"
.....
kdeinit5: PID 5625 terminated.
powerdevil: Released inhibition with cookie  1
startkde: Shutting down...
kdeinit5: terminate KDE.
klauncher: Exiting on signal 1
startkde: Done.
bluedevil: Destroyed
The X11 connection broke: I/O error (code 1)
X connection to :0 broken (explicit kill or server shutdown).

Meanwhile, /var/log/Xorg.log.old ends with:

Server terminated successfully (0). Closing log file.

Tried with another freshly created user account — no difference.

Tried Xfce4 — it asks for root password and then proceeds as expected, rebooting the machine or powering it off, leaving the following lines in ~/.xsession-errors-:0 file:

nm-applet-Message: PID 1 (we are 2567) sent signal 15, shutting down...
kdeinit5: Fatal IO error: client killed
klauncher: Exiting on signal 15
The X11 connection broke (error 1). Did the X11 server die?

So it looks like those “broken X11 connection” events do not actually prevent the shutdown, so the real cause may be somewhere else.

How can this be debugged? Googling on the keywords only showed me tons of KDE4-related topics, and some KDE5-related but without any real solution — people just complain that it does not work, while others argue that it works for them.

I am not having that problem.

Is your system fully up-to-date? Have you rebooted since you last ran updates?

What you are describing looks a bit like what happens when a running older program miscommunicates with a more recently installed one.

Note: it is normal for logout to restart Xorg.

Absolutely.

Have you rebooted since you last ran updates?
Numerous times — both voluntarily (to test that log-in screen buttons function properly) and also involuntarily, because logging in and out of KDE5 may lead to video driver crash (so that only Ctrl-Alt-Del or REISUB is all that’s left), as well as does switching to text console and back to graphical session.

I already had to switch to LXDE on another machine, because KDE5 freezes are usually attributed to nVidia cards. Here I have Intel, but KDE5 shows similar level of “stability” — even with compositing turned of. Moreover, now it turns own it has no integrated screensaver support, has trouble managing display power, it suspended my computer to unwakable state, it lost its ability to override regional settings for finely tuned value formatting, and yet still provides no solution for root password prompt on regular tasks. Perhaps it just does not deserve time fighting it when there are less-demanding desktop environments out there.

On my Nvidia box, I set desktop effects to use XRender. It’s a lot more stable that way.

I’m not having stability problems on boxes with Intel graphics. But that probably depends on which Intel graphics. On my oldest Intel system, I did force the use of UXA acceleration to solve some problems.