contrib icon indicating copy to clipboard operation
contrib copied to clipboard

checkservices: Unable to parse pid file for [email protected]

Open cloudlena opened this issue 4 years ago • 15 comments

When running checkservices, I am getting the following error:

$ sudo checkservices
:: Run pacdiff
:: Reload systemd
:: Services with broken maps files
Error:: Unable to parse pid file for [email protected].
Found: 0
:: Services missing on the system bus
Found: 0
:: List failed units

Am I doing something wrong? This seems like a common service to have.

cloudlena avatar Aug 09 '21 17:08 cloudlena

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 [email protected] just coincidentally avoids this.

lahwaacz avatar Aug 10 '21 06:08 lahwaacz

@lahwaacz, thanks a lot for the clarification! Is there any sensible way to deal with this? I'm running Arch with Sway.

cloudlena avatar Aug 10 '21 06:08 cloudlena

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.

aminvakil avatar Aug 10 '21 08:08 aminvakil

I'd rather we have a list of ignored services and add things like [email protected] to it.

Foxboron avatar Aug 10 '21 08:08 Foxboron

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...

lahwaacz avatar Aug 10 '21 08:08 lahwaacz

I'd rather we have a list of ignored services and add things like [email protected] 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.

aminvakil avatar Aug 10 '21 08:08 aminvakil

I was thinking of check the output of systemctl get-default and warn again if it's graphical.target.

You can have an active session, graphical or not, even with plain multi-user.target.

lahwaacz avatar Aug 10 '21 08:08 lahwaacz

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?

Foxboron avatar Aug 10 '21 08:08 Foxboron

Does checking if systemctl show --property MainPID --value ${service} returns 0 or not suitable?

aminvakil avatar Aug 10 '21 08:08 aminvakil

I don't think so?

λ ~ » systemctl show [email protected] | grep PID
GuessMainPID=yes
MainPID=404
ControlPID=0
ExecMainPID=404
λ ~ » systemctl show bolt.service | grep PID
GuessMainPID=yes
MainPID=1406
ControlPID=0
ExecMainPID=1406

Foxboron avatar Aug 10 '21 08:08 Foxboron

$ sudo systemctl show [email protected] | 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?

aminvakil avatar Aug 10 '21 08:08 aminvakil

If it helps, I'm not using linux-hardened, just bare bones linux.

cloudlena avatar Aug 10 '21 08:08 cloudlena

If it helps, I'm not using linux-hardened, just bare bones linux.

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 avatar Aug 10 '21 08:08 aminvakil

@aminvakil Obviously, if you don't have [email protected] active, systemctl shows its MainPID as 0.

lahwaacz avatar Aug 10 '21 08:08 lahwaacz

@lahwaacz Sorry for late response, yes, it was not active.

aminvakil avatar Aug 11 '21 13:08 aminvakil