Help with the lint warnings when building a snap

Hi, I thought that building a snap app would be an interesting thing to do (and it is) but I’m stuck with the lint warnings when executing snapcraft. Indeed I took the MenuLibre source code from github and I’m trying to create a MenuLibre snap. The thing is I get this error when building the snap that I can’t get aroung :

loic@Vivobook:~/Mes Snap/menulibre$ snapcraft
Generated snap metadata                                                                                                                                                                      
Lint warnings:                                                                                                                                                                               
- library: libcolordprivate.so.2: unused library 'usr/lib/x86_64-linux-gnu/libcolordprivate.so.2.0.5'. (https://snapcraft.io/docs/linters-library)                                           
- library: libdconf.so.1: unused library 'usr/lib/x86_64-linux-gnu/libdconf.so.1.0.0'. (https://snapcraft.io/docs/linters-library)                                                           
- library: libgnome-menu-3.so.0: unused library 'usr/lib/x86_64-linux-gnu/libgnome-menu-3.so.0.0.1'. (https://snapcraft.io/docs/linters-library)                                             
- library: libgtksourceview-3.0.so.1: unused library 'usr/lib/x86_64-linux-gnu/libgtksourceview-3.0.so.1.8.0'. (https://snapcraft.io/docs/linters-library)                                   
- library: libicuio.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicuio.so.70.1'. (https://snapcraft.io/docs/linters-library)                                                           
- library: libicutest.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicutest.so.70.1'. (https://snapcraft.io/docs/linters-library)                                                       
- library: libpangoxft-1.0.so.0: unused library 'usr/lib/x86_64-linux-gnu/libpangoxft-1.0.so.0.5000.6'. (https://snapcraft.io/docs/linters-library)                                          
Command '['snap', 'pack', '--filename', 'menulibre_2.4.0_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1.         
Failed to execute pack in instance.                                                                                                                                                          
Recommended resolution: Run the same command again with --debug to shell into the environment if you wish to introspect this failure.                                                        
Full execution log: '/home/loic/.local/state/snapcraft/log/snapcraft-20240413-205332.374489.log'   

Here is my snapcraft.yaml file :

name: menulibre
base: core22 # the base snap is the execution environment for this snap
version: '2.4.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Votre éditeur de menu. # 79 char long summary
description: |
  Menu Libre est un éditeur de menu avancé qui fournit des fonctionnalités modernes au sein d'une interface propre et facile à utiliser.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
  menulibre:
    command: menulibre
    plugs:
      - x11
      - wayland
      - gsettings
      - opengl
      - network
      - network-bind
parts:
  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
      - gnome-menus
      - python3
      - python3-gi
      - python3-psutil
      - xdg-utils
    override-build: |
      python3 setup.py build

Does anybody know where this problem might come and if it’s solvable ? Thanks in advance !

Those lint warnings are simply about libraries that are in your snap package but aren’t really necessary. That’s why you see unused library in the log. The linter can also issue a warning if a missing dependency is detected, but there is no info in the log about missing libraries.

https://snapcraft.io/docs/linters-library

What is in the logfile? Did you looked at it and did you try running snapcraft with --debug as it is suggested.

1 Like

Ok thanks. Honestly there’s some more stuff in the logs but I don’t understand what it means. As to the snapcraft --debug command, I can do it but once I’m inside the snapcraft environment I don’t know what to look for or what to type to help me figure out what to do.

The snap should still be created, even if you have some linter warnings.

Can you post this log too? Or the most recent log file of it failing, if that one got deleted.

At the end, there should be more details on why the snap could not be packed.

Bonjour, voici le dernier log que j’ai.

Je pense que l’erreur est ici mais je ne comprends pas vraiment ce que ça veut dire ni comment la régler. Tu aurais une idée ?

2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 Lint warnings:
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 - library: libcolordprivate.so.2: unused library 'usr/lib/x86_64-linux-gnu/libcolordprivate.so.2.0.5'. (https://snapcraft.io/docs/linters-library)
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 - library: libdconf.so.1: unused library 'usr/lib/x86_64-linux-gnu/libdconf.so.1.0.0'. (https://snapcraft.io/docs/linters-library)
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 - library: libgnome-menu-3.so.0: unused library 'usr/lib/x86_64-linux-gnu/libgnome-menu-3.so.0.0.1'. (https://snapcraft.io/docs/linters-library)
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 - library: libgtksourceview-3.0.so.1: unused library 'usr/lib/x86_64-linux-gnu/libgtksourceview-3.0.so.1.8.0'. (https://snapcraft.io/docs/linters-library)
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 - library: libicuio.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicuio.so.70.1'. (https://snapcraft.io/docs/linters-library)
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 - library: libicutest.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicutest.so.70.1'. (https://snapcraft.io/docs/linters-library)
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 - library: libpangoxft-1.0.so.0: unused library 'usr/lib/x86_64-linux-gnu/libpangoxft-1.0.so.0.5000.6'. (https://snapcraft.io/docs/linters-library)
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 pack_snap: output=None, compression='xz'
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.418 pack_snap: check skeleton
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.426 Creating snap package...
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.427 Pack command: ['snap', 'pack', '--filename', 'menulibre_2.4.0_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.435 Command '['snap', 'pack', '--filename', 'menulibre_2.4.0_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1.
2024-04-15 19:22:43.851 :: 2024-04-15 19:22:43.435 Detailed information: 2024/04/15 19:22:43.434128 container.go:215: in snap "menulibre": path "menulibre" does not exist
2024-04-15 19:22:43.852 :: error: cannot pack "/root/prime": snap is unusable due to missing files
2024-04-15 19:22:43.852 :: 2024-04-15 19:22:43.436 Traceback (most recent call last):
2024-04-15 19:22:43.852 :: 2024-04-15 19:22:43.436   File "/snap/snapcraft/11040/lib/python3.10/site-packages/snapcraft/pack.py", line 137, in pack_snap
2024-04-15 19:22:43.852 :: 2024-04-15 19:22:43.436     proc = subprocess.run(
2024-04-15 19:22:43.852 :: 2024-04-15 19:22:43.436   File "/snap/snapcraft/11040/usr/lib/python3.10/subprocess.py", line 526, in run
2024-04-15 19:22:43.852 :: 2024-04-15 19:22:43.436     raise CalledProcessError(retcode, process.args,
2024-04-15 19:22:43.852 :: 2024-04-15 19:22:43.436 subprocess.CalledProcessError: Command '['snap', 'pack', '--filename', 'menulibre_2.4.0_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1.
2024-04-15 19:22:43.852 Executing on host: lxc --project snapcraft config device show local:snapcraft-menulibre-on-amd64-for-amd64-2170960
2024-04-15 19:22:43.918 Executing on host: lxc --project snapcraft config device remove local:snapcraft-menulibre-on-amd64-for-amd64-2170960 disk-/root/project
2024-04-15 19:22:43.967 Executing on host: lxc --project snapcraft stop local:snapcraft-menulibre-on-amd64-for-amd64-2170960
2024-04-15 19:22:48.252 Failed to execute pack in instance.
2024-04-15 19:22:48.253 Traceback (most recent call last):
2024-04-15 19:22:48.253   File "/snap/snapcraft/11040/lib/python3.10/site-packages/snapcraft/parts/lifecycle.py", line 482, in _run_in_provider
2024-04-15 19:22:48.253     instance.execute_run(cmd, check=True, cwd=output_dir)
2024-04-15 19:22:48.253   File "/snap/snapcraft/11040/lib/python3.10/site-packages/craft_providers/lxd/lxd_instance.py", line 293, in execute_run
2024-04-15 19:22:48.253     return self.lxc.exec(
2024-04-15 19:22:48.253   File "/snap/snapcraft/11040/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 387, in exec
2024-04-15 19:22:48.253     return runner(final_cmd, timeout=timeout, check=check, **kwargs)
2024-04-15 19:22:48.253   File "/snap/snapcraft/11040/usr/lib/python3.10/subprocess.py", line 526, in run
2024-04-15 19:22:48.253     raise CalledProcessError(retcode, process.args,
2024-04-15 19:22:48.253 subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-menulibre-on-amd64-for-amd64-2170960', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'snapcraft', 'pack', '--verbosity=brief', '--build-for', 'amd64']' returned non-zero exit status 1.
2024-04-15 19:22:48.253 Recommended resolution: Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
2024-04-15 19:22:48.253 Full execution log: '/home/loic/.local/state/snapcraft/log/snapcraft-20240415-192157.110353.log'

The command: menulibre is failing - probably because the menulibre executable is either missing, or in another directory, such as usr/localbin/menulibre for example.

1 Like

I created a directory in /root/prime/menulibre and the .snap file was succesfully created. Now the thing is it doesn’t seem to work, as trying to execute it gives me this error. I think that the snapcraft.yaml isn’t configured well enough for the app to run :smiling_face_with_tear:.

loic@Vivobook:~/Mes Snap/menulibre/snap$ menulibre 
cannot snap-exec: cannot exec "/snap/menulibre/x1/menulibre": permission denied