Hi, I need to expose /usr/share/applications and /usr/share/icons to a snap I’m building. I added the correct system-files
interface, but nothing is exposed to the snap and I really don’t understand why.
Here is the snapcraft.yaml :
name: menulibre
base: core24 # the base snap is the execution environment for this snap
version: '1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: MenuLibre is an advanced FreeDesktop.org compliant menu editor.
description: |
MenuLibre is an advanced menu editor with modern features in a clean, easy-to-use interface. It lets you :
--> Create new launchers or modify existing ones with complete control and access to hidden settings
--> Add and adjust desktop actions: shortcuts to advanced application features
--> Easily rearrange the menu to suit your tastes
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
layout:
/usr/share/lib/X11:
symlink: $SNAP/usr/share/lib/X11
/usr/lib/x86_64-linux-gnu/libgtk-3-0:
bind: $SNAP/usr/lib/x86_64-linux-gnu/libgtk-3-0t64
plugs:
applications:
interface: personal-files
read: [$HOME/.local/share/applications]
icons:
interface: personal-files
read: [$HOME/.local/share/icons]
system-applications:
interface: system-files
read: [/usr/share/applications]
system-icons:
interface: system-files
read: [/usr/share/icons]
#path:
# interface: system-files
# read: [/usr/bin]
apps:
menulibre:
environment:
PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
GI_TYPELIB_PATH: $SNAP/usr/lib/x86_64-linux-gnu/girepository-1.0
GTK_IM_MODULE_FILE: /usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0
#PATH: /var/lib/snapd/hostfs/usr/bin:$PATH
XDG_DATA_DIRS: /home/$USER/.local/share:$XDG_DATA_DIRS
command: bin/menulibre
command-chain: [bin/desktop-launch]
plugs:
- home
- x11
- wayland
- applications
- icons
- system-applications
- system-icons
#hooks:
# configure:
# plugs:
# - applications
# - icons
# - system-applications
# - system-icons
parts:
desktop-gtk3:
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: gtk
plugin: make
make-parameters: ["FLAVOR=gtk3"]
build-packages:
- build-essential
- libgtk-3-dev
stage-packages:
- libxkbcommon0
- fonts-ubuntu
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-extra
- shared-mime-info
- libgtk-3-0
- libgdk-pixbuf2.0-0
- libglib2.0-bin
- libgtk-3-bin
- unity-gtk3-module
- libappindicator3-1
- locales-all
- xdg-user-dirs
- ibus-gtk3
- libibus-1.0-5
- fcitx-frontend-gtk3
- xkb-data
menulibre:
plugin: python
source: https://github.com/bluesabre/menulibre.git
build-packages:
- gir1.2-gtk-3.0
- intltool
- libgnome-menu-3-dev
- python-gi-dev
- python3
- python3-distutils-extra
- python3-psutil
stage-packages:
- gir1.2-gdkpixbuf-2.0
- gir1.2-glib-2.0
- gir1.2-gmenu-3.0
- gir1.2-gtk-3.0
- gir1.2-gtksource-3.0
- gobject-introspection
- gnome-menus
- python3
- python3-gi
- python3-psutil
- xdg-utils
override-build: |
python3 setup.py build
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp -r /root/parts/menulibre/build/bin/* $SNAPCRAFT_PART_INSTALL/bin/
cp -r /root/parts/menulibre/build/* $SNAPCRAFT_PART_INSTALL/
And here is the ls
output for said directories, from within the snap compared to the host’s output:
loic@Ubuntu:/home/loic/Documents/Snapcraft/menulibre$ ls /usr/share/applications
mimeapps.list python3.12.desktop vim.desktop xdg-open.desktop
loic@Ubuntu:/home/loic/Documents/Snapcraft/menulibre$ ls /var/lib/snapd/hostfs/usr/share/applications
ls: cannot open directory '/var/lib/snapd/hostfs/usr/share/applications': Permission denied
loic@Ubuntu:/home/loic/Documents/Snapcraft/menulibre$ ls /usr/share/icons
hicolor locolor
loic@Ubuntu:/home/loic/Documents/Snapcraft/menulibre$ ls /var/lib/snapd/hostfs/usr/share/icons
ls: cannot open directory '/var/lib/snapd/hostfs/usr/share/icons': Permission denied
loic@Ubuntu:/home/loic/Documents/Snapcraft/menulibre$
exit
loic@Ubuntu:~/Documents/Snapcraft/menulibre$ ls /usr/share/icons
Adwaita handhelds LoginIcons Yaru-blue Yaru-olive-dark Yaru-red-dark Yaru-yellow-dark
default hicolor redglass Yaru-blue-dark Yaru-prussiangreen Yaru-sage
DMZ-Black HighContrast ubuntu-mono-dark Yaru-dark Yaru-prussiangreen-dark Yaru-sage-dark
DMZ-White Humanity ubuntu-mono-light Yaru-magenta Yaru-purple Yaru-wartybrown
gnome-logo-text-dark.svg Humanity-Dark whiteglass Yaru-magenta-dark Yaru-purple-dark Yaru-wartybrown-dark
gnome-logo-text.svg locolor Yaru Yaru-olive Yaru-red Yaru-yellow
loic@Ubuntu:~/Documents/Snapcraft/menulibre$ ls /usr/share/applications
apport-gtk.desktop mimeinfo.cache
bluetooth-sendto.desktop nautilus-autorun-software.desktop
chromium-browser.desktop nm-applet.desktop
cxassoc-cxoffice-0:application_x-crossover-cxarchive::restore.desktop nm-connection-editor.desktop
cxassoc-cxoffice-0:application_x-crossover-exe::install.desktop nvidia-settings.desktop
cxassoc-cxoffice-0:application_x-crossover-exe::run.desktop org.freedesktop.IBus.Panel.Emojier.desktop
cxassoc-cxoffice-0:application_x-crossover-lnk::run.desktop org.freedesktop.IBus.Panel.Extension.Gtk3.desktop
cxassoc-cxoffice-0:application_x-crossover-msi::install.desktop org.freedesktop.IBus.Panel.Wayland.Gtk3.desktop
cxassoc-cxoffice-1:application_x-crossover-c4p::install.desktop org.freedesktop.IBus.Setup.desktop
cxassoc-cxoffice-1:application_x-crossover-tie::install.desktop org.freedesktop.Xwayland.desktop
cxmenu-cxoffice-0-29ra4ke-CrossOver.desktop org.gnome.baobab.desktop
defaults.list org.gnome.Calculator.desktop
display-im6.q16.desktop org.gnome.Calendar.desktop
gcr-prompter.desktop org.gnome.Characters.desktop
gcr-viewer.desktop org.gnome.clocks.desktop
geoclue-demo-agent.desktop org.gnome.DejaDup.desktop
gnome-about-panel.desktop org.gnome.DiskUtility.desktop
gnome-applications-panel.desktop org.gnome.eog.desktop
gnome-background-panel.desktop org.gnome.Evince.desktop
gnome-bluetooth-panel.desktop org.gnome.Evince-previewer.desktop
gnome-color-panel.desktop org.gnome.Evolution-alarm-notify.desktop
gnome-datetime-panel.desktop org.gnome.evolution-data-server.OAuth2-handler.desktop
gnome-disk-image-mounter.desktop org.gnome.FileRoller.desktop
gnome-disk-image-writer.desktop org.gnome.font-viewer.desktop
gnome-display-panel.desktop org.gnome.Logs.desktop
gnome-initial-setup.desktop org.gnome.Nautilus.desktop
gnome-keyboard-panel.desktop org.gnome.OnlineAccounts.OAuth2.desktop
gnome-language-selector.desktop org.gnome.PowerStats.desktop
gnome-mimeapps.list org.gnome.RemoteDesktop.Handover.desktop
gnome-mouse-panel.desktop org.gnome.seahorse.Application.desktop
gnome-multitasking-panel.desktop org.gnome.Settings.desktop
gnome-network-panel.desktop org.gnome.Shell.desktop
gnome-notifications-panel.desktop org.gnome.Shell.Extensions.desktop
gnome-online-accounts-panel.desktop org.gnome.Software.desktop
gnome-power-panel.desktop org.gnome.Sysprof.desktop
gnome-printers-panel.desktop org.gnome.SystemMonitor.desktop
gnome-privacy-panel.desktop org.gnome.Tecla.desktop
gnome-region-panel.desktop org.gnome.Terminal.desktop
gnome-search-panel.desktop org.gnome.Terminal.Preferences.desktop
gnome-session-properties.desktop org.gnome.TextEditor.desktop
gnome-sharing-panel.desktop org.gnome.Totem.desktop
gnome-software-local-file-flatpak.desktop org.gnome.Weather.desktop
gnome-software-local-file-packagekit.desktop org.gnome.Zenity.desktop
gnome-software-local-file-snap.desktop python3.12.desktop
gnome-sound-panel.desktop rygel.desktop
gnome-system-monitor-kde.desktop snap-handle-link.desktop
gnome-system-panel.desktop software-properties-drivers.desktop
gnome-ubuntu-panel.desktop software-properties-gtk.desktop
gnome-universal-access-panel.desktop software-properties-livepatch.desktop
gnome-users-panel.desktop steam.desktop
gnome-wacom-panel.desktop thunderbird.desktop
gnome-wifi-panel.desktop update-manager.desktop
gnome-wwan-panel.desktop vim.desktop
hplj1020.desktop vlc-plugin-bittorrent.desktop
ibus-setup-table.desktop webtorrent-desktop.desktop
im-config.desktop xdg-desktop-portal-gnome.desktop
info.desktop xdg-desktop-portal-gtk.desktop
io.snapcraft.SessionAgent.desktop yelp.desktop
menulibre.desktop
Here is the connections details for the app. As you can see, the correct plugs are connected :
loic@Ubuntu:~/Documents/Snapcraft/menulibre$ snap connections menulibre
Interface Connecteur Prise Notes
desktop menulibre:desktop :desktop -
desktop-legacy menulibre:desktop-legacy :desktop-legacy -
home menulibre:home :home -
personal-files menulibre:applications :personal-files manual
personal-files menulibre:icons :personal-files manual
system-files menulibre:system-applications :system-files manual
system-files menulibre:system-icons :system-files manual
wayland menulibre:wayland :wayland -
x11 menulibre:x11 :x11 -
I really don’t understand why it is not working. The documentation doesn’t seem to indicate that anything else is to be done apart from creating the plugs and connecting them, which I did. Other snaps that use these interfaces don’t seem to have a snapcraft any different from mine when looking at the system-files interface. I tried read and write and both for the interface.
Are there some directories that the system-files
interface simply won’t expose ? Why does it not work as is ?
If anyone has an idea, I’ll take it !
Thanks in advance.