Need the bluetooth activated at boot, before login

Hello everybody!

I have a keyboard that connects only with bluetooth. My problem is that I can not login with it because it gets activated only after I put my password with another wired keyboard. After the login the keyboard gets paired and works fine. I read staff like "the kernel has to load the BT module at boot so I tried the command

modprobe btusb

and it had a 0 return value as it should. I am not sure about the btusb argument to the command. It should be the bluetooth driver.

Here is another command outcome I saw people put for more info:

linux-rxbz:/home/vincent # rpm -qa | grep blue
bluedevil-1.3.2_bluez5-3.1.x86_64
bluez-5.8-3.9.1.x86_64
pulseaudio-module-bluetooth-4.0.git.270.g9490a-12.1.x86_64
libbluedevil2-1.9.4_bluez5-1.1.x86_64
bluez-firmware-1.2-144.1.2.x86_64
libbluetooth3-5.8-3.9.1.x86_64

So the problem is how do I make the bluetooth work before login. Can not login with the nice keyboard and get rid of the wired one.

Thanks fore your time.

Vincent

1 Like

The only wireless keyboards I’ve had experience with use their own dedicated USB dongles, so they’re just as available as regular USB keyboards, and superior for that reason alone IMHO. Anyway, if you must use a BT keyboard here is a good archlinux Bluetooth_keyboard guide showing how to ‘automatically enable a bluetooth keyboard’ during the boot process via systemd, (so it should work for openSUSE as well.) It is essentially just a matter of creating a custom service that pairs the required device.

Now, IMO you’ll need to modify the .service file described in the wiki page. It will also require an ‘[Install]’ section at the end like this

[Install]
WantedBy=multi-user.target

*That will eliminate error messages while trying to enable it.

Once, you’ve created the file, you’ll need to enable and start it with

systemctl enable btkbd.service
systemctl start btkbd.service

See how that goes.

Nice article there. Is going to take me some time to figure that out. I will let you know how it worked. Thanks a lot.

V.

If you get stuck, I’m sure we’ll be able to help. You really only need to be concerned with the section: Automatically_enabling_a_Bluetooth_Keyboard

Good luck. :slight_smile:

I can confirm it worked for me, when trying to activate bluetooth mouse at start up / kdm screen.

[Install] section was in fact, important for an easy and instant tweak for openSUSE. I didn’t succeed when trying without it (I had found the article before finding this openSUSE specific thread ) at first try.

I paste here as an example my service file, with credits due to the pointed archlinux forum.

As a sidenote, I created my service file in /usr/lib/systemd/system/ instead of /etc/systemd/system/ . Just because when comparing it seemed to be a better path for openSUSE. I imagine there is no difference as for funciontality, though.

It’d be possible then to put more devices in the same service file, wouldn’t it? Separating by spaces only the MACs / names in the conf file?

Thanks for the great assistance anyway, deano_ferrari! :good:

Example btbkd.service file:

[Unit]
Description=systemd Unit to automatically start a Bluetooth Keyboard
# ammended [Install] section at the end as suggested in https://forums.opensuse.org/showthread.php/500207-Need-the-bluetooth-activated-at-boot-before-login
Documentation=https://wiki.archlinux.org/index.php/Bluetooth_Keyboard
Requires=dbus-org.bluez.service
After=dbus-bluez.org.service
ConditionPathExists=/etc/btkbd.conf
ConditionPathExists=/usr/bin/hcitool
ConditionPathExists=/usr/bin/hciconfig

[Service]
Type=oneshot
EnvironmentFile=/etc/btkbd.conf
ExecStart=
ExecStart=/usr/bin/hciconfig ${HCIDEVICE} up
# ignore errors on connect, spurious problems with bt? so start next command with -
ExecStart=-/usr/bin/hcitool cc ${BTKBDMAC}

[Install]
WantedBy=multi-user.target

An example btkbd.conf file to be pasted on /etc would be:

# Config file for btkbd.service
# change when required (e.g. keyboard hardware changes, more hci devices are connected)
BTKBDMAC = AA:BB:CC:DD:EE:FF
HCIDEVICE = Bluetooth Keyboard

Of course, MAC and device name should be replaced by your target device.

Glad to have been of help. :slight_smile:

As a sidenote, I created my service file in /usr/lib/systemd/system/ instead of /etc/systemd/system/ . Just because when comparing it seemed to be a better path for openSUSE. I imagine there is no difference as for funciontality, though.

Custom services are supposed to be added to /etc/systemd/system/, but the above usually relates to modifying existing services of the same name (so that they don’t get overwritten). In your case, it doesn’t apply, since it is a ‘new’ service.