Setting Up Bluetooth on Aegix Linux — Or Any Artix Base-with-Runit Distro

Professor Hamstring
5 min readDec 28, 2023

--

“Linux and Bluetooth do not mix well!”, they said…

If you are running a systemd-free distribution with an Artix base and Runit init system and believed the aforementioned rumor about Bluetooth at any point, then this article is for you.

Whether you’re connecting peripherals like keyboards and ☆specialty left-handed wireless mice☆, or just streaming audio, you can seamlessly integrate Bluetooth functionality into your Runit-having systemd-free device using a straightforward, non-intimidating process:

  • Updating your system
  • Installing necessary packages
  • Enabling and starting the Bluetooth service
  • Pairing and/or connecting devices

At the time of writing this article, I am running Aegix Linux. Aegix Linux offers a more traditional Unix-like experience and is known for its simplicity, speed, security, and automatic encrypted backups.

Now let’s get these next 7 minutes over with…

0. Update Your System

Before proceeding with the Bluetooth setup, I recommend updating your system for the sake of security and functionality. Open your terminal and execute the following command:

✨ ~ sudo pacman -Syu

This command will update your system’s package database and upgrade all your installed packages to their latest versions.

1. Install Bluetooth Packages

For Bluetooth functionality, you’ll need specific packages. `bluez` is the official Linux Bluetooth protocol stack, providing the core functionality, while `bluez-utils` includes various utilities, one of which is `bluetoothctl`, a command-line tool to manage Bluetooth.

Install these packages with the following command:

✨ ~ sudo pacman -S bluez bluez-runit bluez-utils

2. Enable Bluetooth Service

Artix Linux utilizes the Runit init system, so enabling services differs from systemd. To enable the Bluetooth service, create a symbolic link in the Runit service directory:

✨ ~ sudo ln -s /etc/runit/sv/bluetoothd /run/runit/service/

This command links the `bluetoothd` service to be started and managed by Runit.

3. Start Bluetooth Service

To start the Bluetooth service immediately without requiring a system reboot, use the Runit service manager sv:

✨ ~ sudo sv up bluetoothd

After starting the service, it’s a good practice to verify that it’s active and running smoothly. To check the status of the bluetoothd service, use:

✨ ~ sudo sv status bluetoothd

This command will provide output indicating whether the bluetoothd service is up and running. The expected output should look something like this if the service is active:

run: bluetoothd: (pid 6828) 431s

If the service is not running, you may see a message like:

down: bluetoothd: 3s, normally up

This indicates that the service is not active but is configured to start (normally up). In such cases, reviewing the logs or attempting to start the service again may be necessary.

4. Configure Bluetooth (Optional)

For most users, the default Bluetooth settings will suffice. However, advanced users can modify the Bluetooth configuration by editing the files in /etc/bluetooth/, primarily main.conf. Be cautious: incorrect settings can affect Bluetooth functionality, so I recommend creating a backup of main.conf in its working state prior to making changes.

5. Pairing Devices

Pairing and managing Bluetooth devices is handled via thebluetoothctlcli tool. To start, enter:

✨ ~ bluetoothctl

## Example Output
Waiting to connect to bluetoothd… [bluetooth]# hci0 new_settings: powered bondable ssp br/edr
[bluetooth]# Agent registered
[bluetooth]# [CHG] Controller 60:D8:19:AE:70:51 Pairable: yes
[bluetooth]#

Within bluetoothctl, you have several commands at your disposal:

  • power on: Activates the Bluetooth module.
  • scan on: Starts scanning for nearby Bluetooth devices.
  • pair [device]: Initiates pairing with a device. Replace `[device]` with the MAC address of the device.
  • connect [device]: Connects to a paired device.
  • disconnect [device]: Disconnects a device.
  • set-alias [device]: Renames a device.
  • exit: Exits thebluetoothctlcli tool

Here’s a brief walkthrough:

  • In the bluetoothctl prompt, start by turning on the Bluetooth module:
[bluetooth]# power on

## Example Output
[bluetooth]# Changing power on succeeded
[bluetooth]#
  • Then enable scanning:
[bluetooth]# scan on

