Request for Strict confinement to classic confinement for MqttDesk

@emitorino @alexmurray

We tried to add personal files & systems files to the snap and tried to run it locally but as attached there are 2 warnings in that we cannot use both of them. we are building the .yaml in electron.js.
Overall we are not able to add these plugs and test it locally. Even manually cannot add them. Below is the files we need access to run the app with auto connecting mode.
We found that we need classic mode to run it as it works perfectly in that mode.
We need to access to these below files but we are not successful to connect them in local too.

/etc/os-release,
/sys/devices/virtual/dmi/id/bios_vendor,
/sys/devices/virtual/dmi/id/product_serial,
/sys/devices/virtual/dmi/id/product_name,
/proc/cpuinfo,
& Personal files access for it along with the auto connect.
We request for the classic mode with the auto connect too.
Please suggest us on it.

/proc/cpuinfo can be read if your snap plugs the hardware-observe interface.

If you plug system-observe then the snap should be able to read the /etc/os-release file however note this is then located at the path /var/lib/snapd/hostfs/etc/os-release - so please update your snap to read from that path instead.

As for the /sys/devices/virtual/dmi/id/ files, the best option would be a system-files instead which specifies read permission for those 3 files and this could be named product-dmi-ids or similar.

@newbee_snap ping, could you try the alternatives suggested by @alexmurray?

Thanks

Thanks for the input.
We are trying to make it happen. Just trying until it works.
Thanks again . We will come back shortly for a review.

1 Like

@reviewers

We have tried to publish my snap through snapcraft but it shows automatically rejected and shows the errors showed in attached file. Requesting you to please suggest for the same…

it would be very helpful if you could refrain from posting screenshots of text and instead copy/paste the text so people can refer to specific lines without having to type them in manually (and painfully) off your screenshot …

this seems to be a mis-formatted plug definition in your snapcraft.yaml, could you copy/paste that part here ? normally you just have a single line for that interface like:

apps:
  foo:
    command: bar
    plugs:
      - hardware-observe

@ogra

Iam extremely sorry for doing that in hurry and thanks.

This is how we defined it in yaml.
read-proc-cpuinfo:
interface: hardware-observe
read:
- /proc/cpuinfo

yeah, that will not work, just add the hardware-observe plug to your lists of plugs for the app like i have shown above, that should be enough to get you access to /proc/cpuinfo, there is no need to specify single bits you want to access for this interface …

reading of /proc/cpuinfo is allowed as part of the interface:

(feel free to take a look at the code to see what other files it allows :slight_smile: )

EDIT: note that except for personal-files and system-files interfaces you typically do not have to add anything else but the plug name to your snapcraft.yaml … i’d recommend to take a look at the other files in the above dir (which is essentially “all known interfaces”) to get an idea about them …

@newbee_snap could you please also rename this request to remove the need of classic confinement (and add the auto-connection one?)

@ogra

Thanks for information.
We need only the proc/cpu info rather than the others.
But iam not sure how would we do that with electron-builder as we are creating it with jsonpackage.
It seems to be totally different than our previous one and we would like to read only /proc/cpuinfo. Please see the yaml file structure …

read-sys-devices-virtual-dmi-id-product-name:
interface: system-files
read:
- /sys/devices/virtual/dmi/id/product_name
read-proc-cpuinfo:
interface: hardware-observe
read:
- /proc/cpuinfo
name: mqttdesk
version: 2.1.0
title: MqttDesk
summary: MqttDesk
description: MqttDesk
architectures:

  • amd64
    apps:
    mqttdesk:
    command: command.sh
    plugs:
    • desktop
    • desktop-legacy
    • home
    • x11
    • wayland
    • unity7
    • browser-support
    • network
    • gsettings
    • audio-playback
    • pulseaudio
    • opengl
    • dot-local-share-bconf
    • read-os-release
    • read-sys-devices-virtual-dmi-id-bios-vendor
    • read-sys-devices-virtual-dmi-id-product-serial
    • read-sys-devices-virtual-dmi-id-product-name
    • read-proc-cpuinfo

well, there is no choice here … you get all of them or none :wink:

the only permitted syntax for using hardware-observe is the one i gave above … replace read-proc-cpuinfo in your plugs: section with hardware-observe and remove the read-proc-cpuinfo block at the top …

also, when pasting yaml, use three backticks ``` above and below your paste, then the indentation persists and the file stays readable …

@emitorino

I have created another topic request for the review.

Thanks

@newbee_snap there is no need to create a new topic. Just renaming this one is enough.

@emitorino
Iam not getting any link or option to rename it.

@ogra
Thanks for information.
\\
read-sys-devices-virtual-dmi-id-product-name:
interface: system-files
read:
- /sys/devices/virtual/dmi/id/product_name
hardware-observe:
interface: hardware-observe
name: mqttdesk
version: 2.1.0
title: MqttDesk
summary: MqttDesk
description: MqttDesk
architectures:

  • amd64
    apps:
    mqttdesk:
    command: command.sh
    plugs:
    • desktop
    • desktop-legacy
    • home
    • x11
    • wayland
    • unity7
    • browser-support
    • network
    • gsettings
    • audio-playback
    • pulseaudio
    • opengl
    • dot-local-share-bconf
    • read-os-release
    • read-sys-devices-virtual-dmi-id-bios-vendor
    • read-sys-devices-virtual-dmi-id-product-serial
    • read-sys-devices-virtual-dmi-id-product-name
    • hardware-observe
      \\

is it the right way to define hardware-observe?

nope, just remove everything related to it at the top and leave the one line at the bottom …

btw it is three backticks: ``` … not backslashes :slight_smile:

1 Like

@ogra

Thanks
Its done with only the PLug -hardware-observe.

2 Likes

Ok, so then let’s continue the discussion in the other post you have created (Request review for auto connections for interfaces -Personal files, System files & Hardware observe for MqttDesk snap) and let’s close this one so we are not discussing about the same request on 2 different places.

1 Like

@emitorino
Sure , Noted.
Should I mark it as solution to close it?

Feel free to do it! Thanks!