I am experimenting with snap to execute bash commands and not able to get my head around why this doesn’t work.
Problem
The app is not able to execute xprop
bash command.
I installed the package using sudo snap install mysnap1.0.0-beta.snap --dangerous --devmode
and tested by running it from the command line - $ mysnap
, I see following error in my app’s logs
xprop not found
Debugging info
I have following debugging info but not able to judge where is the mistake
Here’s my snap.yaml
as seen in /snap/<application>/current/meta
name: mysnap
version: 1.0.0-beta
summary: My Snap App
description: My little snap app
apps:
mysnap:
command: command.sh
plugs:
- desktop
- desktop-legacy
- home
- x11
- wayland
- unity7
- browser-support
- network
- gsettings
- audio-playback
- pulseaudio
- opengl
autostart: mysnap.desktop
environment:
DISABLE_WAYLAND: '1'
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
SNAP_DESKTOP_RUNTIME: $SNAP/gnome-platform
LD_LIBRARY_PATH: $SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu
architectures:
- amd64
base: core18
confinement: devmode
grade: stable
plugs:
gnome-3-28-1804:
interface: content
target: $SNAP/gnome-platform
default-provider: gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes
title: My Snap
The snappy-debug shows this on sudo snappy-debug
INFO: Following '/var/log/syslog'. If have dropped messages, use:
INFO: $ sudo journalctl --output=short --follow --all | sudo snappy-debug
kernel.printk_ratelimit = 0
= AppArmor =
Time: Apr 09 12:33:49
Log: apparmor="ALLOWED" operation="dbus_signal" bus="session" path="/StatusNotifierItem" interface="org.freedesktop.DBus.Properties" member="PropertiesChanged" mask="send" name="org.freedesktop.DBus" pid=14146 label="snap.mysnap.mysnap" peer_pid=2256 peer_label="unconfined"
DBus access
And snap logs mysnap
shows this
error: snap "mysnap" has no services
Note: The app works fine without any crashes otherwise. The only issue is with the bash command, that does not get executed.
ogra
April 11, 2023, 10:50am
2
your snap.yaml is just the result of processing the snapcraft.yaml file and is lacking all relevant information that could help here …
we’d need to see the original snapcraft.yaml that was used to produce the snap …
I used electron-builder to package this. I am not sure if this is right file you are looking for but I did see this snapcraft.yaml
file in a temporary folder created during the build process
base: core18
grade: stable
confinement: devmode
parts:
launch-scripts:
plugin: dump
source: scripts
gnome-platform-empty-dirs:
plugin: nil
override-build: |
mkdir -p "$SNAPCRAFT_PART_INSTALL/data-dir/themes" mkdir -p "$SNAPCRAFT_PART_INSTALL/data-dir/icons" mkdir -p "$SNAPCRAFT_PART_INSTALL/data-dir/sounds" mkdir $SNAPCRAFT_PART_INSTALL/gnome-platform
app-files:
plugin: dump
source: app
organize:
'*': app/
stage:
- '-app/chrome-sandbox'
- '-LICENSES.chromium.html'
app:
plugin: nil
stage:
- '-usr/lib/python*'
- '-usr/bin/python*'
- '-var/lib/ucf'
- '-usr/include'
- '-usr/lib/X11'
- '-usr/share'
- '-usr/sbin'
- '-usr/bin'
- '-usr/lib/*/libicudata.*'
- '-usr/lib/*/libicui18n.*'
- '-usr/lib/*/libgtk-*'
- '-usr/lib/*/libgdk-*'
- '-usr/lib/*/glib-*'
- '-usr/lib/*/gtk-*'
- '-usr/lib/*/gdk-*'
- '-usr/lib/*/krb5'
- '-usr/lib/systemd'
- '-usr/lib/glib-networking'
- '-usr/lib/dconf'
- '-usr/lib/*/avahi'
- '-usr/lib/*/gio'
- '-usr/lib/*/libatk*'
- '-usr/lib/*/libatspi*'
- '-usr/lib/*/libavahi*'
- '-usr/lib/*/libcairo*'
- '-usr/lib/*/libcolordprivate*'
- '-usr/lib/*/libcolord*'
- '-usr/lib/*/libcroco*'
- '-usr/lib/*/libcups*'
- '-usr/lib/*/libdatrie*'
- '-usr/lib/*/libdconf*'
- '-usr/lib/*/libepoxy*'
- '-usr/lib/*/libexpatw*'
- '-usr/lib/*/libffi*'
- '-usr/lib/*/libfontconfig*'
- '-usr/lib/*/libfreetype*'
- '-usr/lib/*/libgdk_pixbuf*'
- '-usr/lib/*/libgdk_pixbuf_xlib*'
- '-usr/lib/*/libgio*'
- '-usr/lib/*/libglib*'
- '-usr/lib/*/libgmodule*'
- '-usr/lib/*/libgmp*'
- '-usr/lib/*/libgnutls*'
- '-usr/lib/*/libgobject*'
- '-usr/lib/*/libgraphite2*'
- '-usr/lib/*/libgssapi_krb5*'
- '-usr/lib/*/libgthread*'
- '-usr/lib/*/libharfbuzz*'
- '-usr/lib/*/libhogweed*'
- '-usr/lib/*/libicuio*'
- '-usr/lib/*/libicutest*'
- '-usr/lib/*/libicutu*'
- '-usr/lib/*/libicuuc*'
- '-usr/lib/*/libidn2*'
- '-usr/lib/*/libjbig*'
- '-usr/lib/*/libjpeg*'
- '-usr/lib/*/libjson*'
- '-usr/lib/*/libk5crypto*'
- '-usr/lib/*/libkrb5*'
- '-usr/lib/*/libkrb5support*'
- '-usr/lib/*/liblcms2*'
- '-usr/lib/*/libnettle*'
- '-usr/lib/*/libp11*'
- '-usr/lib/*/libpango*'
- '-usr/lib/*/libpangocairo*'
- '-usr/lib/*/libpangoft2*'
- '-usr/lib/*/libpixman*'
- '-usr/lib/*/libpng16*'
- '-usr/lib/*/libproxy*'
- '-usr/lib/*/librest*'
- '-usr/lib/*/librsvg*'
- '-usr/lib/*/libsecret*'
- '-usr/lib/*/libsoup*'
- '-usr/lib/*/libsqlite3*'
- '-usr/lib/*/libtasn1*'
- '-usr/lib/*/libthai*'
- '-usr/lib/*/libtiff*'
- '-usr/lib/*/libunistring*'
- '-usr/lib/*/libwayland*'
- '-usr/lib/*/libX11*'
- '-usr/lib/*/libXau*'
- '-usr/lib/*/libxcb.so*'
- '-usr/lib/*/libxcb-dri2*'
- '-usr/lib/*/libxcb-dri3*'
- '-usr/lib/*/libxcb-glx*'
- '-usr/lib/*/libxcb-present*'
- '-usr/lib/*/libxcb-render*'
- '-usr/lib/*/libxcb-shm*'
- '-usr/lib/*/libxcb-sync*'
- '-usr/lib/*/libxcb-xfixes*'
- '-usr/lib/*/libXcomposite*'
- '-usr/lib/*/libXcursor*'
- '-usr/lib/*/libXdamage*'
- '-usr/lib/*/libXdmcp*'
- '-usr/lib/*/libXext*'
- '-usr/lib/*/libXfixes*'
- '-usr/lib/*/libXinerama*'
- '-usr/lib/*/libXi*'
- '-usr/lib/*/libxkbcommon*'
- '-usr/lib/*/libxml2*'
- '-usr/lib/*/libXrandr*'
- '-usr/lib/*/libXrender*'
stage-packages:
- x11-utils
- libnspr4
- libnss3
- libxss1
- libappindicator3-1
- libsecret-1-0
plugs:
gnome-3-28-1804:
interface: content
target: $SNAP/gnome-platform
default-provider: gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes
name: mysnap
version: 1.0.0-beta
title: My Snap
summary: My snap app
description: My little snap app
architectures:
- amd64
apps:
mysnap:
command: command.sh
plugs:
- desktop
- desktop-legacy
- home
- x11
- wayland
- unity7
- browser-support
- network
- gsettings
- audio-playback
- pulseaudio
- opengl
adapter: none
autostart: mysnap.desktop
environment:
DISABLE_WAYLAND: '1'
PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
SNAP_DESKTOP_RUNTIME: $SNAP/gnome-platform
LD_LIBRARY_PATH: $SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu
icon: snap/gui/icon.png
ogra
April 11, 2023, 12:37pm
4
well, whatever electron-builder generates here, it seems to wipe everything from usr/bin and usr/sbin …
I see. So is this a bug in electron-builder or this could be an issue with the snap/multipass tooling? How do we go about fixing this?
ogra
April 11, 2023, 12:44pm
6
no idea, i have never used electron-builder (only electron-packager invoked from inside a snapcraft.yaml that i maintain myself) i’d check the snap content first, just use unsquashfs to extract it and take a look inside if xprop is really missing, if usr/bin or sbin are missing etc … if that’s the case i’d file an issue against electron-builder then
I unpacked the snap unsquashfs
, here’s the outcome
The /meta/snap.yaml is the same as we saw earlier at /snap/<application>/current/meta
(the first message on this thread)
The usr
folder has only lib
folder. No other folders such as bin
or sbin
ogra
April 11, 2023, 3:22pm
8
right, so you should open an electron-builder issue and ask why their generated snapcraft.yaml essentially removes all content of the stage-packages
in the same part it seeds them … (this is really strange behavior and essentially makes the whole part a no-op)
ogra
April 11, 2023, 3:32pm
10
ah, seems like a well known bug (it even has a link to the function doing it) …
perhaps you should consider going the electron-packager route ?
here is an example snap where i use electron-packager (it reads package.json, processes it and creates a binary blob that you can then just use inside the snap)
Thank you. I packaged using npx electron-packager app
and got the my app-linux-x64
folder. But how do we get it packaged as a snap?