zabbix_agentd will not start after reboot

Bug #96644 reported by James Bubeck
14
Affects Status Importance Assigned to Milestone
zabbix (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Gutsy by Devid Antonio Filoni
Hardy
Won't Fix
Undecided
Unassigned
Jaunty
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: zabbix-agent

The init script /etc/init.d/zabbix-agent expects the directory /var/run/zabbix-agent to exist, and fails to start if the pid can't be written to /var/run/zabbix-agent/zabbix_agentd.pid . Since the /var/run path is mounted as tmpfs, this directory is removed whenever the machine is rebooted.

The directory can be created at zabbix-agent start by altering the script /etc/init.d/zabbix-agent as follows:

#! /bin/sh
### BEGIN INIT INFO
# Provides: zabbix-agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Start zabbix-agent daemon
### END INIT INFO
DAEMON=/usr/sbin/zabbix_agentd
NAME=zabbix_agentd
DESC="Zabbix agent"
PID=/var/run/zabbix-agent/$NAME.pid

test -f $DAEMON || exit 0

set -e

case "$1" in
  start)
        rm -f $PID
        echo "Starting $DESC: $NAME"
        if ! [ -d `dirname $PID` ]; then
                mkdir -p `dirname $PID`
                chown zabbix:zabbix `dirname $PID`
        fi
        start-stop-daemon --oknodo --start --pidfile $PID \
                --exec $DAEMON < /dev/null &> /dev/null
        ;;
  stop)
        echo "Stopping $DESC: $NAME"
        start-stop-daemon --oknodo --stop --exec $DAEMON
        ;;
  restart|force-reload)
        $0 stop
        $0 start
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

Revision history for this message
Michael (m-gruys) wrote :

confirmed also with Ubuntu 7.10
is also the case for zabbix-server

Solution:
after reboot create the following directories in /var/run/

drwxr-xr-x 2 zabbix zabbix 60 2008-01-01 19:55 zabbix-agent
drwxr-xr-x 2 zabbix zabbix 60 2008-01-01 19:55 zabbix-server

These directories are deleted again after another reboot :-(

Revision history for this message
RavenD (dklimov-thecomputerforge) wrote : Fix for agent, link to fix for server

Fix for the server
https://bugs.launchpad.net/ubuntu/+source/zabbix/+bug/172775

Fixed /etc/init.d/zabbix-agent
#! /bin/sh
### BEGIN INIT INFO
# Provides: zabbix-agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Start zabbix-agent daemon
### END INIT INFO
DAEMON=/usr/sbin/zabbix_agentd
NAME=zabbix_agentd
DESC="Zabbix agent"
PID=/var/run/zabbix-agent/$NAME.pid
### BEGIN /var/run Fix

DIR=/var/run/zabbix-agent

if test ! -d "$DIR"; then
        mkdir "$DIR"
        chown -R zabbix:zabbix "$DIR"
fi

### END /var/run Fix
test -f $DAEMON || exit 0

set -e

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
     rm -f $PID
 echo "Starting $DESC: $NAME"
 start-stop-daemon --oknodo --start --pidfile $PID \
  --exec $DAEMON < /dev/null &> /dev/null
 ;;
  stop)
 echo "Stopping $DESC: $NAME"
 start-stop-daemon --oknodo --stop --exec $DAEMON
 ;;
  restart|force-reload)
 $0 stop
 sleep 2
 $0 start
 ;;
  *)
 N=/etc/init.d/$NAME
 echo "Usage: $N {start|stop|restart|force-reload}" >&2
 exit 1
 ;;
esac

exit 0

Changed in zabbix:
assignee: nobody → shermann
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package zabbix - 1:1.4.2-4ubuntu3

