Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

systemctl disable name.service doesn't persist after reboot

I'm trying to find a way to disable Bluetooth on Ubuntu 16.04 at startup , the one way i kept stumbling upon online is using systemd

Basically

First, stop the service:

sudo systemctl stop bluetooth.service

Then disable it:

sudo systemctl disable bluetooth.service

Check:

sudo systemctl status bluetooth.service

https://askubuntu.com/questions/744640/best-way-to-deactivate-bluetooth-on-system-startup-with-systemd-and-not-upstar

but every time i reboot it's back on and i couldn't find anyone online complaining that systemd disable command didn't work like in my case

even on the ubuntu wiki it says that it should work what am i doing wrong ?

https://wiki.ubuntu.com/SystemdForUpstartUsers

here is the output when i run these commands

    mohamed@mohamed-UX330UAK:~$ sudo systemctl stop bluetooth.service
[sudo] password for mohamed: 
mohamed@mohamed-UX330UAK:~$ sudo systemctl disable bluetooth.service
Synchronizing state of bluetooth.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install disable bluetooth
insserv: warning: current start runlevel(s) (empty) of script `bluetooth' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `bluetooth' overrides LSB defaults (0 1 6).
insserv: warning: current start runlevel(s) (empty) of script `bluetooth' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `bluetooth' overrides LSB defaults (0 1 6).
mohamed@mohamed-UX330UAK:~$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor prese
   Active: inactive (dead) since Wed 2017-04-26 19:56:04 AEST; 23s ago
     Docs: man:bluetoothd(8)
 Main PID: 882 (code=exited, status=0/SUCCESS)
   Status: "Quitting"

Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: Endpoint registered: sender=:1
Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: Endpoint registered: sender=:1
Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: RFCOMM server failed for Heads
Apr 26 19:42:34 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:42:34 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:56:04 mohamed-UX330UAK systemd[1]: Stopping Bluetooth service...
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Terminating
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:56:04 mohamed-UX330UAK systemd[1]: Stopped Bluetooth service.
lines 1-17/17 (END)...skipping...
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor prese
   Active: inactive (dead) since Wed 2017-04-26 19:56:04 AEST; 23s ago
     Docs: man:bluetoothd(8)
 Main PID: 882 (code=exited, status=0/SUCCESS)
   Status: "Quitting"

Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: Endpoint registered: sender=:1
Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: Endpoint registered: sender=:1
Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: RFCOMM server failed for Heads
Apr 26 19:42:34 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:42:34 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:56:04 mohamed-UX330UAK systemd[1]: Stopping Bluetooth service...
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Terminating
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=
Apr 26 19:56:04 mohamed-UX330UAK systemd[1]: Stopped Bluetooth service.
~
~
~
~
~
~
~
lines 1-17/17 (END)...skipping...
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2017-04-26 19:56:04 AEST; 23s ago
     Docs: man:bluetoothd(8)
 Main PID: 882 (code=exited, status=0/SUCCESS)
   Status: "Quitting"

Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: Endpoint registered: sender=:1.79 path=/MediaEndpoint/A2DPSource
Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: Endpoint registered: sender=:1.79 path=/MediaEndpoint/A2DPSink
Apr 26 19:42:19 mohamed-UX330UAK bluetoothd[882]: RFCOMM server failed for Headset Voice gateway: rfcomm_bind: Address already in use (98)
Apr 26 19:42:34 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=:1.43 path=/MediaEndpoint/A2DPSource
Apr 26 19:42:34 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=:1.43 path=/MediaEndpoint/A2DPSink
Apr 26 19:56:04 mohamed-UX330UAK systemd[1]: Stopping Bluetooth service...
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Terminating
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=:1.79 path=/MediaEndpoint/A2DPSource
Apr 26 19:56:04 mohamed-UX330UAK bluetoothd[882]: Endpoint unregistered: sender=:1.79 path=/MediaEndpoint/A2DPSink
Apr 26 19:56:04 mohamed-UX330UAK systemd[1]: Stopped Bluetooth service.
like image 397
Mohamed ElSayed Avatar asked Apr 26 '17 10:04

Mohamed ElSayed


People also ask

How do I permanently disable a service in Linux?

systemctl disable servicename . Running systemctl disable removes the symlink to the service in /etc/systemd/system/* . From now on, that service won't start on boot anymore. Save this answer.

Does Systemctl disable stop the service?

2 Enabling and disabling services with systemctl Enabling a service means it will start at boot. Disabling a service means it will not start at boot, but can be started manually, or as a dependency of another service.


1 Answers

Perhaps the service is being started by a dependency. There is a third level of "off" with systemd that you can try, called "masking":

systemctl mask bluetooth.service

Once masked, a service can't be started at all, even manually. You can 'unmask' it later.

like image 68
Mark Stosberg Avatar answered Sep 24 '22 09:09

Mark Stosberg