You are not logged in.
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
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
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
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)
Offline