---------------
zabbix (1:1.4.2-4ubuntu3) hardy; urgency=low

  * debian/zabbix-agent.init:
    + fixing missing pid directory in /var/run
      - Closes (LP: #96644)
      - Closes (LP: #172775)
  * Modify Maintainer value to match the DebianMaintainerField
    specification.

 -- Stephan Hermann <email address hidden> Mon, 07 Apr 2008 08:39:06 +0200

Changed in zabbix:
status: Confirmed → Fix Released
Revision history for this message
kavi (bhashkavi) wrote :

#hi friends

#I fixed this bug.
#-------------------
#Change the pid (process ID) then it works.
#1.
#Open file /etc/zabbix/zabbix_agentd.conf

 code :: linux@linux:/ sudo vi /etc/zabbix/zabbix_agentd.conf
               then search for pidfile
               then change
               PidFile=/var/run/zabbix-agent/zabbix_agentd.pid
               to
               PidFile=/var/tmp/zabbix_agentd.pid
#2.
#Open file /etc/init.d/zabbix_agent

 code :: linux@linux:/ sudo vi /etc/init.d/zabbix_agent
               then search for pidfile
               then change
               PID=/var/run/zabbix-ageent/$NAME.pid
               to
               PID=/var/tmp/$NAME.pid

Now it works

Revision history for this message
sasha (sasha123-deactivatedaccount) wrote :

This issue still affects Jaunty. The init scripts for zabbix-server and zabbix-agentd doesn't create PID directory at startup.

Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

It looks like both this bug and bug 172775 aren't fixed anymore because zabbix 1:1.6.1-3 which was synced with debian unstable is missing directory creation in zabbix-agent.init and both zabbix-server.init scripts..

Changed in zabbix (Ubuntu):
status: Fix Released → Confirmed
Changed in zabbix (Ubuntu):
assignee: Stephan Hermann (shermann) → Krzysztof Klimonda (kklimonda)
status: Confirmed → In Progress
Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

Attached debdiff for Jaunty. Fixes both this bug and bug 172775

Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

debdiff for Hardy. Fixes bug 172775. I'd like to keep the both in single report to ease work as they both are very similar.
Both bugs are fixed in 9.10. 8.10 isn't affected by them.

Revision history for this message
msk (dusanmsk) wrote :

This package still broken in Jaunty ( third ubuntu release after bug and solution was reported )! Are you joking, guys?!

Revision history for this message
Krzysztof Klimonda (kklimonda) wrote :

@msk: Patches are prepared. We need an ACK from SRU team to upload new packages to -proposed repositories. Please, be patient. If you really need this fixed ASAP I can prepare an package and upload it to my PPA for you.

Changed in zabbix (Ubuntu):
assignee: Krzysztof Klimonda (kklimonda) → nobody
status: In Progress → Confirmed
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

motu-sru ACK.

Changed in zabbix (Ubuntu):
status: Confirmed → Fix Released
Changed in zabbix (Ubuntu Hardy):
status: New → Confirmed
Changed in zabbix (Ubuntu Jaunty):
status: New → Confirmed
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Hardy debdiff uploaded.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Jaunty debdiff uploaded to jaunty-proposed. Maintainer changed to Ubuntu MOTU Developers <email address hidden>.

Revision history for this message
Jonathan Riddell (jr) wrote :

accepted into hardy-proposed, please test

Changed in zabbix (Ubuntu Hardy):
status: Confirmed → Fix Committed
Revision history for this message
Jonathan Riddell (jr) wrote :

Note the hardy package actually has bug 172775 in its changelog

Revision history for this message
Jonathan Riddell (jr) wrote :

accepted into jaunty-proposed, please test

Changed in zabbix (Ubuntu Jaunty):
status: Confirmed → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Anyone who can test the package in -proposed and confirm that it still works and fixes the issue? Otherwise I'll remove it from -proposed again.

Revision history for this message
John Lewis (jlewis-johnlewis-deactivatedaccount) wrote :

I can confirm that the proposed update works in Jaunty after reboot.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package zabbix - 1:1.6.1-3ubuntu0.1

---------------
zabbix (1:1.6.1-3ubuntu0.1) jaunty-proposed; urgency=low

  * debian/zabbix-agent.init:
    - Create pid directory in /var/run on start (LP: #96644)
  * debian/zabbix-server-{mysql,pgsql}.zabbix-server.init:
    - Create pid directory in /var/run on start (LP: #172775)

 -- Krzysztof Klimonda <email address hidden> Thu, 21 May 2009 14:22:17 +0200

Changed in zabbix (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Leaving v-needed for hardy.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Hardy has seen the end of its life and is no longer receiving any updates. Marking the Hardy task for this ticket as "Won't Fix".

Changed in zabbix (Ubuntu Hardy):
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.