Bug 1142492 - Xserver is restarted like mad on crash by sddm
Xserver is restarted like mad on crash by sddm
Status: IN_PROGRESS
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: KDE Workspace (Plasma)
Current
Other Other
: P3 - Medium : Normal (vote)
: ---
Assigned To: E-Mail List
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-07-23 11:08 UTC by Jiri Slaby
Modified: 2020-08-25 10:38 UTC (History)
4 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
journactl extract (127.24 KB, text/plain)
2019-08-27 07:31 UTC, Jiri Slaby
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Slaby 2019-07-23 11:08:37 UTC
My X server is crashing at the start repeatedly:

-rw------- 1 root   root    44982272 2019-07-23 12:51:54.579493938 +0200 core.0.24697.X
-rw------- 1 root   root    44982272 2019-07-23 12:51:56.927477919 +0200 core.0.24746.X
-rw------- 1 root   root    44982272 2019-07-23 12:51:59.167462637 +0200 core.0.24781.X
-rw------- 1 root   root    44990464 2019-07-23 12:52:01.411447326 +0200 core.0.24815.X
-rw------- 1 root   root    44982272 2019-07-23 12:52:03.611432316 +0200 core.0.24850.X
-rw------- 1 root   root    44982272 2019-07-23 12:52:05.859416979 +0200 core.0.24883.X
-rw------- 1 root   root    44990464 2019-07-23 12:52:08.107401641 +0200 core.0.24919.X
-rw------- 1 root   root    44978176 2019-07-23 12:52:10.495385349 +0200 core.0.24949.X
-rw------- 1 root   root    44990464 2019-07-23 12:52:12.771369821 +0200 core.0.24984.X
-rw------- 1 root   root    44978176 2019-07-23 12:52:15.031354402 +0200 core.0.25014.X
-rw------- 1 root   root    44990464 2019-07-23 12:52:17.391338300 +0200 core.0.25048.X


And it is being restarted over and over so that I have to ssh to the machine and stop the DM service remotely. I thought it would be ratelimited?

Or is this a bug in /usr/lib/X11/display-manager script of xdm?

