serial-port interface: no feedback if symlink doesn't match expected pattern

Bug #1676492 reported by Kyle Fazzari
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Fix Released
High
Paweł Stołowski

Bug Description

I have a gadget snap with the following interface:

    slots:
      kobuki:
        interface: serial-port
        path: /dev/kobuki
        usb-vendor: 0x0403
        usb-product: 0x6001

This represents the interface to the iClebo Kobuki from Yujin Robot. Its driver is configured by default to expect the device to be available at /dev/kobuki, so that's what I used for the path in the slot definition.

However, after I generated an image with this gadget and booted it, my interface was nowhere to be found. After a day, I learned by talking to people that this was due to regex used to validate the udev symlink: https://github.com/snapcore/snapd/blob/master/interfaces/builtin/serial_port.go#L58 . Indeed, once I changed the path to /dev/serial-port-kobuki, this worked as expected.

This information was not given on the interface documentation (https://github.com/snapcore/snapd/wiki/Interfaces#serial-port), but more importantly, no feedback was provided to me at any point in the process about the fact that my slot was completely invalid. This experience could probably be improved. Snapd warns when installing an app snap with invalid interfaces, is there a reason it doesn't also warn when creating an image with a gadget snap with invalid interfaces?

Kyle Fazzari (kyrofa)
description: updated
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Topic was split out to cover the independent issues properly:

https://forum.snapcraft.io/t/the-serial-port-interface-fails-silently-with-a-bad-path/93

Michael Vogt (mvo)
Changed in snapd:
status: New → Triaged
importance: Undecided → High
Changed in snapd:
assignee: nobody → Paweł Stołowski (stolowski)
status: Triaged → In Progress
Changed in snapd:
status: In Progress → Confirmed
Revision history for this message
Paweł Stołowski (stolowski) wrote :

There are two PRs that tackle both sides of the experience:
- for users: https://github.com/snapcore/snapd/pull/7740 for showing warnings on snap install if there are invalid interfaces.
- for developers: https://github.com/snapcore/snapd/pull/7320 for validating interfaces when creating snaps.

Changed in snapd:
status: Confirmed → In Progress
Revision history for this message
Paweł Stołowski (stolowski) wrote :

The first of these PRs has landed in master. 2nd still needs some tweaks.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Both PRs landed.

Changed in snapd:
status: In Progress → Fix Committed
Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.