Recommended way to disable/enable services?
Recommended way to disable/enable services?
In MX what is the recommended way to enable or disable startup services that don't appear in Session and Startup / Application Autostart?
I want to keep the useless services below from automatically running. Some of them appear to be listening on the internet for devices or services that don't exist and I think they might be security hazards:
bluetooth (computer doesn't have bluetooth)
saned (no scanner)
cups (no printer)
cups-browsed (no network printer)
avahi-daemon (no network printer or file server)
samba (no network file server)
nmbd (no network file server)
smbd (no network file server)
nfs-common (no network file server)
nfs-kernel-server (no network file server)
openvpn (no vpn)
pppd-dns (no dial-up modem)
ModemManager (no dial-up modem)
unattended-upgrades (I manually check for upgrades very day)
There are several tools and commands I have run across:
sudo sysv-rc-conf
sudo rcconf
sudo update-rc.d [service] disable
sudo systemctl disable --now [service]
but I don't know if they all do the same thing or how they work in MX having both systemd and sysvinit and they don't all appear to work for all services.
Also what is the best way to list running services?
I have been using:
systemctl list-unit-files --type=service --state=enabled
on *buntu and it appears to work on MX but I don't know if it works properly on sysvinit.
I want to keep the useless services below from automatically running. Some of them appear to be listening on the internet for devices or services that don't exist and I think they might be security hazards:
bluetooth (computer doesn't have bluetooth)
saned (no scanner)
cups (no printer)
cups-browsed (no network printer)
avahi-daemon (no network printer or file server)
samba (no network file server)
nmbd (no network file server)
smbd (no network file server)
nfs-common (no network file server)
nfs-kernel-server (no network file server)
openvpn (no vpn)
pppd-dns (no dial-up modem)
ModemManager (no dial-up modem)
unattended-upgrades (I manually check for upgrades very day)
There are several tools and commands I have run across:
sudo sysv-rc-conf
sudo rcconf
sudo update-rc.d [service] disable
sudo systemctl disable --now [service]
but I don't know if they all do the same thing or how they work in MX having both systemd and sysvinit and they don't all appear to work for all services.
Also what is the best way to list running services?
I have been using:
systemctl list-unit-files --type=service --state=enabled
on *buntu and it appears to work on MX but I don't know if it works properly on sysvinit.
Re: Recommended way to disable/enable services?
List running services with
For simply adding or removing servicesis probably best. n.b. - for remove to work the /etc/init.d/[service] file must already have been deleted, and obviously, to add one that file needs to be present.
sysv-rc-conf is quite useful for managing which run levels a particular service will run, but clumsier for removing one entirely since you have to toggle each level currently enabled.
Code: Select all
sudo service --status-all
Code: Select all
sudo update-rc.d [service] defaults # to add
sudo update-rc.d [service] disable # to disable but leave init script available to later
sudo update-rc.d [service] enable
sudo update-rc.d [service] remove # to remove
sysv-rc-conf is quite useful for managing which run levels a particular service will run, but clumsier for removing one entirely since you have to toggle each level currently enabled.
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB
Re: Recommended way to disable/enable services?
But... surely the easiest way would be to deselect them at installation time?
- Head_on_a_Stick
- Posts: 919
- Joined: Sun Mar 17, 2019 3:37 pm
Re: Recommended way to disable/enable services?
That command shows enabled services, to list running services use
Code: Select all
systemd-cgls
Code: Select all
systemd-cgtop
For sysvinit please note that the service --status-all command will only return useful information for init scripts that have a status command and so it cannot list all running services, this is because sysvinit does not offer true process supervision (which is one of the reasons why Debian dropped it).
mod note: Signature removed, please read the forum rules
Re: Recommended way to disable/enable services?
How?
I installed MX last week and I don't recall the installer having any choices for anything but SAMBA, CUPS and SANE, and as far as I can tell those choices near the end of the installer don't work. I still had to go in afterwards and try to disable everything.
Re: Recommended way to disable/enable services?
Some times it is worth reading a manual no matter how much knowledge we have.BV206 wrote: ↑Wed May 08, 2019 5:56 pmHow?
I installed MX last week and I don't recall the installer having any choices for anything but SAMBA, CUPS and SANE, and as far as I can tell those choices near the end of the installer don't work. I still had to go in afterwards and try to disable everything.
Open the MX User Manual, go to Figure 2-20: Installer Screen 6. You will find a button "View" under 6d. Service Setting (advanced), if you had checked there you would have seen some of the services, I don't remember all that are there. You will now know for when you ever need to install again.
It is easier to fight for one's principles then to live up to them.
Re: Recommended way to disable/enable services?
That's exactly what I was talking about earlier.towwire wrote: ↑Wed May 08, 2019 8:14 pm Open the MX User Manual, go to Figure 2-20: Installer Screen 6. You will find a button "View" under 6d. Service Setting (advanced), if you had checked there you would have seen some of the services, I don't remember all that are there. You will now know for when you ever need to install again.
You can't disable any service you want with the installer. It has a few options but not all of the stuff I wanted disabled.
The Samba check box a few screens before the advanced screen doesn't appear to do anything.
Re: Recommended way to disable/enable services?
Time to double check or to use bugtracker
Re: Recommended way to disable/enable services?
Thanks - one more thing to work on "when I have the time".BV206 wrote: ↑Wed May 08, 2019 3:27 pm bluetooth (computer doesn't have bluetooth)
saned (no scanner)
cups (no printer)
cups-browsed (no network printer)
avahi-daemon (no network printer or file server)
samba (no network file server)
nmbd (no network file server)
smbd (no network file server)
nfs-common (no network file server)
nfs-kernel-server (no network file server)
openvpn (no vpn)
pppd-dns (no dial-up modem)
ModemManager (no dial-up modem)
unattended-upgrades (I manually check for upgrades very day)
I can see where disabling some (most) of these would be a goodness in my environment; I also don't have a file server, dial-up modem, or bluetooth.
AsusTek PRIME B450-Plus
AMD Ryzen 7 2700 (8-Core, 16 threads)
Radeon HD 6570/7570/8550 / R5 230
Realtek RTL8111/8168/8411 - driver: r8169
Samsung SSD 860 EVO 500GB
DDR4 3200MHz CL16 2x8GB
AMD Ryzen 7 2700 (8-Core, 16 threads)
Radeon HD 6570/7570/8550 / R5 230
Realtek RTL8111/8168/8411 - driver: r8169
Samsung SSD 860 EVO 500GB
DDR4 3200MHz CL16 2x8GB
Re: Recommended way to disable/enable services?
I don't think it's the job of the installer to enable/disable services so I don't change anything. After installation or in a live environment with persistence it's easy to make the changes you want. I recommend that you install the package bum (Boot-Up Manager). It's a GUI application that you can launch from the menu. It takes a while when you launch it for the first time. After that it's faster. It lists running (and not running) services on your system. I prefer it to the "sudo service --status-all" command. It has an Advanced checkbox that will give you some more info for example if the service is related to a deb package and the name of that deb package and a link to the service homepage where you can find more info.
"Off topic": Windows has many management GUIs (from Microsoft and third party), to the point where you hardly have to use the command line. I understand that the CLI is often faster and the way to go if you want to learn a system. But I also think a GUI can provide a better overview and give you info from several commands at the same time. Boot-Up Manager is a bit dated, but as far as I can tell it's fully functional. I hope MX devs package Boot-Up Manager for a Debian Buster based release. Since it's based on sysvinit and not systemd it's unlikely that BUM would suddenly stop working due to low-level breaking changes.