Bug 167897 - Cannot complete installation of net-mgmt/zenoss - "service zenoss init" fails with error "Unable to create the initial Zenoss object database"
Summary: Cannot complete installation of net-mgmt/zenoss - "service zenoss init" fails...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Jason Helfman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-14 23:30 UTC by xenophon+freebsd
Modified: 2012-05-16 18:30 UTC (History)
0 users

See Also:


Attachments
file.txt (729 bytes, text/plain)
2012-05-14 23:30 UTC, xenophon+freebsd
no flags Details
zenoss.patch (878 bytes, patch)
2012-05-15 22:24 UTC, Phil Phillips
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description xenophon+freebsd 2012-05-14 23:30:04 UTC
In the default installation of Zenoss from the net-mgmt/zenoss port,
the initialization routine fails as show in the following transcript:

    cinip101bsdlog# service zenoss init
    MySQL server hostname [localhost]:
    MySQL server root username [root]:
    MySQL server root password []:
    MySQL event database name [events]:
    MySQL username for Zenoss events database [zenoss]:
    MySQL password for zenoss [zenoss]:
    MySQL server port [3306]:
    +-----------+
    | VERSION() |
    +-----------+
    | 5.5.24    |
    +-----------+
    Wrote file /usr/local/zenoss/etc/zeo.conf
    Wrote file /usr/local/zenoss/bin/zeoctl
    Changed mode for /usr/local/zenoss/bin/zeoctl to 755
    Wrote file /usr/local/zenoss/bin/runzeo
    Changed mode for /usr/local/zenoss/bin/runzeo to 755
    Starting Zope Object Database
    .
    daemon process started, pid=10302
    Loading initial Zenoss objects into the Zeo database
    (this can take a few minutes)
    Unable to create the initial Zenoss object database

Note that the initialization routine configures Zope and starts a ZEO
server, which provides access multi-client access to a Zope object
database (ZODB).  ZEO locks the database files in order to prevent
data corruption by processes attempting to access the ZODB directly
(bypassing ZEO).  Zenbuild logs following error messages to
${LOCALBASE}/zenoss/init/zenbuild.log, which implies that zenbuild is
attempting to access the ZODB files directly, instead of going through
ZEO:

    Creating events database using zenevent build...
    creating database
    dropping any triggers that my already exist
    loading schema
    loading stored procedures
    events database created and loaded
    ERROR:zc.lockfile:Error locking file /usr/local/zenoss/var/Data.fs.lock; pid=UNKNOWN
    Traceback (most recent call last):
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 76, in __init__
        _lock_file(fp)
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 59, in _lock_file
        raise LockError("Couldn't lock %r" % file.name)
    LockError: Couldn't lock '/usr/local/zenoss/var/Data.fs.lock'
    2012-05-14 03:42:46 ERROR zc.lockfile Error locking file /usr/local/zenoss/var/Data.fs.lock; pid=UNKNOWN
    Traceback (most recent call last):
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 76, in __init__
        _lock_file(fp)
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 59, in _lock_file
        raise LockError("Couldn't lock %r" % file.name)
    LockError: Couldn't lock '/usr/local/zenoss/var/Data.fs.lock'
    Traceback (most recent call last):
      File "/usr/local/zenoss/Products/ZenModel/zenbuild.py", line 135, in <module>
        zb = zenbuild()
      File "/usr/local/zenoss/Products/ZenModel/zenbuild.py", line 40, in __init__
        self.app = Zope2.app()
      File "/usr/local/zenoss/lib/python/Zope2/__init__.py", line 51, in app
        startup()
      File "/usr/local/zenoss/lib/python/Zope2/__init__.py", line 47, in startup
        _startup()
      File "/usr/local/zenoss/lib/python/Zope2/App/startup.py", line 72, in startup
        DB = dbtab.getDatabase('/', is_root=1)
      File "/usr/local/zenoss/lib/python/Zope2/Startup/datatypes.py", line 287, in getDatabase
        db = factory.open(name, self.databases)
      File "/usr/local/zenoss/lib/python/Zope2/Startup/datatypes.py", line 185, in open
        DB = self.createDB(database_name, databases)
      File "/usr/local/zenoss/lib/python/Zope2/Startup/datatypes.py", line 182, in createDB
        return ZODBDatabase.open(self, databases)
      File "/usr/local/zenoss/lib/python/ZODB/config.py", line 101, in open
        storage = section.storage.open()
      File "/usr/local/zenoss/lib/python/ZODB/config.py", line 169, in open
        return FileStorage(config.path, **options)
      File "/usr/local/zenoss/lib/python/ZODB/FileStorage/FileStorage.py", line 125, in __init__
        self._lock_file = LockFile(file_name + '.lock')
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 76, in __init__
        _lock_file(fp)
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 59, in _lock_file
        raise LockError("Couldn't lock %r" % file.name)
    zc.lockfile.LockError: Couldn't lock '/usr/local/zenoss/var/Data.fs.lock'

