Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth enabled, causes constant writing to disk from bluetoothd process #76540

Closed
jeff903405 opened this issue Aug 10, 2022 · 11 comments
Closed

Comments

@jeff903405
Copy link

The problem

After upgrading to 2002.8.2 and enabling bluetooth I started seeing constant disk writes from /usr/libexec/bluetooth/bluetoothd I disable bluetooth module and the disk writes stop. With bluetooth enabled I then disabled the Govee devices and the disk write still were occurring.

I am not seeing this issue with Bluetooth Low Energy Monitor.

What version of Home Assistant Core has the issue?

2022.8.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Bluetooth

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@probot-home-assistant
Copy link

bluetooth documentation
bluetooth source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (bluetooth) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@bdraco
Copy link
Member

bdraco commented Aug 15, 2022

Can you get an strace -f -s4096 -p <pid> of bluetoothd to see what its doing?

@jeff903405
Copy link
Author

strace.log
Sure here is a trace running for a few seconds... let me know if you need more...

@bdraco
Copy link
Member

bdraco commented Aug 15, 2022

It looks like its writing the cache over and over again

read(7, "\22\0\0\0*\0l\f\6\374\255\324\1\314\0\0\0\0\34\0\17\tGBK_H6144_0C6C\10\377\2\210\354\0\2\1\1\2\1\5", 512) = 48
stat64("/var/lib/bluetooth/00:1A:7D:DA:71:15/cache/D4:AD:FC:06:0C:6C", {st_mode=S_IFREG|0600, st_size=30, ...}) = 0
openat(AT_FDCWD, "/var/lib/bluetooth/00:1A:7D:DA:71:15/cache/D4:AD:FC:06:0C:6C", O_RDWR|O_CREAT, 0600) = 107
close(107)                              = 0
openat(AT_FDCWD, "/var/lib/bluetooth/00:1A:7D:DA:71:15/cache/D4:AD:FC:06:0C:6C", O_RDONLY|O_LARGEFILE) = 107
fstat64(107, {st_mode=S_IFREG|0600, st_size=30, ...}) = 0
read(107, "[General]\nName=GBK_H6144_0C6C\n", 4096) = 30
read(107, "", 4096)                     = 0
close(107)                              = 0
openat(AT_FDCWD, "/var/lib/bluetooth/00:1A:7D:DA:71:15/cache/D4:AD:FC:06:0C:6C.CJ9WQ1", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0666) = 107
fallocate(107, 0, 0, 30)                = 0
write(107, "[General]\nName=GBK_H6144_0C6C\n", 30) = 30
fstatfs64(107, 84, {f_type=EXT2_SUPER_MAGIC, f_bsize=4096, f_blocks=28945011, f_bfree=24159610, f_bavail=22683514, f_files=7364608, f_ffree=6839456, f_fsid={val=[3154062424, 1457525319]}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
lstat64("/var/lib/bluetooth/00:1A:7D:DA:71:15/cache/D4:AD:FC:06:0C:6C", {st_mode=S_IFREG|0600, st_size=30, ...}) = 0
fsync(107)                              = 0
close(107)                              = 0
rename("/var/lib/bluetooth/00:1A:7D:DA:71:15/cache/D4:AD:FC:06:0C:6C.CJ9WQ1", "/var/lib/bluetooth/00:1A:7D:DA:71:15/cache/D4:AD:FC:06:0C:6C") = 0

Seems like a bug in bluetoothd

I'd suggest opening an issue with bluez

@jeff903405
Copy link
Author

ok I will get onto the newest bluez first since I am running several version behind... Then I will re test and see if it continues...

@pvvx
Copy link

pvvx commented Nov 4, 2022

fatrace -t -f W

10:13:38.739291 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:0B:5E:ED
10:13:39.149561 bluetoothd(1152): CWO /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:19:F0:74
10:13:39.151285 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:19:F0:74.WPR6U1
10:13:39.152665 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:19:F0:74.WPR6U1
10:13:39.157835 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:19:F0:74
10:13:39.669563 bluetoothd(1152): CWO /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA
10:13:39.671082 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA.0BEHV1
10:13:39.671640 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA.0BEHV1
10:13:39.676441 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA
10:13:40.040981 bluetoothd(1152): CWO /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E
10:13:40.042466 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E.G0R2U1
10:13:40.043057 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E.G0R2U1
10:13:40.047803 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E
10:13:41.769233 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:14:50:87
10:13:41.770424 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:14:50:87.W63HV1
10:13:41.770797 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:14:50:87.W63HV1
10:13:41.775787 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:14:50:87
10:13:41.850306 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:CF:36:7A
10:13:41.851440 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:CF:36:7A.MZL8U1
10:13:41.851812 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:CF:36:7A.MZL8U1
10:13:41.856968 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:CF:36:7A
10:13:41.980399 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:13:6F:27
10:13:41.981637 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:13:6F:27.DJHBV1
10:13:41.982136 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:13:6F:27.DJHBV1
10:13:41.987209 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/58:2D:34:13:6F:27
10:13:42.479497 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:C5:B1:7B
10:13:42.481157 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:C5:B1:7B.5BI2U1
10:13:42.481775 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:C5:B1:7B.5BI2U1
10:13:42.486342 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:C5:B1:7B
10:13:42.626660 bluetoothd(1152): CWO /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:56:58:70
10:13:42.627577 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:56:58:70.4AKFV1
10:13:42.627918 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:56:58:70.4AKFV1
10:13:42.632565 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:56:58:70
10:13:43.060788 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E
10:13:43.062286 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E.ZJ32U1
10:13:43.062840 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E.ZJ32U1
10:13:43.067594 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/E7:2E:01:83:48:6E
10:13:43.110340 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/66:55:44:33:22:11
10:13:43.111821 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/66:55:44:33:22:11.XL33U1
10:13:43.112547 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/66:55:44:33:22:11.XL33U1
10:13:43.117393 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/66:55:44:33:22:11
10:13:45.210531 bluetoothd(1152): CWO /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:3C:F7
10:13:45.212048 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:3C:F7.OKK7U1
10:13:45.212923 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:3C:F7.OKK7U1
10:13:45.217418 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:3C:F7
10:13:46.049449 bluetoothd(1152): CWO /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:B3:7A:74
10:13:46.051096 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:B3:7A:74.DUA3U1
10:13:46.052034 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:B3:7A:74.DUA3U1
10:13:46.057649 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:B3:7A:74
10:13:47.179148 bluetoothd(1152): CWO /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA
10:13:47.180485 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA.DBH5U1
10:13:47.180968 bluetoothd(1152): W /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA.DBH5U1
10:13:47.186253 bluetoothd(1152): CW /var/lib/bluetooth/8C:88:2B:00:E7:EA/cache/A4:C1:38:05:F8:FA
...

@bdraco
Copy link
Member

bdraco commented Nov 4, 2022

Please open an issue with bluez. There isn’t anything Home Assistant can do about the system Bluetooth stack.

@bdraco bdraco closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2022
@pvvx
Copy link

pvvx commented Nov 4, 2022

How to disable "active scanning"?
image
If active:
image
All connected BLE devices are scanned in active mode:
image
This drains the batteries of the BLE sensors and bluetoothd overwrites the scanned device names.

@bdraco
Copy link
Member

bdraco commented Nov 4, 2022

@pvvx
Copy link

pvvx commented Nov 4, 2022

Bluez 5.65, enable 'experimental'

# bluetoothctl --version
bluetoothctl: 5.65

Home Assistant 2022.11.1

image

image
This option enables or disables writing /var/lib/bluetooth/xx:xx:xx:xx:xx:xx/cache files to disk and active BLE scanning.

When "active scanning" is disabled, "BTHome" does not work, but "Qingping" and "Xiaomi BLE" work successfully.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants