Closed cloudlena closed 3 months ago
checkservices
started as a script for headless servers where people log in only via SSH. In case you log in via a graphical display manager, checkservices
might detect that it needs to be restarted, which would terminate the entire session. Same for polkit.service
, systemd-logind.service
and maybe others (IIRC). The missing PID file for getty@tty1.service
just coincidentally avoids this.
@lahwaacz, thanks a lot for the clarification! Is there any sensible way to deal with this? I'm running Arch with Sway.
What do you think about asking for confirmation (Are you sure?) if it wants to run on a graphical arch?
I can create a PR for this.
I'd rather we have a list of ignored services and add things like getty@tty.service to it.
What do you think about asking for confirmation (Are you sure?) if it wants to run on a graphical arch?
checkservices
already asks for confirmation before restarting services, but all services are grouped and restarted together...
I'd rather we have a list of ignored services and add things like getty@tty.service to it.
I'm not sure, aren't there other services which may break by restarting in a desktop environment?
What do you think about asking for confirmation (Are you sure?) if it wants to run on a graphical arch?
checkservices
already asks for confirmation before restarting services, but all services are grouped and restarted together...
I was thinking of check the output of systemctl get-default
and warn again if it's graphical.target
.
I was thinking of check the output of
systemctl get-default
and warn again if it'sgraphical.target
.
You can have an active session, graphical or not, even with plain multi-user.target
.
We are straying a bit from the issue. Keeping track of pid-less services is the goal, and this should be fairly simple to have as a filtered list in the code and omit them from the get_services code.
@aminvakil did you want to try implement this?
Does checking if systemctl show --property MainPID --value ${service}
returns 0 or not suitable?
I don't think so?
λ ~ » systemctl show getty@tty1.service | grep PID
GuessMainPID=yes
MainPID=404
ControlPID=0
ExecMainPID=404
λ ~ » systemctl show bolt.service | grep PID
GuessMainPID=yes
MainPID=1406
ControlPID=0
ExecMainPID=1406
$ sudo systemctl show getty@tty1.service | grep PID
GuessMainPID=yes
MainPID=0
ControlPID=0
ExecMainPID=0
$ sudo systemctl show bolt.service | grep PID
GuessMainPID=yes
MainPID=0
ControlPID=0
ExecMainPID=0
Can this maybe somehow be related to linux-hardened
?
If it helps, I'm not using linux-hardened
, just bare bones linux
.
If it helps, I'm not using
linux-hardened
, just bare boneslinux
.
Honestly I really don't think so, this is just a wild guess, and I meant returning 0 for MainPID
when linux-hardened
is used.
@aminvakil Obviously, if you don't have getty@tty1.service
active, systemctl shows its MainPID
as 0.
@lahwaacz Sorry for late response, yes, it was not active.
When running
checkservices
, I am getting the following error:Am I doing something wrong? This seems like a common service to have.