我在 Ubuntu 22.04 服务器上运行蓝牙,以便与一些传感器通信。看来之前正常工作的设置突然停止工作了。
服务报告正常:
tmikoss@home-core:~$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-02-08 09:53:52 EET; 12min ago
Docs: man:bluetoothd(8)
Main PID: 2703 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 9179)
Memory: 624.0K
CPU: 98ms
CGroup: /system.slice/bluetooth.service
└─2703 /usr/lib/bluetooth/bluetoothd
Feb 08 09:53:52 home-core systemd[1]: Starting Bluetooth service...
Feb 08 09:53:52 home-core bluetoothd[2703]: Bluetooth daemon 5.64
Feb 08 09:53:52 home-core systemd[1]: Started Bluetooth service.
Feb 08 09:53:52 home-core bluetoothd[2703]: Starting SDP server
Feb 08 09:53:52 home-core bluetoothd[2703]: Bluetooth management interface 1.21 initialized
但不再列出任何设备:
tmikoss@home-core:~$ hcitool dev
Devices:
此外,还有与以下内容相关的 apparmor denied 审计日志bluez
:
tmikoss@home-core:~$ sudo dmesg |grep -Ei 'blue|firm'
[ 2.677404] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/glk_dmc_ver1_04.bin (v1.4)
[ 7.903492] systemd[1]: Mounting Mount unit for bluez, revision 334...
[ 7.905676] systemd[1]: Mounting Mount unit for bluez, revision 347...
[ 8.599842] rtw_8821ce 0000:03:00.0: Firmware version 24.8.0, H2C version 12
[ 9.188756] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware info: version 2:0:0-b678a
[ 9.188764] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware: ABI 3:20:0 Kernel ABI 3:18:0
[ 9.237962] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware info: version 2:0:0-b678a
[ 9.237973] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware: ABI 3:20:0 Kernel ABI 3:18:0
[ 23.840569] audit: type=1400 audit(1707378786.594:61): apparmor="DENIED" operation="connect" profile="snap.bluez.obex" name="/run/dbus/system_bus_socket" pid=801 comm="obexd" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
[ 23.854125] audit: type=1400 audit(1707378786.606:62): apparmor="DENIED" operation="create" profile="snap.bluez.bluez" pid=800 comm="bluetoothd" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[ 23.900750] audit: type=1400 audit(1707378786.650:63): apparmor="DENIED" operation="connect" profile="snap.bluez.bluez" name="/run/dbus/system_bus_socket" pid=800 comm="bluetoothd" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
[ 24.126943] audit: type=1400 audit(1707378786.880:64): apparmor="DENIED" operation="create" profile="snap.bluez.bluez" pid=1196 comm="bluetoothd" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[ 24.130088] audit: type=1400 audit(1707378786.880:65): apparmor="DENIED" operation="connect" profile="snap.bluez.bluez" name="/run/dbus/system_bus_socket" pid=1196 comm="bluetoothd" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
[ 24.183565] audit: type=1400 audit(1707378786.936:66): apparmor="DENIED" operation="connect" profile="snap.bluez.obex" name="/run/dbus/system_bus_socket" pid=1197 comm="obexd" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
[ 24.507579] audit: type=1400 audit(1707378787.262:67): apparmor="DENIED" operation="connect" profile="snap.bluez.obex" name="/run/dbus/system_bus_socket" pid=1369 comm="obexd" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
[ 24.535628] audit: type=1400 audit(1707378787.290:68): apparmor="DENIED" operation="create" profile="snap.bluez.bluez" pid=1368 comm="bluetoothd" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[ 24.537006] audit: type=1400 audit(1707378787.294:69): apparmor="DENIED" operation="connect" profile="snap.bluez.bluez" name="/run/dbus/system_bus_socket" pid=1368 comm="bluetoothd" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
[ 24.918692] audit: type=1400 audit(1707378787.676:70): apparmor="DENIED" operation="create" profile="snap.bluez.bluez" pid=1429 comm="bluetoothd" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[ 32.709211] Bluetooth: Core ver 2.22
[ 32.709271] NET: Registered PF_BLUETOOTH protocol family
[ 32.709272] Bluetooth: HCI device and connection manager initialized
[ 32.709279] Bluetooth: HCI socket layer initialized
[ 32.709283] Bluetooth: L2CAP socket layer initialized
[ 32.709287] Bluetooth: SCO socket layer initialized
[ 38.971532] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 38.971540] Bluetooth: BNEP filters: protocol multicast
[ 38.971547] Bluetooth: BNEP socket layer initialized
从传感器日志来看,通信似乎在 上停止2023-12-29
。没有其他事件与此直接相关。最接近的似乎是 ,apt upgrade
随后在 上重新启动2023-12-25
,奇怪的是,这也升级了libapparmor
:
Start-Date: 2023-12-25 11:34:55
Commandline: apt upgrade
Requested-By: tmikoss (1000)
Install: ubuntu-pro-client-l10n:amd64 (30~20.04, automatic)
Upgrade: fdisk:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), python3-distro-info:amd64 (0.23ubuntu1, 0.23ubuntu1.1), netplan.io:amd64 (0.104-0ubuntu2~20.04.2, 0.104-0ubuntu2~20.04.4), cloud-init:amd64 (23.1.2-0ubuntu0~20.04.2, 23.3.3-0ubuntu0~20.04.1), update-manager-core:amd64 (1:20.04.10.11, 1:20.04.10.18), uuid-runtime:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), libfdisk1:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), iptables:amd64 (1.8.4-3ubuntu2, 1.8.4-3ubuntu2.1), python3-software-properties:amd64 (0.99.9.11, 0.99.9.12), libsystemd0:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), grub-common:amd64 (2.04-1ubuntu26.16, 2.04-1ubuntu26.17), apt:amd64 (2.0.9, 2.0.10), kpartx:amd64 (0.8.3-1ubuntu2.1, 0.8.3-1ubuntu2.3), libmount1:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), ubuntu-advantage-tools:amd64 (27.14.4~20.04, 30~20.04), libgpgme11:amd64 (1.13.1-7ubuntu2, 1.13.1-7ubuntu2.1), util-linux:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), grub2-common:amd64 (2.04-1ubuntu26.16, 2.04-1ubuntu26.17), libip6tc2:amd64 (1.8.4-3ubuntu2, 1.8.4-3ubuntu2.1), udev:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), multipath-tools:amd64 (0.8.3-1ubuntu2.1, 0.8.3-1ubuntu2.3), libapt-pkg6.0:amd64 (2.0.9, 2.0.10), libudev1:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), libapparmor1:amd64 (2.13.3-7ubuntu5.2, 2.13.3-7ubuntu5.3), systemd-timesyncd:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), mount:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), apport:amd64 (2.20.11-0ubuntu27.26, 2.20.11-0ubuntu27.27), libblkid1:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), distro-info:amd64 (0.23ubuntu1, 0.23ubuntu1.1), python3-update-manager:amd64 (1:20.04.10.11, 1:20.04.10.18), python3-apport:amd64 (2.20.11-0ubuntu27.26, 2.20.11-0ubuntu27.27), libfwupdplugin5:amd64 (1.7.9-1~20.04.1, 1.7.9-1~20.04.3), systemd-sysv:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), libuuid1:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), ufw:amd64 (0.36-6ubuntu1, 0.36-6ubuntu1.1), libpam-systemd:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), distro-info-data:amd64 (0.43ubuntu1.13, 0.43ubuntu1.14), systemd:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), libsmartcols1:amd64 (2.34-0.1ubuntu9.3, 2.34-0.1ubuntu9.4), apt-utils:amd64 (2.0.9, 2.0.10), libfwupd2:amd64 (1.7.9-1~20.04.1, 1.7.9-1~20.04.3), sosreport:amd64 (4.4-1ubuntu0.20.04.1, 4.5.6-0ubuntu1~20.04.2), libnss-systemd:amd64 (245.4-4ubuntu3.21, 245.4-4ubuntu3.22), fwupd-signed:amd64 (1.51~20.04.1+1.2-3ubuntu0.2, 1.51.1~20.04.1+1.4-0ubuntu0.1), bsdutils:amd64 (1:2.34-0.1ubuntu9.3, 1:2.34-0.1ubuntu9.4), libnetplan0:amd64 (0.104-0ubuntu2~20.04.2, 0.104-0ubuntu2~20.04.4), libxtables12:amd64 (1.8.4-3ubuntu2, 1.8.4-3ubuntu2.1), fwupd:amd64 (1.7.9-1~20.04.1, 1.7.9-1~20.04.3), rsync:amd64 (3.1.3-8ubuntu0.5, 3.1.3-8ubuntu0.7), apparmor:amd64 (2.13.3-7ubuntu5.2, 2.13.3-7ubuntu5.3), python3-debian:amd64 (0.1.36ubuntu1, 0.1.36ubuntu1.1), libip4tc2:amd64 (1.8.4-3ubuntu2, 1.8.4-3ubuntu2.1), python3-problem-report:amd64 (2.20.11-0ubuntu27.26, 2.20.11-0ubuntu27.27), tzdata:amd64 (2023c-0ubuntu0.20.04.1, 2023c-0ubuntu0.20.04.2), software-properties-common:amd64 (0.99.9.11, 0.99.9.12)
End-Date: 2023-12-25 11:36:32
编辑:
尝试禁用 apparmor 并重新启动 - 失败。注意到服务失败,
tmikoss@home-core:~$ sudo systemctl status snap.bluez.bluez.service
× snap.bluez.bluez.service - Service for snap application bluez.bluez
Loaded: loaded (/etc/systemd/system/snap.bluez.bluez.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2024-02-08 13:28:57 EET; 9min ago
Process: 4531 ExecStart=/usr/bin/snap run bluez (code=exited, status=1/FAILURE)
Main PID: 4531 (code=exited, status=1/FAILURE)
CPU: 63ms
Feb 08 13:28:57 home-core systemd[1]: snap.bluez.bluez.service: Scheduled restart job, restart counter is at 5.
Feb 08 13:28:57 home-core systemd[1]: Stopped Service for snap application bluez.bluez.
Feb 08 13:28:57 home-core systemd[1]: snap.bluez.bluez.service: Start request repeated too quickly.
Feb 08 13:28:57 home-core systemd[1]: snap.bluez.bluez.service: Failed with result 'exit-code'.
Feb 08 13:28:57 home-core systemd[1]: Failed to start Service for snap application bluez.bluez.
这让我看到了这段摘录journalctl -xe | grep blue
:
░░ A start job for unit snap.bluez.bluez.service has finished successfully.
Feb 08 13:41:15 home-core audit[748]: USER_AVC pid=748 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" name=":1.7" mask="receive" pid=1389 label="snap.bluez.bluez" peer_pid=749 peer_label="unconfined"
Feb 08 13:41:15 home-core bluetoothd[1389]: src/adapter.c:adapter_init() Failed to access management interface
Feb 08 13:41:15 home-core bluetoothd[1389]: src/main.c:main() Adapter handling initialization failed
Feb 08 13:41:15 home-core audit[748]: USER_AVC pid=748 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" name=":1.18" mask="receive" pid=1389 label="snap.bluez.bluez" peer_pid=847 peer_label="unconfined"
Feb 08 13:41:15 home-core systemd[1]: snap.bluez.bluez.service: Main process exited, code=exited, status=1/FAILURE
░░ An ExecStart= process belonging to unit snap.bluez.bluez.service has exited.
但搜索这些信息却让我一无所知。