この記事が対象とする人
以下の条件がすべて当てはまる場合、この記事で解決できます。
- Ubuntu 20.04 LTS を使用している
- PipeWire + WirePlumber(0.4以降)に乗り換えている
- AirPods / AirPods Pro をBluetoothで接続している
- 接続はできるが音が出ない(または Handsfree(HFP)モードのモノラルしか出ない)
Ubuntu 20.04 のデフォルト構成(PulseAudio)では本問題は発生しません。PipeWire に乗り換えたユーザー向けの記事です。
はじめに
| やること | コマンド |
|---|---|
| BlueZ 5.75 をソースビルドしてインストール | 本文参照 |
bluetoothd --experimental を有効化 |
systemd override で設定 |
これだけで AirPods Pro が A2DP(ステレオ・48kHz) で動作するようになります。
何が起きていたか
症状
AirPods Pro を接続すると GNOME の Sound Settings には「Headphones - AirPods Pro」と「Handsfree - AirPods Pro」の2つが表示される。
- Handsfree を選ぶと音は出るが、モノラル・16kHz の通話品質
- Headphones を選ぶと無音
根本原因:BlueZ 5.53 と WirePlumber 0.5.x の非互換
Ubuntu 20.04 のデフォルト BlueZ は 5.53(2021年リリース)。
一方で最新の PipeWire/WirePlumber は BlueZ 5.64 以降の新 Media API を必要とする。
この非互換により以下の連鎖が起きていた。
WirePlumber 0.5.x
→ BlueZ に MediaEndpoint RegisterApplication() を呼び出す
→ BlueZ 5.53 がタイムアウト (NoReply)
→ WirePlumber がレガシー API にフォールバック
→ レガシーAPIでD-Busパスが不正 → WirePlumber が ABRT クラッシュ
→ A2DP トランスポートの Acquire が永久に失敗
→ AVDTP START コマンドが送信されない → 無音
journalctl に出ていた決定的なログ:
wireplumber: Using legacy bluez5 API for A2DP - only SBC will be supported. Please upgrade bluez5.
wireplumber: wireplumber.service: Main process exited, code=dumped, status=6/ABRT
bluetoothd: a2dp-sink profile connect failed for ...: Device or resource busy
状況の変化(解決前後)
| 項目 | BlueZ 5.53(解決前) | BlueZ 5.75(解決後) |
|---|---|---|
| WirePlumber の状態 | ABRT クラッシュを繰り返す | 安定稼働 |
| 自動選択プロファイル | headset-head-unit-msbc |
a2dp-sink |
| Sink フォーマット | s16le 1ch 16000Hz |
s16le 2ch 48000Hz |
| 音声出力 | 無音 | ステレオ・高音質 |
解決手順
1. ビルド依存パッケージのインストール
sudo apt-get install -y \
build-essential autoconf automake libtool pkg-config \
libdbus-1-dev libglib2.0-dev libudev-dev \
libreadline-dev libelf-dev libdw-dev python3-docutils
2. BlueZ 5.75 のソースビルド・インストール
Ubuntu 20.04 の公式リポジトリには新しい BlueZ がないため、ソースからビルドする。
cd /tmp
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.75.tar.xz
tar xf bluez-5.75.tar.xz
cd bluez-5.75
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-experimental \
--enable-tools \
--enable-monitor \
--disable-obex
make -j$(nproc)
sudo make install
インストール先は /usr/libexec/bluetooth/bluetoothd(元の /usr/lib/bluetooth/bluetoothd とは別パス)。
バージョン確認:
/usr/libexec/bluetooth/bluetoothd --version
# → 5.75
3. bluetoothd の起動設定を更新
systemd の override ファイルで新バイナリ+--experimental フラグを指定する。
元の bluetooth.service は変更しない。
sudo mkdir -p /etc/systemd/system/bluetooth.service.d
sudo tee /etc/systemd/system/bluetooth.service.d/experimental.conf > /dev/null << 'EOF'
[Service]
ExecStart=
ExecStart=/usr/libexec/bluetooth/bluetoothd --experimental
EOF
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
起動確認:
sudo systemctl status bluetooth | grep bluetoothd
# → /usr/libexec/bluetooth/bluetoothd --experimental
4. WirePlumber を再起動して AirPods を再接続
systemctl --user restart wireplumber
bluetoothctl connect <AirPodsのMACアドレス>
接続時に以下のログが出れば成功:
[NEW] Transport /org/bluez/hci0/dev_.../sep1/fd0
Connection successful
5. 動作確認
# プロファイルが a2dp-sink になっていることを確認
pactl list cards | grep "Active Profile"
# → Active Profile: a2dp-sink
# Sink フォーマットがステレオ 48kHz になっていることを確認
pactl list sinks short | grep bluez
# → bluez_output.XX_XX_XX_XX_XX_XX.1 PipeWire s16le 2ch 48000Hz IDLE
Tips
GDM の PulseAudio 競合を無効化する
ログイン画面(GDM)が独自の PulseAudio を起動し、Bluetooth デバイスを横取りするケースがある。
sudo mkdir -p /var/lib/gdm3/.config/pulse
sudo tee /var/lib/gdm3/.config/pulse/client.conf > /dev/null << 'EOF'
autospawn = no
daemon-binary = /bin/true
EOF
接続後にプロファイルが HFP になってしまう場合
pactl set-card-profile bluez_card.XX_XX_XX_XX_XX_XX a2dp-sink
GNOME Settings → Sound → Output Device で「Headphones - AirPods Pro」を選択し直すだけでも切り替わる。
AAC コーデックについて
AirPods Pro は AAC をサポートするが、Linux の BlueZ + PipeWire 環境では AAC の実装が不安定なため SBC を使うのが安定。SBC でも 48kHz / Joint Stereo / 16blocks / 8subbands の設定で十分な音質が得られる。
デバッグ用ログ確認コマンド
# WirePlumber のリアルタイムログ(接続問題のデバッグに有効)
journalctl --user -u wireplumber -f
# BlueZ のログ
sudo journalctl -u bluetooth -f
まとめ
Ubuntu 20.04 の BlueZ 5.53 は WirePlumber 0.5.x が必要とする新 Media API を実装していないため、AirPods Pro の A2DP 接続が失敗する。
BlueZ を 5.75 にアップグレードし、--experimental を有効化することで問題が解消する。設定は systemd override ファイルに書くため、再起動後も有効。
この問題は「Ubuntu 20.04 のデフォルト BlueZ」×「新しい PipeWire スタック」×「Apple Bluetooth デバイス」という組み合わせに限定されるため、Ubuntu 22.04 以降(BlueZ 5.64+ 標準搭載)では発生しない。