Nixpkgs: teamviewerd.service: Can't open PID file /run/teamviewerd.pid (yet?) after start: No such file or directory

Created on 1 Aug 2018  ·  12Comments  ·  Source: NixOS/nixpkgs

Importance

Low

Issue description

systemctl status teamviewerd.service returns the non-critical

teamviewerd.service: Can't open PID file /run/teamviewerd.pid (yet?) after start: No such file or directory

A properly configured system knows when it is the first time that the daemon runs in which case it would never try to open the file in the first place. A valid response could also be "you cannot restart something which hasn't been started yet" (although that lacks in usability). The current situation is that it exposes an implementation detail (/run/teamviewerd.pid), which is always undesirable.

This is applicable to other services as well and perhaps it should be solved by the systemd project.

Steps to reproduce

Unknown, but I think it was just systemctl restart teamviewer.service.

Technical details

  • system: "x86_64-linux"

    • host os: Linux 4.14.55, NixOS, 18.03.git.a1299c9 (Impala)

    • multi-user?: yes

    • sandbox: no

    • version: nix-env (Nix) 2.0.4

    • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

Most helpful comment

I've tried this in my local configuration and warning was removed on starts/restarts:

  systemd.services.teamviewerd.serviceConfig = lib.mkForce {
        Type = "forking";
        ExecStart = "${pkgs.teamviewer}/bin/teamviewerd daemon start";
        GuessMainPID = true;
        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
        Restart = "on-abort";
        StartLimitInterval = "60";
        StartLimitBurst = "10";
  };

Sorry I have the same issue in Teamviewer 15 and I want to try this soluion, but im a little new with linux, please where can I find this config file?

All 12 comments

This may be due to explicit PIDfile specification
https://github.com/NixOS/nixpkgs/blob/release-18.03/nixos/modules/services/monitoring/teamviewer.nix#L37
Maybe it should be removed?

Unfortunately, teamviewer SIGSEVs for me, so can't check if myself.

https://www.freedesktop.org/software/systemd/man/systemd.service.html claims that the current PIDfile configuration is the recommended setup. Perhaps it needs to be fixed in systemd, since that generates the error message in the first place.

Alright, I've looked into teamviewer source package.

in file ./opt/teamviewer/tv_bin/script/tvw_config I found following unconditional declaration:

TV_PIDFILE='/var/run/teamviewerd.pid'

Then, in file ./opt/teamviewer/tv_bin/script/tvw_exec

function IsDaemonRunning()
{
  (
    #; Check if daemon is running - ignore for non-installed (TAR / TAR_QS)
    isInstalledTV || return 1

    exec &> /dev/null
    ps --no-heading -p $(cat "$TV_PIDFILE") | grep teamviewerd
  )
}

So I think internal teamviewer startup scripts don't support changing PIDFile.

My next guess is to use GuessMainPID=true instead of PIDFile.

I've tried this in my local configuration and warning was removed on starts/restarts:

  systemd.services.teamviewerd.serviceConfig = lib.mkForce {
        Type = "forking";
        ExecStart = "${pkgs.teamviewer}/bin/teamviewerd daemon start";
        GuessMainPID = true;
        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
        Restart = "on-abort";
        StartLimitInterval = "60";
        StartLimitBurst = "10";
  };

I don't like the lack of guarantees of the semantics of GuessMainPID, but otherwise :+1:.

Fine to close this issue when it's merged.

I've tried this in my local configuration and warning was removed on starts/restarts:

  systemd.services.teamviewerd.serviceConfig = lib.mkForce {
        Type = "forking";
        ExecStart = "${pkgs.teamviewer}/bin/teamviewerd daemon start";
        GuessMainPID = true;
        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
        Restart = "on-abort";
        StartLimitInterval = "60";
        StartLimitBurst = "10";
  };

Sorry I have the same issue in Teamviewer 15 and I want to try this soluion, but im a little new with linux, please where can I find this config file?

Located config in /etc/systemd/system/teamviewerd.service on my pi 4, but mine has a PIDFile reference to /var/run/teamviewer.pid and my ExecStart was /opt/teamviewer/tv_bin/teamviewerd -d

I changed in teamviewerd.service /var/run/teamviewerd.pid --> /run/teamviewerd.pid

[Unit]
Description = TeamViewer remote control daemon
After = network.target network-online.target dbus.service
Wants = network-online.target
Requires = dbus.service

[Service]
Type = forking
PIDFile = /run/teamviewerd.pid
ExecStart = /opt/teamviewer/tv_bin/teamviewerd -d
Restart = on-abort
StartLimitInterval = 60
StartLimitBurst = 10

[Install]
WantedBy = multi-user.target

[root@localhost ~]# systemctl start teamviewerd.service
[root@localhost ~]# systemctl status teamviewerd.service
● teamviewerd.service - TeamViewer remote control daemon
Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; vendor preset: disabled)
Active: active (running) since Sex 2020-08-07 14:21:39 -03; 3s ago
Process: 6442 ExecStart=/opt/teamviewer/tv_bin/teamviewerd -d (code=exited, status=0/SUCCESS)
Main PID: 6444 (teamviewerd)
Tasks: 16
Memory: 5.9M
CGroup: /system.slice/teamviewerd.service
└─6444 /opt/teamviewer/tv_bin/teamviewerd -d

Ago 07 14:21:38 localhost.localdomain systemd[1]: Starting TeamViewer remote control daemon...
Ago 07 14:21:39 localhost.localdomain systemd[1]: Started TeamViewer remote control daemon.
[root@localhost ~]#

Hi @gagliani ,

I wish I get it runnnig..

I'm using teamviewer in ARM64, Jetson xavier.
It worked fine the very first time and then this err came, Now I cant even use it, Every time I connect, I can see the remote device for a second and then goes, and when I check the status I see this.

Could you tell more how you solved it?

I tried changed /var/run/teamviewerd.pid to /run/teamviewerd.pid but still got same error

This happened to me after I updated Teamviewer.
I was able to get Teamviewer working using systemctl daemon-reload followed by systemctl restart teamviewerd.
The PID error still persisted in the logs even though Teamviewer worked.

5.7.17-2-MANJARO KDE
Teamviewer v15.10.5

Found this issue via a search when facing the same issue on Fedora 30 x86_64.

Solution for me was to edit /etc/systemd/system/teamviewerd.service and comment out the line that says:

PIDFile = /run/teamviewerd.pid

So it reads:

# PIDFile = /run/teamviewerd.pid

(or whatever PIDFile it specifies)

then run:

systemctl daemon-reload
systemctl start teamviewerd
systemctl status teamviewerd
Was this page helpful?
0 / 5 - 0 ratings

Related issues

rzetterberg picture rzetterberg  ·  3Comments

ghost picture ghost  ·  3Comments

langston-barrett picture langston-barrett  ·  3Comments

retrry picture retrry  ·  3Comments

domenkozar picture domenkozar  ·  3Comments