Package Operation failed on every installation

I'm extremely new for the Ubuntu(Linux systems), my question is when I install any program in Ubuntu 14.04 LTS ,its giving a message like below(sine times error is different but like this too).and also when I install software using terminal or software center ,the error is same like this.. although the error is occurred installed softwares are working properly please help me to solve this.

Error were encountered While Processing:
Samba
winbind
Error in function:
Setting up samba(2:4:1.6+dfsg-1ubuntu2.14.04.3)..
smbd start/pre-start, process 1120
start: Job failed to start
invoke-rc.d:initscript samba-ad-dc, action "start" failed
dpkg:error processing package samba(-configure):
subprocess installed post-installation script returned error exit status 1
dpkg:dependency problems prevent configuration of winbind:
winbind depends on samba(=2:.4.1.6+dfsg-1ubuntu.14.04.3);however:
Package samba is not configured yet
dpkg: error processing package winbind (--configure):
dependency problems- leaving unconfigured

Solution 1:

Did you, by any chance, interrupt an install process? I think something like that might have caused it.

Try the following command in the terminal:

sudo dpkg-reconfigure -a

This should reconfigure all your packages, but may take some time. I added the switch -a for all packages, since multiple packages seem to be causing issues. For more information about this command type the following command to see the manual page of the command:

man dpkg-reconfigure