Fix Zoneminder Failed to Start Automatically on Boot

See log file to see the problem:

cat /var/log/syslog | tr -d '\0' | grep "Failed to start" -A 10 -B 10

If you see this line below, then we may have solution:

Can't connect to local MySQL server through socket

Ubuntu 16.04.01 LTS is using systemd
Use this command to see your ubuntu version:

lsb_release -a

Zoneminder service described in this file:

/etc/systemd/system/multi-user.target.wants/zoneminder.service

By default it is remarked:

#Requires=mysql.service

Remove the remark so it waits mysql before starts:

Requires=mysql.service

For Ubuntu 14.04 add sleep command in /etc/init.d/zoneminder after start() line, so it looks like below:

start() {
sleep 15 #wait for mysql
echo -n "Starting $prog: "

Source:
– https://forums.zoneminder.com/viewtopic.php?t=23630
– https://wiki.zoneminder.com/Ubuntu_Server_14.04_64-bit_with_Zoneminder_1.28.0_the_easy_way

Setup new zoneminder ubuntu server 14.04

1. Download Ubuntu Server ISO (choose Bittorent LTS Server)
http://www.ubuntu.com/download/alternative-downloads

2. Install Ubuntu Server (need internet connection, install Basic Server, OpenSSH, LAMP, Samba)
http://www.zoneminder.com/wiki/index.php/Ubuntu_Server_14.04_64-bit_with_Zoneminder_1.28.0_the_easy_way

3. Install Webmin
http://www.webmin.com/deb.html

4. Configure dedicated HDD storage (optional)
a. List partitions
lsblk
b. List UUID
blkid
c. Configure fstab (using UUID or device path)
http://www.zoneminder.com/wiki/index.php/Using_a_dedicated_Hard_Drive

5. Configure samba (optional)
https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated,%20Simple%20and%20Brief%20Way!

6. Install/Configure ffmpeg (optional, if you want to export video)
https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media
http://www.zoneminder.com/wiki/index.php/How_to_export_an_event_as_video

7. Add cameras
http://www.zoneminder.com/wiki/index.php/D-Link#DCS-5010L_and_DCS-5020L
http://www.zoneminder.com/wiki/index.php/D-Link_DCS-5020L_Control_Script
http://www.zoneminder.com/wiki/index.php/SC-3171

8. Enjoy