0

I'm trying to enable bluetooth service, only for the graphical.target, alias runlevel 5.

I'm on Debian Jessie, it's using systemd.

I was told to create a symlink in the /etc/systemd/system/graphical.target.wants directory, but i'm still a bit lost.

i have already tried using update-rc.d, didn't work.

in /etc/systemd/system, there is a folder called bluetooth.service.wants, there's a bluetooth.service file in there, which contains the unit informations.

there's also another .service file in /etc/systemd/system which is actually an alias for the original bluetooth.service. thanks

  • Explain with an edit of your answer what you have already tried please. – Pimp Juice IT May 7 '17 at 20:39
0

This answer on Unix.SE provides a good overview on how to create a custom target.

Apparently, you cannot easily override the [Install] section of a systemd unit. It defines which target “will want” the unit.

~ # systemctl enable apcupsd
Created symlink /etc/systemd/system/multi-user.target.wants/apcupsd.service → /usr/lib/systemd/system/apcupsd.service.

~ # cat /usr/lib/systemd/system/apcupsd.service
[Unit]
Description=APC UPS Monitor

[Service]
ExecStart=/usr/bin/apcupsd -b

[Install]
WantedBy=multi-user.target

As you can see, enabling a unit (not just a service!) is as simple as creating a symlink. Now when systemd is told to start multi-user.target it will also start apcupsd.service.

So you first need to find out where bluetooth.service is located. I’ll assume it’s at /usr/lib/systemd/system/bluetooth.service. Then you just need to:

~ # ln -s /usr/lib/systemd/system/bluetooth.service /etc/systemd/system/graphical.target.wants/bluetooth.service

If the graphical.target.wants directory does not exist, you need to create it first.

  • thanks a lot, i'll try it out and tell you if it works ! – UndefinedUserAtSO May 8 '17 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.