When we get this error, you can’t execute any Zimbra zmprov commands. This is devastating since daily Zimbra Admin users use Zimbra CLI a lot. When execute zmprov, suddenly get error Zimbra “zclient.IO_ERROR …” with detail like below.
ERROR: zclient.IO_ERROR (invoke Connection refused, server: localhost) (cause: java.net.ConnectException Connection refused)
What is Zimbra zmprov?
The zmprov tool performs all provisioning tasks in Zimbra LDAP, including creating accounts, aliases, domains, COS, distribution lists, and calendar resources. Each operation is invoked through command-line options, each of which has a long name and a short name.
What causes this error?
First, the main cause for this error is when Zimbra zmprov is not configured to get results from LDAP. To fix this, you need to set zimbra_zmprov_default_to_ldap to TRUE. This will make sure all the zmprov commands get replies from LDAP server.
How to fix it.
Do a checking for the setting of zimbra_zmprov_default_to_ldap
to be sure.
zimbra@mbox1:~$ zmlocalconfig |grep zmprov
zimbra_zmprov_default_soap_server = localhost
zimbra_zmprov_default_to_ldap = false
zmprov_safeguarded_attrs = zimbraServiceEnabled,zimbraServiceInstalled
zmprov_tmp_directory = ${zimbra_tmp_directory}/zmprov
If set to false, reconfigure it to have the true flag. This will enable the setting.
zimbra@mbox1:~$ zmlocalconfig -e zimbra_zmprov_default_to_ldap=true
Then recheck the settings again:
$ zmlocalconfig |grep zmprov
zimbra_zmprov_default_soap_server = localhost
zimbra_zmprov_default_to_ldap = true
zmprov_safeguarded_attrs = zimbraServiceEnabled,zimbraServiceInstalled
zmprov_tmp_directory = ${zimbra_tmp_directory}/zmprov
Now try to execute any zmprov commands and see if it’s working fine.
$ zmprov gs `zmhostname` | grep zimbraServiceEnabled
zimbraServiceEnabled: amavis
zimbraServiceEnabled: antivirus
zimbraServiceEnabled: antispam
zimbraServiceEnabled: opendkim
zimbraServiceEnabled: stats
zimbraServiceEnabled: logger
zimbraServiceEnabled: service
zimbraServiceEnabled: zimbra
zimbraServiceEnabled: zimbraAdmin
zimbraServiceEnabled: zimlet
zimbraServiceEnabled: mailbox
zimbraServiceEnabled: spell
zimbraServiceEnabled: ldap
zimbraServiceEnabled: mta
zimbraServiceEnabled: snmp
zimbraServiceEnabled: dnscache
If this doesn’t solve your problem, try changing the zimbra_zmprov_default_soap_server to the IP address of your Mailbox server. Your setting will look like this.
May be it’s helpful, please feel free to leave a comment if you have any questions and I’ll appreciate it. Or if there is another method fix, you can also add it in the comments, I will mention you and add a backlink to your website.
Let's Buy Me Coffee. https://saweria.co/habibzain https://ko-fi.com/habibzain