You are not logged in.

#1 2018-05-19 00:12:21

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 195
Website

How to set systemd options for the X server?

Hi all,

I am having some problems working out how to change systemd options for the X server.

I would like to add the OOMScoreAdjust option to the .service file for the X server, so that it is less likely to be killed during an out-of-memory situation.  For other apps this involves running "systemctl edit whatever.service" and adding the option to a [Service] section.

However for the X server I cannot work out which service to edit.  It's been a while since I set up this system but I think all I did was enable the lightdm.service and this caused systemd to start X automatically.  There is no "X.service" or similar that I can see.  There is a "graphical.target" but adding my options to that does not affect the X server.

How do you apply custom systemd options to the X server?

(BTW I am aware you can change this option after the fact via /proc/pid/oom_score_adj but since systemd is starting the process it seems cleaner to have it apply this setting at the same time.)

Last edited by Malvineous (2018-05-19 00:23:51)

Offline

#2 2018-05-19 00:16:11

loqs
Member
Registered: 2014-03-06
Posts: 19,086

Re: How to set systemd options for the X server?

If you are using lightdm then lightdm is starting X not systemd.  So you would apply the setting to lightdm.service and X should inherit the setting as a child of lightdm.

Offline

#3 2018-05-19 00:22:10

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 195
Website

Re: How to set systemd options for the X server?

Oh wow that worked!  I had no idea lightdm was starting X, I thought it was using dependencies to make systemd do it!  Suddenly it makes so much more sense.  Many thanks!

EDIT: So close!  Now every single app I run has the OOM score set to the same high value, negating the effect of the change.  So I need some other solution to change *only* the value for the X process and not have it inherited by the child processes (all my desktop apps).

Last edited by Malvineous (2018-05-19 00:24:57)

Offline

#4 2018-05-19 06:48:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,905

Re: How to set systemd options for the X server?

You could write into /proc/`pidof Xorg`/oom_score* yourself. I guess the "greeter-setup-script" variable in /etc/lightdm/lightdm.conf would do (but I've no experience w/ lightdm)

Online

Board footer

Powered by FluxBB