I am using sddm as display manager.
Comment 1 Franck Bui 2019-07-29 08:28:21 UTC
(In reply to Jiri Slaby from comment #0)
> 
> Or is this a bug in /usr/lib/X11/display-manager script of xdm?
> 
> I am using sddm as display manager.

sddm.service has:

  [Service]
  ...
  Restart=always

so it's expected that systemd tries to restart it. Perhaps "always" is not the best choice and another value might be more appropriate (see systemd.service(5)).

Now systemd also offers some protections against such restart infinite loop through the StartLimitIntervalSec= and StartLimitBurst= options (systemd.unit(5)) but in this specific case the default values for these options (10s / 5) are not appropriate as restarting sddm takes at least 2 seconds.

So yes sddm.service should be improved to handle gracefully such cases, therefore reassigning to sddm maintainer.
Comment 2 Fabian Vogt 2019-07-29 12:48:07 UTC
(In reply to Franck Bui from comment #1)
> So yes sddm.service should be improved to handle gracefully such cases,
> therefore reassigning to sddm maintainer.

I opened a PR upstream: https://github.com/sddm/sddm/pull/1184

However, in openSUSE sddm.service is not used by default, as we have display-manager.service. Which one is used here?
Comment 3 Jiri Slaby 2019-07-31 07:30:45 UTC
(In reply to Fabian Vogt from comment #2)
> (In reply to Franck Bui from comment #1)
> > So yes sddm.service should be improved to handle gracefully such cases,
> > therefore reassigning to sddm maintainer.
> 
> I opened a PR upstream: https://github.com/sddm/sddm/pull/1184
> 
> However, in openSUSE sddm.service is not used by default, as we have
> display-manager.service. Which one is used here?

● display-manager.service - X Display Manager
   Loaded: loaded (/usr/lib/systemd/system/display-manager.service; enabled; vendor preset: enabled)
● sddm.service - Simple Desktop Display Manager
   Loaded: loaded (/usr/lib/systemd/system/sddm.service; disabled; vendor preset: disabled)

So the former.
Comment 4 Fabian Vogt 2019-07-31 07:33:47 UTC
(In reply to Jiri Slaby from comment #3)
> (In reply to Fabian Vogt from comment #2)
> > (In reply to Franck Bui from comment #1)
> > > So yes sddm.service should be improved to handle gracefully such cases,
> > > therefore reassigning to sddm maintainer.
> > 
> > I opened a PR upstream: https://github.com/sddm/sddm/pull/1184
> > 
> > However, in openSUSE sddm.service is not used by default, as we have
> > display-manager.service. Which one is used here?
> 
> ● display-manager.service - X Display Manager
>    Loaded: loaded (/usr/lib/systemd/system/display-manager.service; enabled;
> vendor preset: enabled)
> ● sddm.service - Simple Desktop Display Manager
>    Loaded: loaded (/usr/lib/systemd/system/sddm.service; disabled; vendor
> preset: disabled)
> 
> So the former.

Ok, reassigning to xdm maintainers.
Comment 5 Stefan Dirsch 2019-07-31 09:16:58 UTC
Ok. Just to give you some background. 

Once upon a time code was added to xdm not to try more often than 3 times to start an Xserver and fail completely otherwise, so the Linux console got accessible again. This code has been extracted and adjusted/added to kdm and gdm. Not sure about other displaymanagers at this point. I thought it would exist also in sddm. Maybe it has been removed for some reason. 

Anyway, using 

StartLimitIntervalSec=30
StartLimitBurst=2

in [Unit] section of systemd service file looks promising to me. Let's give it a try.
Comment 6 Stefan Dirsch 2019-07-31 09:31:42 UTC
Thinking about it again I'm no longer sure this is going to help. The issue here is that start of Xserver fails, not the one of display manager, right?
Or does sddm also fail if Xserver start fails once and the gets restarted immediately by systemd? Then these lines may still help. 

Jiry, could you give these changes a try? Just add  to /usr/lib/systemd/system/display-manager.service:

Index: display-manager.service
===================================================================
--- display-manager.service     (revision cdc1a7980bd914226ee45cd6ba0ba422)
+++ display-manager.service     (working copy)
@@ -6,6 +6,8 @@
 Wants=remote-fs.target dbus.socket systemd-user-sessions.service systemd-logind.service
 After=remote-fs.target dbus.socket systemd-user-sessions.service systemd-logind.service getty@tty7.service plymouth-quit.service
 OnFailure=plymouth-quit.service
+StartLimitIntervalSec=30
+StartLimitBurst=2
 
 [Service]
 Type=forking

display-manager.service needs to be restarted of course ...

I mean only sddm.service  has restart=always defined, but we're using display-manager.service here ...
Comment 7 Stefan Dirsch 2019-08-23 14:02:42 UTC
@Jiry ping!
Comment 8 Jiri Slaby 2019-08-27 07:31:09 UTC
Created attachment 815800 [details]
journactl extract

(In reply to Stefan Dirsch from comment #6)
> Jiry, could you give these changes a try? Just add  to
> /usr/lib/systemd/system/display-manager.service:
> 
> Index: display-manager.service
> ===================================================================
> --- display-manager.service     (revision cdc1a7980bd914226ee45cd6ba0ba422)
> +++ display-manager.service     (working copy)
> @@ -6,6 +6,8 @@
>  Wants=remote-fs.target dbus.socket systemd-user-sessions.service
> systemd-logind.service
>  After=remote-fs.target dbus.socket systemd-user-sessions.service
> systemd-logind.service getty@tty7.service plymouth-quit.service
>  OnFailure=plymouth-quit.service
> +StartLimitIntervalSec=30
> +StartLimitBurst=2

Added the lines, daemon-reloaded, display-manager restarted. It behaves still the same.

Note in the attached log, that the PID of sddm is still the same, so it looks like sddm is trying to restart the X server.
Comment 9 Stefan Dirsch 2019-08-27 09:20:43 UTC
Ok. As I already expected in comment #6. sddm isn't failing, it's the start of the Xserver, which fails. Therefore it doesn't help to limit the times sddm is failing. This needs to be fixed inside sddm. My guess is, that it has never been implemented. I know it was in kdm and gdm. Back to KDE component. 

Jiry, as workaround you can use another displaymanager, which still supports this feature. xdm and possbily also still gdm. And maybe also others ...
Comment 10 Jiri Slaby 2019-08-27 09:32:44 UTC
(In reply to Stefan Dirsch from comment #9)
> Jiry, as workaround you can use another displaymanager, which still supports
> this feature. xdm and possbily also still gdm. And maybe also others ...

No problem, I see this only with xf86-video-intel, which I am not using by default. Modesetting does not crash the X server so early :).
Comment 11 Stefan Dirsch 2019-08-27 15:09:03 UTC
Hmm. Which intel GPU are you using? xf86-video-intel may still be the right/recommended driver, if it's rather old.
Comment 12 Jiri Slaby 2019-08-28 07:41:24 UTC
(In reply to Stefan Dirsch from comment #11)
> Hmm. Which intel GPU are you using? xf86-video-intel may still be the
> right/recommended driver, if it's rather old.

It's skylake, so modesetting is preferred here.