Score:0

How to find out available plugs for a Snap

uz flag

Is there a way to find out the available plugs for a particular Snap?

I'd like to run the following command:

snap connect pciutils:<plug> :system-observe

However, how do I know what to replace "<plug>" with? Can I run a command to get a list of available plugs for pciutils or pciutils.lspci?

Score:3
ru flag

You might want to read up on how Slots and Plugs work and what they specifically mean - see the Snapcraft docs here: https://snapcraft.io/docs/interface-management#heading--slot-plugs

To quote this document, though, it defines a "plug" in line here:

An interface provides a level of access to resources, such as audio playback, as defined by a slot. One or more snaps can access this resource by connecting a corresponding plug to the slot.

In other words, the slot is the provider of the resource while the plug is the consumer, and a slot can support multiple plug connections.

So in your example, you're working with the system-observe interface, which has the corresponding plug (Snap side) and slot (snapd daemon side) there.

You can see the available connections a given snap could have with snap connections SNAPNAME and it'll list all known plugs and connections for that given snap.


Case in point my snap called rdap which is a utility to run RDAP queries has two interfaces set to it by the snap, and those are set to auto-connect the rdap snap's plug side to the snapd slot side of the interface:

$ snap connections rdap
Interface  Plug          Slot      Notes
home       rdap:home     :home     -
network    rdap:network  :network  -

(rdap only defines the home and network interface for it which is why only those two are shown)

Kris avatar
uz flag
Thanks, `snap connections pciutils` worked just great.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.