Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
[Solved] Disable autostart of services post install
[Solved] Disable autostart of services post install
I'm a new Debian user, and I need help removing post-installation autostart for daemons. Is there a configuration that could be used to stop daemons from starting automatically after installation? I can mask the service before installation, but I'm curious whether there's a better way.
Last edited by eel on 2023-06-07 15:49, edited 1 time in total.
- None1975
- df -h | participant
- Posts: 1398
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 46 times
- Been thanked: 68 times
Re: [Software] Disable autostart of services post install
Your idea is not good, especially since you are a newbie (not knowing what you stopping or disabling, you can damage the system).
First of all, you should find out what one or another service is responsible for.
To see all running services on a Debian system, use the command:
This will show you each active service's name, load, sub-state, and description.
To start a systemd service, executing instructions in the service’s unit file, use the start command. If you are running as a non-root user, you will have to use sudo since this will affect the state of the operating system:
To restart a running service, you can use the restart command:
The above commands are useful for starting or stopping services during the current session. To tell systemd to start services automatically at boot, you must enable them.
To start a service at boot, use the enable command:
To disable the service from starting automatically, you can type:
Good luck.
First of all, you should find out what one or another service is responsible for.
To see all running services on a Debian system, use the command:
Code: Select all
systemctl --type=service --state=running
To start a systemd service, executing instructions in the service’s unit file, use the start command. If you are running as a non-root user, you will have to use sudo since this will affect the state of the operating system:
Code: Select all
sudo systemctl start application.service
Code: Select all
sudo systemctl restart application.service
To start a service at boot, use the enable command:
Code: Select all
sudo systemctl enable application.service
Code: Select all
sudo systemctl disable application.service
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github
Debian Wiki | DontBreakDebian, My config files on github
Re: [Software] Disable autostart of services post install
I appreciate the information.
I am new to Debian but have used CentOS for a long time. I have some knowledge of how systemd functions, however the issue I have is that a daemon is running with the default configuration after installing the package. Because several other daemons rely on it and when they're not configured properly, they keep clogging up the journal, I want to stop it. I need to know how to stop a daemon from starting automatically after installation.
I am new to Debian but have used CentOS for a long time. I have some knowledge of how systemd functions, however the issue I have is that a daemon is running with the default configuration after installing the package. Because several other daemons rely on it and when they're not configured properly, they keep clogging up the journal, I want to stop it. I need to know how to stop a daemon from starting automatically after installation.
- donald
- Debian Developer, Site Admin
- Posts: 1069
- Joined: 2021-03-30 20:08
- Has thanked: 188 times
- Been thanked: 243 times
Re: [Software] Disable autostart of services post install
@Best_Threads
Typo perfectionish.
"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank
"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank
-
- Posts: 444
- Joined: 2023-02-07 13:35
- Been thanked: 105 times
Re: [Software] Disable autostart of services post install
If you're using systemd the automatic post-installation enabling of services can be controlled by a .preset file under /etc/systemd/system-preset/, as per systemd.preset(5).
Extant configuration can be viewed in /usr/lib/systemd/system-preset/90-systemd.preset.
This seems to provide similar functionality as policy-rc.d(8) & service-policy.d(5).
EDIT: s/.conf/.preset/
Extant configuration can be viewed in /usr/lib/systemd/system-preset/90-systemd.preset.
This seems to provide similar functionality as policy-rc.d(8) & service-policy.d(5).
EDIT: s/.conf/.preset/
Last edited by Random_Troll on 2023-06-07 19:21, edited 1 time in total.
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.
Re: [Software] Disable autostart of services post install
Okay, I have it worked out. Here is a quick rundown:
Installed policyrcd-script-zg2.
Write a script that returns 101 exit code `/usr/local/sbin/daemon-killer.sh`
Make it executable
Install any daemon package by invoking `apt-get install` as
Create a bash function for persistence in /root/.bashrc.
Activate
Installed policyrcd-script-zg2.
Code: Select all
apt-get install policyrcd-script-zg2
Code: Select all
#!/bin/bash
exit 101
Code: Select all
chmod 0755 /usr/local/sbin/daemon-killer.sh
Code: Select all
POLICYRCD=/usr/local/sbin/daemon-killer.sh apt-get install vsftpd
Create a bash function for persistence in /root/.bashrc.
Code: Select all
stopdaemonmadness () {
POLICYRCD=/usr/local/sbin/daemon-killer.sh apt-get install $1
}
Code: Select all
source ~/.bashrc
Code: Select all
[Wed Jun 07 20:52:21 root@tangentnetworks /home/tangent]
# stopdaemonmadness vsftpd
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib mpv python-is-python2 python2 python2-minimal python2.7 python2.7-minimal rtmpdump youtube-dl
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
vsftpd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/153 kB of archives.
After this operation, 358 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package vsftpd.
(Reading database ... 202564 files and directories currently installed.)
Preparing to unpack .../vsftpd_3.0.3-12+b1_amd64.deb ...
Unpacking vsftpd (3.0.3-12+b1) ...
Setting up vsftpd (3.0.3-12+b1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /lib/systemd/system/vsftpd.service.
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for man-db (2.9.4-2) ...
[Wed Jun 07 20:52:37 root@tangentnetworks /home/tangent]
# systemctl status vsftpd
● vsftpd.service - vsftpd FTP server
Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Jun 07 20:24:29 tangentnetworks systemd[1]: Starting vsftpd FTP server...
Jun 07 20:24:29 tangentnetworks systemd[1]: Started vsftpd FTP server.
Jun 07 20:25:02 tangentnetworks systemd[1]: Stopping vsftpd FTP server...
Jun 07 20:25:02 tangentnetworks systemd[1]: vsftpd.service: Succeeded.
Jun 07 20:25:02 tangentnetworks systemd[1]: Stopped vsftpd FTP server.
Re: [Software] Disable autostart of services post install
Thank you. Your concept is more sophisticated than the one I had.Random_Troll wrote: ↑2023-06-07 15:19 If you're using systemd the automatic post-installation enabling of services can be controlled by a .conf file under /etc/systemd/system-preset/, as per systemd.preset(5).
Extant configuration can be viewed in /usr/lib/systemd/system-preset/90-systemd.preset.
This seems to provide similar functionality as policy-rc.d(8) & service-policy.d(5).