Ad Widget

Collapse

Zabbix Agent on Ubuntu 24.04 Can't open PID file /run/zabbix/zabbix_agentd.pid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ModularConfusion
    Junior Member
    • Apr 2024
    • 23

    #1

    Zabbix Agent on Ubuntu 24.04 Can't open PID file /run/zabbix/zabbix_agentd.pid

    Fresh install of zabbix agent on Ubuntu 24.04

    Ran
    Code:
    wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-1+ubuntu24.04_all.deb
    then apt update and apt install zabbix-agent.

    Setup my config, and it fails to start:

    Code:
    Oct 21 22:58:03 docker-minimal systemd[1]: Starting zabbix-agent.service - Zabbix Agent...
    ░░ Subject: A start job for unit zabbix-agent.service has begun execution
    ░░ Defined-By: systemd
    ░░ Support: http://www.ubuntu.com/support
    ░░
    ░░ A start job for unit zabbix-agent.service has begun execution.
    ░░
    ░░ The job identifier is 62508.
    Oct 21 22:58:05 docker-minimal systemd[1]: zabbix-agent.service: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory
    Oct 21 22:58:05 docker-minimal systemd[1]: zabbix-agent.service: Failed with result 'protocol'.
    ░░ Subject: Unit failed
    ░░ Defined-By: systemd
    ░░ Support: http://www.ubuntu.com/support
    ░░
    ░░ The unit zabbix-agent.service has entered the 'failed' state with result 'protocol'.
    Oct 21 22:58:05 docker-minimal systemd[1]: Failed to start zabbix-agent.service - Zabbix Agent.
    I verified the /run/zabbix directory exists and is owned by the zabbix user and group.

    I can use `touch` to create the zabbix_agentd.pid file and chown it by zabbix, but it is removed immediately upon starting the service and makes no difference.
    Last edited by ModularConfusion; 22-10-2024, 01:18.
  • valerio.bozzolan
    Junior Member
    • Jul 2021
    • 2

    #2
    I was affected by the very same problem Can't open PID file /run/zabbix/zabbix_agentd.pid on a new Ubuntu installation.

    My situation:Were you under this exact situation? or another one?

    Anyway, the official systemd service was not working for me. See the problematic content:

    Code:
    $ sudo systemctl cat zabbix-proxy
    [Unit]
    Description=Zabbix Proxy
    After=syslog.target
    After=network.target
    
    [Service]
    Environment="CONFFILE=/etc/zabbix/zabbix_proxy.conf"
    EnvironmentFile=-/etc/default/zabbix-proxy
    Type=forking
    Restart=on-failure
    PIDFile=/run/zabbix/zabbix_proxy.pid
    KillMode=control-group
    ExecStart=/usr/sbin/zabbix_proxy -c $CONFFILE
    ExecStop=/bin/sh -c '[ -n "$1" ] && kill -s TERM "$1"' -- "$MAINPID"
    RestartSec=10s
    TimeoutSec=infinity
    User=zabbix
    Group=zabbix
    LimitNOFILE=65536:1048576
    
    [Install]
    WantedBy=multi-user.target
    Solution: I've replaced the above systemd service with another one, more simple. Running this command:

    Code:
    sudo systemctl edit --full zabbix-proxy
    Then replacing everything with this new content, and saving:

    Code:
    # https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/493087-zabbix-agent-on-ubuntu-24-04-can-t-open-pid-file-run-zabbix-zabbix_agentd-pid
    [Unit]
    Description=Zabbix Proxy (fixed)
    Documentation=man:zabbix_proxy
    After=syslog.target
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/usr/sbin/zabbix_proxy --foreground
    Restart=on-abnormal
    RestartSec=10s
    User=zabbix
    Group=zabbix
    TimeoutSec=infinity
    LimitNOFILE=65536:1048576
    
    [Install]
    WantedBy=multi-user.target
    Then I've just restarted Zabbix and everything was OK.

    Code:
    sudo systemctl restart zabbix-proxy
    I hope I've helped people in the same situation. You may then have other unrelated errors in the log file. In case, paste them, and we can see these together.

    Anyway I'm curious why the Zabbix package for 7.0 LTS in Ubuntu 24.04 seems broken. Unfortunately I cannot search in the official bug tracker since it requires a Microsoft account, and I'm not a Microsoft customer (and I will never be one).

    ------

    -Valerio, from Milano

    Comment

    Working...