I want to stop some daemons from loading at boot time, specially squid3. What is the best way of doing this?
You can use the chkconfig utility for this purpose.
sudo apt-get install chkconfig
To check the run level status of squid you can run this command:
chkconfig --list | grep squid
This will output something like below:
squid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
To turn off squid in all run level you can use this command:
sudo chkconfig squid off chkconfig --list | grep squid squid 0:off 1:off 2:off 3:off 4:off 5:off 6:off
To turn off squid in a particular run level you can use this command:
chkconfig --level 3 squid off
System daemons can use either legacy SysV init scripts or the newer Upstart.
For sysv scripts there are several management tools, one of such tools is "sysv-rc-conf" from the "sysv-rc-conf" package, install it and launch it from the terminal.
Regarding Upstart as far as I know there is no management tool yet, you need to manually rename the corresponding script from /etc/init, eg:
mv /etc/init/ufw.conf /etc/init/ufw.conf.disabled
Squid3 uses sysv init scripts, you can disable it with sysv-rc-conf .
The above answers did not work for my Ubuntu 16.04.
Here is what it worked:
sudo systemctl stop squid update-rc.d squid disable sudo systemctl status squid
Although you may get an error like:
insserv: warning: current start runlevel(s) (empty) of script squid overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `squid' overrides LSB defaults (0 1 6). insserv: fopen(.depend.stop): Permission denied
The service remains stopped even after reboot.
If you know why the error happens and how to fix it, please feel free to comment or edit the answer.