pi-bluetooth snap cannot install on UC22 beta

Bug #1970432 reported by William Wilson
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
Confirmed
Undecided
Unassigned

Bug Description

When trying to install pi-bluetooth on UC22 beta images, the btuart service fails to start with the following errors and apparmor denials:

```
Apr 25 22:08:46 ubuntu pi-bluetooth.btuart[32279]: Can't open serial port: Permission denied
Apr 25 22:08:46 ubuntu pi-bluetooth.btuart[32279]: Can't initialize device: Permission denied
Apr 25 22:08:46 ubuntu systemd[1]: snap.pi-bluetooth.btuart.service: Control process exited, code=exited, status=1/FA>
Apr 25 22:08:46 ubuntu systemd[1]: snap.pi-bluetooth.btuart.service: Failed with result 'exit-code'.
Apr 25 22:08:46 ubuntu systemd[1]: Failed to start Service for snap application pi-bluetooth.btuart.
Apr 25 22:08:46 ubuntu systemd[1]: Stopped Service for snap application pi-bluetooth.btuart.

jawn-smith@ubuntu:~$ sudo dmesg | grep ttyAMA0
[ 0.807741] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2
[ 147.269834] audit: type=1400 audit(1650925127.602:43): apparmor="DENIED" operation="open" profile="snap.pi-bluetooth.btuart" name="/dev/ttyAMA0" pid=2363 comm="hciattach" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
[ 147.628686] audit: type=1400 audit(1650925127.962:44): apparmor="DENIED" operation="open" profile="snap.pi-bluetooth.btuart" name="/dev/ttyAMA0" pid=2390 comm="hciattach" requested_mask="wr" denied_mask="wr" fsuid=0 ouid=0
```

Installing the snap with --devmode resolves these errors.

Changed in snapd:
status: New → Confirmed
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

$ snap download pi-bluetooth

$ cat pi-bluetooth_17.assert
...
type: snap-declaration
format: 1
authority-id: canonical
revision: 3
series: 16
snap-id: MllPrJmz2tNjFQk65iIsHajyVeJDam9a
plugs:
  bluetooth-control:
    allow-auto-connection: true
  hardware-observe:
    allow-auto-connection: true
  network-observe:
    allow-auto-connection: true
publisher-id: GSbfkPqUcv3x9U4u6jLGS94CU6Q9jxyi
...

But the serial-port plug that pi-bluetooth declares is not auto-connected. I created a snap removing the daemon declarations, so bt* are normal commands. I could install it, and then I connected the plugs, including the serial port with:

$ snap connect pi-bluetooth:serial-port pi:bt-serial

Then I could run successfully the commands:

$ sudo pi-bluetooth.btuart
bcm43xx_init
Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
Set Controller UART speed to 3000000 bit/s
Device setup complete
$ sudo pi-bluetooth.bthelper
hci0: Routing SCO packets to HCI

So to fix this we need to ask the store admins to add an auto-connection for the serial port to the snap declaration. Not sure how this was working in the past though.

Revision history for this message
Dave Jones (waveform) wrote :
Revision history for this message
Alex Murray (alexmurray) wrote :

I wonder if this is not auto-connecting as there is more than 1 serial-port slot and so snapd doesn't know which one to connect it to?

Although, looking at the snap declaration, there is no existing auto-connect declaration for the serial-port interface for pi-bluetooth so perhaps it is as simple as adding that? I will follow-up in the forum.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers