Snapcraft generated .desktop file does not specify the Exec field for my Gtk3 app

Hello, for the desktop file (placed under the gui folder) below:


[Desktop Entry]
Type=Application
Name=Nixwriter (Snap)
Comment=Create bootable Linux images with dd and from a GTK user interface
Terminal=false
Icon=${SNAP}/meta/gui/nixwriter.png
Exec=pkexec nixwriter
Category=Utility;

snapcraft generates the following .desktop file in /var/lib/snapd/desktop/applications/:

[Desktop Entry]
X-SnapInstanceName=nixwriter
Type=Application
Name=Nixwriter (Snap)
Comment=Create bootable Linux images with dd and from a GTK user interface
Terminal=false
Icon=/snap/nixwriter/x1/meta/gui/nixwriter.png

Which is missing the Exec field. When I try launchig the app I get notified that the Exec field missing. What should I do about this?

My yaml file:

name: nixwriter
base: core18
version: "2.0.0"
summary: Bootable Linux image writer
description: |
  Create bootable Linux images into flash drives from a simple user interface.

grade: devel 
confinement: devmode 

parts:
  nixwriter:
    source: "."
    plugin: rust
    build-packages:
      - libgtk-3-dev
  
apps:
  nixwriter:
    command: bin/nixwriter
    extensions: [gnome-3-28]
    plugs:
      - desktop
      - desktop-legacy
      - x11
      - wayland
      - home
      - udisks2
      - block-devices```

This is likely to be snapd rather than Snapcraft.

As a security measure, snapd checks to make sure that the Exec line of the desktop file matches one of the commands exported by the snap. For this particular snap, you’d need to specify Exec=nixwriter.

I see. But I need write access to block devices such as /dev/sdx for my app. What’s the preferred way to attain this root permission?

Following up on James’ comment, @pedronis would it be possible to look into making this a snap pack error? I would not go as far as installation error (even though ideal), to not break any existing installation out there.

1 Like