Ubuntu 20.04.3 LTS(64bit) on Raspberry Pi 4 Model B(8GB) でオンボードbluetoothを使う
結論
bluetoothまわりのパッケージが linux-firmware-raspi2
とコンフリクトして手動でパッチを当てないと動かない
対策
素直に市販のUSBドングルをぶっ刺せばマウスもスピーカーも問題なく利用できた
原因
どうやら linux-firmware-raspi2
が依存している bluetoothパッケージのバージョンになんか問題があるっぽい。
いくつかのブログを参考にしたところ以下の手順で使えるようにはなるっぽい(試してない)
linux-firmware-raspi2
をいったんapt remove
で削除(ここでlinux-firmware-raspi2
が依存しているpi-bluetooth
なども一緒に削除される)- 最新の
pi-bluetooth
などをコンフリクトせずにインストールできるようになったのでapt install
する- インストールしたbluetoothの関連ファイルを拾ってひとまとめにしておく (
tar czf
)- [02] でインストールした
pi-bluetooth
などをapt remove
する- 改めて
linux-firmware-raspi2
をapt install
する(ここでlinux-firmware-raspi2
が依存するpi-bluetooth
なども再インストールされる)- [03] でひとまとめにしておいた関連ファイルを同じディレクトリに展開して上書きする
Ubuntu 18.0.4 for Raspberry Pi B4 で Bluetooth を使いたい
https://www.hiro345.net/blogs/hiro345/archives/19932.html
Raspberry Pi 4に Ubuntu server 18.04をインストール
https://qiita.com/hiro-han/items/56c4fb6a1ad4c1713a7f#bluetooth%E3%81%AE%E8%A8%AD%E5%AE%9A
しかし、この方法は手動で bluetooth 関連ファイルを上書きして動かせるようにしているので今後関連するパッケージが apt update された場合に動かなくなる可能性があると思ったので私はこの方法は諦めた。
素直にUSBドングル買って取り付けたらめちゃくちゃスムーズに bleutooth 使えたのでそちらがオススメです。
エラーなどのメモ
pi-bluetoothインストールしようとしたらよくわからんパッケージ依存ぶっこわれたので復旧方法
$ sudo apt install pi-bluetooth .... $ sudo dpkg --configure -a dpkg: dependency problems prevent configuration of pi-bluetooth: pi-bluetooth depends on bluez-firmware; however: Package bluez-firmware is not installed. dpkg: error processing package pi-bluetooth (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: pi-bluetooth $ sudo dpkg -P --force-depends pi-bluetooth
apt upgradeすると Sub-process なんちゃらのエラーが出てコケる
どのタイミングでこのエラーが出るようになったのが覚えていないが、raspi-configをインストールした影響か、 bluetooth まわりを色々いじってて pi-bluetooth
とかそのへんインストールしたり削除したりした影響?
apt (dkpg)まわりのゴミ設定が残ってたのが原因だった
$ sudo apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y Setting up raspberrypi-kernel (1:1.20210805-1) ... run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.10.52+ /boot/kernel.img run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.10.52+ /boot/kernel.img run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 5.10.52+ /boot/kernel.img run-parts: executing /etc/kernel/postinst.d/update-notifier 5.10.52+ /boot/kernel.img run-parts: executing /etc/kernel/postinst.d/xx-update-initrd-links 5.10.52+ /boot/kernel.img run-parts: executing /etc/kernel/postinst.d/zz-flash-kernel 5.10.52+ /boot/kernel.img /etc/kernel/postinst.d/zz-flash-kernel: Using DTB: bcm2711-rpi-4-b.dtb Couldn't find DTB bcm2711-rpi-4-b.dtb on the following paths: /etc/flash-kernel/dtbs /usr/lib/linux-image-5.10.52+ /lib/firmware/5.10.52+/device-tree/ Installing into /boot/dtbs/5.10.52+/./bcm2711-rpi-4-b.dtb cp: cannot stat '': No such file or directory run-parts: /etc/kernel/postinst.d/zz-flash-kernel exited with return code 1 dpkg: error processing package raspberrypi-kernel (--configure): installed raspberrypi-kernel package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: raspberrypi-kernel E: Sub-process /usr/bin/dpkg returned an error code (1)
よくわからないが、raspi-configをインストールしたときにboot loaderまわりに変更が入っているのが原因かな?わからない。 ここを見て解決 ( https://qiita.com/yukari-n/items/d1b17bd37036f120153c )
$ sudo dpkg --audit The following packages are only half configured, probably due to problems configuring them the first time. The configuration should be retried using dpkg --configure <package> or the configure menu option in dselect: raspberrypi-kernel Raspberry Pi bootloader sudo rm /var/lib/dpkg/info/raspberrypi-kernel.postinst sudo rm /var/lib/dpkg/info/raspberrypi-kernel.postrm sudo rm /var/lib/dpkg/info/raspberrypi-kernel.prerm $ sudo apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y Setting up raspberrypi-kernel (1:1.20210805-1) ...