## Example Output
[bluetooth]# SetDiscoveryFilter success
[bluetooth]# Discovery started
[bluetooth]# [CHG] Controller 60:D8:19:AE:70:51 Discovering: yes
[bluetooth]# [NEW] Device 84:AC:60:11:84:EA JLab GO Air Pop
[bluetooth]#
  • Once you see your device listed, use its MAC address to pair:
[bluetooth]# pair 84:AC:60:11:84:EA

## Example Output
Attempting to pair with 84:AC:60:11:84:EA
[CHG] Device 84:AC:60:11:84:EA Connected: yes
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA Bonded: yes
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA ServicesResolved: yes
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA Paired: yes
[JLab GO Air Pop]# Pairing successful
[CHG] Device 84:AC:60:11:84:EA ServicesResolved: no
[CHG] Device 84:AC:60:11:84:EA Connected: no
[bluetooth]#
  • And then connect to any of the listed devices using its MAC address:
[bluetooth]# connect 84:AC:60:11:84:EA

## Example Output
Attempting to connect to 84:AC:60:11:84:EA
[CHG] Device 84:AC:60:11:84:EA Connected: yes
[JLab GO Air Pop]# [NEW] Endpoint /org/bluez/hci0/dev_84_AC_60_11_84_EA/sep1
[JLab GO Air Pop]# [NEW] Endpoint /org/bluez/hci0/dev_84_AC_60_11_84_EA/sep2
[JLab GO Air Pop]# [NEW] Transport /org/bluez/hci0/dev_84_AC_60_11_84_EA/sep2/fd0
[JLab GO Air Pop]# Connection successful
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA ServicesResolved: yes
[JLab GO Air Pop]# [CHG] Transport /org/bluez/hci0/dev_84_AC_60_11_84_EA/sep2/fd0 Volume: 0x0060 (96)
[JLab GO Air Pop]#

And when you wish to disconnect, simply use the disconnect command:

[JLab GO Air Pop]# disconnect 84:AC:60:11:84:EA

## Example Output
Attempting to disconnect from 84:AC:60:11:84:EA
[JLab GO Air Pop]# [DEL] Transport /org/bluez/hci0/dev_84_AC_60_11_84_EA/sep2/fd1
[JLab GO Air Pop]# [DEL] Endpoint /org/bluez/hci0/dev_84_AC_60_11_84_EA/sep1
[JLab GO Air Pop]# [DEL] Endpoint /org/bluez/hci0/dev_84_AC_60_11_84_EA/sep2
[JLab GO Air Pop]# [CHG] Device 84:AC:60:11:84:EA ServicesResolved: no
[JLab GO Air Pop]# Successful disconnected
[CHG] Device 84:AC:60:11:84:EA Connected: no
[bluetooth]#

6. Rename Devices (Optional)

Tired of these boring device names? Well, so am I…To give devices a custom name using bluetoothctl, you can use the set-alias command. Here's a step-by-step guide on how to do it:

  • List Available Devices: List the devices you have paired with or discovered to find the one you want to rename:
devices

This command will list devices with their MAC addresses.

  • Select the Device: If the device you want to rename is not connected, you may need to connect it first using its MAC address:
connect 84:AC:60:11:84:EA

Replace 84:AC:60:11:84:EA with the actual MAC address of the device.

  • Set a New Alias: To rename the device, use the set-alias command followed by the new name you want to assign to the device (I decided to go with a very ‘corporate-sounding’ name but…you do you):
set-alias "Synergy Dave's Headset For Circling Back"

Replace "Synergy Dave's Headset For Circling Back" with your desired name for the device.

  • Verify the Change: You can use the devices command again to verify that the name has been changed:
Exit bluetoothctl: Once you're done, you can exit bluetoothctl by typing exit and pressing Enter.

Note that this change is made on your local device, meaning the alias you set is what your computer will use to identify the Bluetooth device. The actual device name (as it would appear to other devices) is not changed by this procedure.

And — believe it or not — that is it. Enjoy!

(⊃。•́‿•̀。)⊃━☆.*・。

༺With love༻

Mason Ulrika

--

--

Professor Hamstring

☆ Planet Uranus Approved Since 2020 ☆ Follow for Linux, Command Line, Coding, Toy Problem, and Aegix Linux-Related Content ♡