Zabbix: Can’t recreate shared memory for collector. [too many attempts]

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, September 10, 2011

Follow me on Twitter as @mattiasgeniar

You can see the following error in your logs with Zabbix Agent.

  8412:20110908:081804.268 Zabbix Agent started. Zabbix 1.8.3 (revision 13928).

8412:20110908:081809.273 Can’t recreate shared memory for collector. [too many attempts]

While it’s not guaranteed, this can be the cause of leftover semaphores. If Zabbix Agent is stopped, try the following.

~# ipcs -a |more

-–-– Shared Memory Segments -–-—-

key        shmid      owner      perms      bytes      nattch     status

0x7402017d 1343488    root      600        4          0

0x74020153 2031617    root      600        4          0

** 0x6c028449 2555906    501       666        1000232    0**

0x74020152 1998851    root      600        4          0

** 0x6c028466 2588676    zabbix    666        1000232    0**

-–-– Semaphore Arrays -–-—-

**key        semid      owner      perms      nsems     **

**0x7a028449 360448     zabbix    666        7     **

-–-– Message Queues -–-—-

key        msqid      owner      perms      used-bytes   messages

If all Zabbix Processes are stopped, but there are still semaphores left for that Zabbix user, you can manually remove them. In my case, they remained because of a change in the user (was previously UID 501 (as seen in bold above)). I had to remove those semaphores manually.

First, remove the Shared Memory identifiers:

~# ipcrm -M 0x6c028449

~# ipcrm -M 0x6c028466

Then remove the Semaphore Array:

~# ipcrm -S 0x7a028449

You should be able to start your Zabbix Agent normally now.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.