Also note that if one tries to start Zenoss, the Zope application
server along with several Zenoss components will not run:

    cinip101bsdlog# service zenoss start
    Daemon: zeoctl daemon process already running; pid=10302
    Daemon: zopectl .
    daemon process started, pid=10467
    Daemon: zenhub starting...
    Daemon: zenjobs starting...
    Daemon: zenping starting...
    Daemon: zensyslog starting...
    Daemon: zenstatus starting...
    Daemon: zenactions starting...
    Daemon: zentrap starting...
    Daemon: zenmodeler starting...
    Daemon: zenperfsnmp starting...
    Daemon: zencommand starting...
    Daemon: zenprocess starting...
    Daemon: zenwin starting...
    Daemon: zeneventlog starting...
    cinip101bsdlog# service zenoss start
    Daemon: zeoctl daemon process already running; pid=10302
    Daemon: zopectl
    daemon process started, pid=10924
    Daemon: zenhub starting...
    Daemon: zenjobs starting...
    Daemon: zenping starting...
    Daemon: zensyslog starting...
    Daemon: zenstatus is already running
    Daemon: zenactions starting...
    Daemon: zentrap starting...
    Daemon: zenmodeler is already running
    Daemon: zenperfsnmp is already running
    Daemon: zencommand is already running
    Daemon: zenprocess is already running
    Daemon: zenwin is already running
    Daemon: zeneventlog is already running
    cinip101bsdlog# ps ax
      PID  TT  STAT    TIME COMMAND
    10301  ??  IsJ  0:00.02 /usr/local/zenoss/bin/python /usr/local/zenoss/lib/python/zdaemon/zdrun.py -S /usr/local/zenoss/lib/python/ZEO/zeoctl.xml -C /usr/local/zenoss/
    10302  ??  IJ   0:00.66 /usr/local/zenoss/bin/python /usr/local/zenoss/lib/python/ZEO/runzeo.py -C /usr/local/zenoss/etc/zeo.conf (python2.6)
    10620  ??  IJ   0:00.04 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenStatus/zenstatus.py --configfile /usr/local/zenoss/etc/zenstatus.conf --cycle --daem
    10720  ??  IJ   0:00.05 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/DataCollector/zenmodeler.py --configfile /usr/local/zenoss/etc/zenmodeler.conf --cycle
    10754  ??  IJ   0:00.03 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenRRD/zenperfsnmp.py --configfile /usr/local/zenoss/etc/zenperfsnmp.conf --cycle --dae
    10778  ??  IJ   0:00.03 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenRRD/zencommand.py --configfile /usr/local/zenoss/etc/zencommand.conf --cycle --daemo
    10816  ??  IJ   0:00.04 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenRRD/zenprocess.py --configfile /usr/local/zenoss/etc/zenprocess.conf --cycle --daemo
    10843  ??  IJ   0:00.06 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenWin/zenwin.py --configfile /usr/local/zenoss/etc/zenwin.conf --cycle --daemon (pytho
    10874  ??  SJ   0:00.06 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenWin/zeneventlog.py --configfile /usr/local/zenoss/etc/zeneventlog.conf --cycle --dae
    12394  ??  IWsJ 0:00.00 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/cin
    12475  ??  IJ   0:11.23 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --plugin-dir=/usr/local/lib/m
    66615  ??  SsJ  0:00.71 sendmail: accepting connections (sendmail)
    66619  ??  IWsJ 0:00.00 sendmail: Queue runner@00:30:00 for /var/spool/clientmqueue (sendmail)
    66625  ??  IsJ  0:00.11 /usr/sbin/cron -s
    66834  ??  IsJ  0:00.11 /usr/sbin/syslogd -b 10.63.1.101 -c
    66851  ??  IsJ  0:00.06 /usr/sbin/rpcbind -h 10.63.1.101
    11300   1  R+J  0:00.00 ps ax
    66692   1  IWJ  0:00.00 login [pam] (login)
    66702   1  SJ   0:00.24 -csh (csh)
    67498   1  TWJ  0:00.00 /bin/sh /usr/bin/man portmaster
    67508   1  TWJ  0:00.00 more
    cinip101bsdlog# sockstat -4l
    USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
    zenoss   python2.6  10302 7  tcp4   10.63.1.101:8100      *:*
    mysql    mysqld     12475 10 tcp4   10.63.1.101:3306      *:*
    root     rpcbind    66851 9  udp4   10.63.1.101:111       *:*
    root     rpcbind    66851 10 udp4   *:*                   *:*
    root     rpcbind    66851 12 udp4   10.63.1.101:724       *:*
    root     rpcbind    66851 13 tcp4   10.63.1.101:111       *:*
    root     rpcbind    66851 14 tcp4   *:*                   *:*
    root     syslogd    66834 6  udp4   10.63.1.101:514       *:*
    root     sendmail   66615 3  tcp4   10.63.1.101:25        *:*

Zope reports the same lockfile error as zenbuild:

    2012-05-14T03:48:11 INFO ZServer HTTP server started at Mon May 14 03:48:11 2012
            Hostname: 0.0.0.0
            Port: 8080
    ------
    2012-05-14T03:48:13 ERROR zc.lockfile Error locking file /usr/local/zenoss/var/Data.fs.lock; pid=UNKNOWN
    Traceback (most recent call last):
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 76, in __init__
        _lock_file(fp)
      File "/usr/local/zenoss/lib/python/zc/lockfile/__init__.py", line 59, in _lock_file
        raise LockError("Couldn't lock %r" % file.name)
    LockError: Couldn't lock '/usr/local/zenoss/var/Data.fs.lock'

Fix: In order to get Zenoss working, the attached patch must be applied to
${LOCALBASE}/zenoss/etc/zope.conf.  This reconfigures the Zope
web application server underlying Zenoss to use ZEO instead of
accessing the ZODB directly.  This configuration is required because
multiple Zenoss components need to access the ZODB simultaneously.
After updating the Zope configuration to use ZEO, shutdown Zenoss and
re-run the initialization routine as shown below:

    cinip101bsdlog# service zenoss stop
    Daemon: zeneventlog stopping...
    Daemon: zenwin stopping...
    Daemon: zenprocess stopping...
    Daemon: zencommand stopping...
    Daemon: zenperfsnmp stopping...
    Daemon: zenmodeler stopping...
    Daemon: zentrap stopping...
    already stopped
    Daemon: zenactions stopping...
    already stopped
    Daemon: zenstatus stopping...
    Daemon: zensyslog stopping...
    already stopped
    Daemon: zenping stopping...
    already stopped
    Daemon: zenjobs stopping...
    already stopped
    Daemon: zenhub stopping...
    already stopped
    Daemon: zopectl daemon manager not running
    Daemon: zeoctl .
    daemon process stopped
    cinip101bsdlog# service zenoss init
    MySQL server hostname [localhost]:
    MySQL server root username [root]:
    MySQL server root password []:
    MySQL event database name [events]:
    MySQL username for Zenoss events database [zenoss]:
    MySQL password for zenoss [zenoss]:
    MySQL server port [3306]:
    +-----------+
    | VERSION() |
    +-----------+
    | 5.5.24    |
    +-----------+
    Starting Zope Object Database
    .
    daemon process started, pid=26057
    Loading initial Zenoss objects into the Zeo database
    (this can take a few minutes)
    ZentinelPortal loaded at zport
    Starting Zope Server
    .
    daemon process started, pid=26369
    
    =========================================================
    zensocket must be setuid. As root, execute the following:
    chown root:zenoss /usr/local/zenoss/bin/zensocket
    chmod 04750 /usr/local/zenoss/bin/zensocket
    =========================================================
    
    Successfully installed Zenoss
    
    cinip101bsdlog# chown root:zenoss /usr/local/zenoss/bin/zensocket
    cinip101bsdlog# chmod 04750 /usr/local/zenoss/bin/zensocket
    cinip101bsdlog# service zenoss start
    Daemon: zeoctl daemon process already running; pid=26057
    Daemon: zopectl daemon process already running; pid=26369
    Daemon: zenhub starting...
    Daemon: zenjobs starting...
    Daemon: zenping starting...
    Daemon: zensyslog starting...
    Daemon: zenstatus starting...
    Daemon: zenactions starting...
    Daemon: zentrap starting...
    Daemon: zenmodeler starting...
    Daemon: zenperfsnmp starting...
    Daemon: zencommand starting...
    Daemon: zenprocess starting...
    Daemon: zenwin starting...
    Daemon: zeneventlog starting...
    cinip101bsdlog# ps ax
      PID  TT  STAT    TIME COMMAND
    12394  ??  IWsJ 0:00.00 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/cin
    12475  ??  IJ   0:29.72 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --plugin-dir=/usr/local/lib/m
    26056  ??  IsJ  0:00.05 /usr/local/zenoss/bin/python /usr/local/zenoss/lib/python/zdaemon/zdrun.py -S /usr/local/zenoss/lib/python/ZEO/zeoctl.xml -C /usr/local/zenoss/
    26057  ??  SJ   0:29.56 /usr/local/zenoss/bin/python /usr/local/zenoss/lib/python/ZEO/runzeo.py -C /usr/local/zenoss/etc/zeo.conf (python2.6)
    26368  ??  IsJ  0:00.03 /usr/local/zenoss/bin/python /usr/local/zenoss/lib/python/zdaemon/zdrun.py -S /usr/local/zenoss/lib/python/Zope2/Startup/zopeschema.xml -b 10 -
    26369  ??  IJ   0:05.98 /usr/local/zenoss/bin/python /usr/local/zenoss/zopehome/runzope -C /usr/local/zenoss/etc/zope.conf (python2.6)
    26860  ??  IJ   0:01.47 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenHub/zenhub.py --configfile /usr/local/zenoss/etc/zenhub.conf --cycle --daemon (pytho
    26887  ??  SJ   0:00.24 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/Jobber/zenjobs.py --configfile /usr/local/zenoss/etc/zenjobs.conf --cycle --daemon (pyt
    26967  ??  IJ   0:00.12 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenStatus/zenstatus.py --configfile /usr/local/zenoss/etc/zenstatus.conf --cycle --daem
    26995  ??  IJ   0:06.26 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenEvents/zenactions.py --configfile /usr/local/zenoss/etc/zenactions.conf --cycle --da
    27066  ??  IJ   0:00.28 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/DataCollector/zenmodeler.py --configfile /usr/local/zenoss/etc/zenmodeler.conf --cycle
    27090  ??  IJ   0:00.11 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenRRD/zenperfsnmp.py --configfile /usr/local/zenoss/etc/zenperfsnmp.conf --cycle --dae
    27114  ??  IJ   0:00.11 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenRRD/zencommand.py --configfile /usr/local/zenoss/etc/zencommand.conf --cycle --daemo
    27140  ??  IJ   0:00.10 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenRRD/zenprocess.py --configfile /usr/local/zenoss/etc/zenprocess.conf --cycle --daemo
    27171  ??  IJ   0:00.14 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenWin/zenwin.py --configfile /usr/local/zenoss/etc/zenwin.conf --cycle --daemon (pytho
    27201  ??  IJ   0:00.10 /usr/local/zenoss/bin/python /usr/local/zenoss/Products/ZenWin/zeneventlog.py --configfile /usr/local/zenoss/etc/zeneventlog.conf --cycle --dae
    66615  ??  SsJ  0:01.39 sendmail: accepting connections (sendmail)
    66619  ??  IWsJ 0:00.00 sendmail: Queue runner@00:30:00 for /var/spool/clientmqueue (sendmail)
    66625  ??  SsJ  0:00.23 /usr/sbin/cron -s
    66834  ??  IsJ  0:00.21 /usr/sbin/syslogd -b 10.63.1.101 -c
    66851  ??  SsJ  0:00.10 /usr/sbin/rpcbind -h 10.63.1.101
    27485   1  R+J  0:00.00 ps ax
    66692   1  IWJ  0:00.00 login [pam] (login)
    66702   1  SJ   0:00.27 -csh (csh)
    67498   1  TWJ  0:00.00 /bin/sh /usr/bin/man portmaster
    67508   1  TWJ  0:00.00 more
    cinip101bsdlog# sockstat -4l
    USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
    zenoss   python2.6  26860 15 tcp4   10.63.1.101:8789      *:*
    zenoss   python2.6  26860 19 tcp4   10.63.1.101:8081      *:*
    zenoss   python2.6  26369 3  tcp4   10.63.1.101:8080      *:*
    zenoss   python2.6  26057 7  tcp4   10.63.1.101:8100      *:*
    mysql    mysqld     12475 10 tcp4   10.63.1.101:3306      *:*
    root     rpcbind    66851 9  udp4   10.63.1.101:111       *:*
    root     rpcbind    66851 10 udp4   *:*                   *:*
    root     rpcbind    66851 12 udp4   10.63.1.101:724       *:*
    root     rpcbind    66851 13 tcp4   10.63.1.101:111       *:*
    root     rpcbind    66851 14 tcp4   *:*                   *:*
    root     syslogd    66834 6  udp4   10.63.1.101:514       *:*
    root     sendmail   66615 3  tcp4   10.63.1.101:25        *:*


Patch attached with submission follows:
How-To-Repeat: This happens in the default install of the net-mgmt/zenoss port.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-05-14 23:30:18 UTC
Maintainer of net-mgmt/zenoss,

Please note that PR ports/167897 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/167897

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2012-05-14 23:30:22 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Jason Helfman freebsd_committer freebsd_triage 2012-05-15 06:19:45 UTC
Responsible Changed
From-To: freebsd-ports-bugs->jgh

I'll take it.
Comment 4 Phil Phillips 2012-05-15 22:24:29 UTC
Thanks for finding this.  Basically, the package isn't properly handling 
the zope.conf file, so zenoss is falling back to the one shipped with 
zope.  Instead, it should be using a zenoss-specific zope.conf.

I have updated the init script to create the correct zope.conf (if a 
zope.conf file already doesn't exist).  A patch with a PORTREVISION bump 
is attached.
Comment 5 Jason Helfman freebsd_committer freebsd_triage 2012-05-16 18:24:36 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 6 dfilter service freebsd_committer freebsd_triage 2012-05-16 18:24:36 UTC
jgh         2012-05-16 17:24:23 UTC

  FreeBSD ports repository

  Modified files:
    net-mgmt/zenoss      Makefile 
    net-mgmt/zenoss/files patch-init.sh 
  Log:
  - fix startup of zenoss service
  - bump PORTREVISION
  
  PR:     ports/167897
  Submitted by:   xenophon+freebsd@irtnog.org
  Approved by:    maintainer, pphillips@experts-exchange.com
  Sponsored by: Experts Exchange, LLC.
  
  Revision  Changes    Path
  1.2       +1 -0      ports/net-mgmt/zenoss/Makefile
  1.2       +6 -2      ports/net-mgmt/zenoss/files/patch-init.sh
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"