在系统启动时停用蓝牙的最佳方法?(使用 systemd 而不是新贵)

Met*_*tro 10 upstart bluetooth systemd 15.10

使用 systemd 每次启动时停用蓝牙的最佳方法是什么?有很多例子,但它们都适用于 upstart 和 rc.local。

使用 Ubuntu 15.10 rc.local 默认是禁用的。我认为这是有原因的,不是吗?

那么如何在没有 rc.local 脚本的情况下正确停用蓝牙目标/服务?

也许重新激活 rc.local 并添加“rfkill block bluetooth”行是正确的方法?

小智 25

首先,停止服务:

sudo systemctl stop bluetooth.service
Run Code Online (Sandbox Code Playgroud)

然后,禁用它:

sudo systemctl disable bluetooth.service
Run Code Online (Sandbox Code Playgroud)

查看:

systemctl status bluetooth.service
Run Code Online (Sandbox Code Playgroud)


小智 11

上述大多数方法完全禁用蓝牙,而可能许多用户只是希望他们的操作系统记住他们的偏好。问题是 blueman-applet 有一个自动开机设置,每次指示器启动时都会自动启用蓝牙。因此,如果您希望 Ubuntu 记住您的偏好,请打开一个终端并输入:

$ gsettings set org.blueman.plugins.powermanager auto-power-on false
Run Code Online (Sandbox Code Playgroud)

这样,您只需禁用蓝牙,操作系统就会记住它,并且在您下次打开或重新启动 PC 时不会自动重新启用它。