Core22 gnome extension and broken symlinks

Hello! I think the core22 gnome extension is maybe creating broken python symlinks (to /snap/gnome-42-2204-sdk/48/usr/bin/python3.10) causing a review-tools linter to fail:

Errors
------
 - lint-snap-v2:external_symlinks
        package contains external symlinks: bin/python -> python3, bin/python3 -> /snap/gnome-42-2204-sdk/48/usr/bin/python3.10, bin/python3.10 -> python3
cameractrls_0.4.11-0-gee26867_amd64.snap: FAIL

I can manually remove those symlinks and everything will work.

Contents of squashfs-root/usr/bin:

lrwxrwxrwx 1 graham graham    7 Nov 29 09:11 python -> python3
lrwxrwxrwx 1 graham graham   45 Nov 29 09:11 python3 -> /snap/gnome-42-2204-sdk/48/usr/bin/python3.10
lrwxrwxrwx 1 graham graham    7 Nov 29 09:11 python3.10 -> python3

Snapcraft, gnome-42-2204 and core 22 all from edge:

$ snapcraft --version
snapcraft 7.2.9.post29+git0f49a754

$ snap list | grep 'core22\|gnome-42'
core22          20221129         444    latest/edge   canonical**          base
gnome-42-2204   0+git.c271a86    46     latest/edge   canonical**          -

snapcraft.yaml for the snap:

1 Like

Thanks, @tigarmo has been working to solve all the Python related papercuts. This might be addressed soon.

2 Likes

I thought it was interesting that things still work if you remove the symlinks, but it looks like the Python code has no (Python) dependencies other than the standard library (so the broken virtual-env isn’t an issue).

1 Like

Hello, does the work include improving interoperability between the python plugin and the gnome extension? I’ve recently tried to update a snap from core20+python plugin+gnome-3-38 extension to core22 and gave up due the problem reported in this post, but I suspect I’d run into other issues, since the gnome extension sets PYTHONPATH. Thank you.

Hi, I am encountering the same issue with symlinks breaking my python app when using core22 + python plugin + gnome extension.

I’m also open to trying out any workarounds such as I can manually remove those symlinks and everything will work. Would something like that be best placed in an override-stage or override-prime section?

Thanks!

I had hoped the issue would be fixed so I’ve not writen a solution into the snapcraft.yaml. To do this manually:

  1. unsquashfs <snapname>
  2. rm squashfs-root/bin/python*
  3. snap pack squashfs-root

The resultant snap won’t have the symlinks and can be safely uploaded to the store.

1 Like

Any update or roadmap to fix this issue for Core22 gnome extension ?

This is currently being worked on. We’re evaluating a few different ways to address the issue, but a fix should be available soon.

3 Likes

Could you please point me to a PR or files/repo so I can follow progress? I’d like to try my upgrade from core20+gnome+python -> core22+gnome+python once I know the fix is released. Thank you.

The fix involves changes in Craft-parts and Snapcraft. The Craft-parts change has already landed and we’re now working on the Snapcraft side (no PR yet).

Using this version, let us know ow test the fixes

➜ snapcraft --version
snapcraft 7.2.9

➜ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Given a try to snapcraft 7.3

Update

➜ sudo snap refresh
➜ snap refresh --candidate snapcraft
➜ snapcraft --version
snapcraft 7.3

Hi there, the fix will most likely be in 7.3.1.

I confirm and share the " Automatically rejected" revision tested with snapcraft 7.3

Revision #21

Recently I tried to make two libadwaita based apps, but both gave me this kind of error.

Failed to load shared library 'libpango-1.0.so.0' referenced by the typelib: /snap/metadata-cleaner/x2/gnome-platform/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: hb_ot_layout_get_horizontal_baseline_tag_for_script

The snapcraft.yaml for this is

snapcraft.yaml
name: metadata-cleaner # you probably want to 'snapcraft register <name>'
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: View and clean metadata in files # 79 char long summary
description: |
  Metadata within a file can tell a lot about you. Cameras record data about when and where a picture was taken and which camera was used. Office applications automatically add author and company information to documents and spreadsheets. This is sensitive information and you may not want to disclose it. This tool allows you to view metadata in your files and to get rid of it, as much as possible.
license: GPL-3.0+
architectures:
  - build-on: amd64

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
compression: lzo

layout:
  /usr/lib:
    bind: $SNAP/usr/lib
  /usr/share/locale:
    bind: $SNAP/usr/share/locale
  /usr/share/metadata-cleaner:
    bind: $SNAP/usr/share/metadata-cleaner

environment:
  # WORKAROUND: Add python modules in Snap to search path
  PYTHONPATH: ${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages

parts:
  mutagen:
    after: [ffmpeg]
    plugin: python
    source: https://github.com/quodlibet/mutagen.git
    source-tag: release-1.46.0
    source-type: git
    python-packages:
      - mat2
      - importlib-metadata
      - importlib-resources
      - PyGObject
    build-packages:
      - gir1.2-poppler-0.18
      - gir1.2-gdkpixbuf-2.0
      - libimage-exiftool-perl
    stage-packages:
      - libimage-exiftool-perl
      - gir1.2-gdkpixbuf-2.0
      - gir1.2-poppler-0.18
  ffmpeg:
    # WORKAROUND:
    # Build from source because the ffmpeg package installs libraries as dependencies
    # that conflict with the Gnome extension
    plugin: autotools
    source: https://ffmpeg.org/releases/ffmpeg-5.1.2.tar.xz
    source-checksum: sha256/619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc
    autotools-configure-parameters:
      # WORKAROUND: Install to /usr instead of /usr/local because it's not in search paths
      - --prefix=/usr
      - --disable-debug
      - --disable-doc
      - --disable-static
      - --enable-gpl
      - --enable-shared
      - --disable-ffplay
      - --disable-devices
      - --enable-gnutls
      - --enable-libmp3lame
      - --enable-libvorbis
    build-packages:
      - nasm
      - libgnutls28-dev
      - libmp3lame-dev
      - libvorbis-dev
    stage-packages:
      - libmp3lame0
    stage:
      - -usr/include
  metadata-cleaner:
    # See 'snapcraft plugins'
    plugin: meson
    after:
      - ffmpeg
    source: https://gitlab.com/rmnvgr/metadata-cleaner.git
    source-tag: v${SNAPCRAFT_PROJECT_VERSION}
    meson-parameters:
      - --prefix=/usr
    build-environment:
         # WORKAROUND: The python plugin is broken with gnome extension
         - PATH: ${CRAFT_PART_INSTALL}/bin:${PATH}
         - PYTHONPATH: ""
    stage-packages:
      - perl
      - libpoppler118
      - libpoppler-glib8
      - libpng-tools
      - python3-gi-cairo
      - gir1.2-poppler-0.18
      - gir1.2-gdkpixbuf-2.0
      - gir1.2-rsvg-2.0
      - libimage-exiftool-perl
    override-pull: |
      craftctl default
      sed -e 's|Icon=fr.romainvigier.MetadataCleaner|Icon=usr/share/icons/hicolor/scalable/apps/fr.romainvigier.MetadataCleaner.svg|g' -i application/data/fr.romainvigier.MetadataCleaner.desktop.in
    override-stage: |
      craftctl default
      #sed -e 's|/usr/share/locale|/snap/metadata-cleaner/current/usr/share/locale|g' -i $SNAPCRAFT_STAGE/usr/bin/metadata-cleaner
      #sed -e 's|/usr/share/metadata-cleaner/data|/snap/metadata-cleaner/current/usr/share/metadata-cleaner/data|g' -i $SNAPCRAFT_STAGE/usr/bin/metadata-cleaner
      #sed -e 's|/usr/share/metadata-cleaner/src|/snap/metadata-cleaner/current/usr/share/metadata-cleaner/src|g' -i $SNAPCRAFT_STAGE/usr/bin/metadata-cleaner
      #mkdir -p gnome-platform/usr/lib/x86_64-linux-gnu/
      #ln -sf /snap/metadata-cleaner/current/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0.5000.6 $CRAFT_PART_INSTALL/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
  cleanup:
    after:  # Make this part run last; list all your other parts here
      - metadata-cleaner
      - ffmpeg
    plugin: nil
    build-snaps:  # List all content-snaps and base snaps you're using here
      - gnome-42-2204
      - gnome-42-2204-sdk
      - core22
    override-prime: |
      set -eux
      for snap in "core22" "gnome-42-2204" "gnome-42-2204-sdk"; do  # List all content-snaps and base snaps you're using here
        cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
      done
apps:
  metadata-cleaner:
    command: usr/bin/metadata-cleaner
    desktop: usr/share/applications/fr.romainvigier.MetadataCleaner.desktop
    extensions: [gnome]
    plugs:
      - home
    common-id: fr.romainvigier.MetadataCleaner
```

And this error I got in another one;

/snap/audio-sharing/x2/usr/bin/audio-sharing: symbol lookup error: /snap/audio-sharing/x2/gnome-platform/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: hb_ot_layout_get_horizontal_baseline_tag_for_script

The snapcraft.yaml file is

snapcraft.yaml

name: audio-sharing # you probably want to 'snapcraft register ’ base: core22 # the base snap is the execution environment for this snap version: ‘0.2.1’ # just for humans, typically ‘1.2+git’ or ‘1.3.2’ summary: Single-line elevator pitch for your amazing snap # 79 char long summary description: | This is my-snap’s description. You have a paragraph or two to tell the most important story about your snap. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the snap store. grade: devel # must be ‘stable’ to release into candidate/stable channels confinement: strict # use ‘strict’ once you have the right plugs and slots

slots: dbus-svc: interface: dbus bus: session name: de.haeckerfelix.AudioSharing

parts: rust: plugin: nil build-snaps: - rustup override-build: | rustup install stable audio-sharing: # See ‘snapcraft plugins’ after: [rust] plugin: meson source: https://gitlab.gnome.org/World/AudioSharing.git source-type: git source-tag: 0.2.1 meson-parameters: - --prefix=/usr build-packages: - libelf-dev - elfutils - libgstreamer1.0-dev stage-packages: - libgstreamer1.0-0 - libgstrtspserver-1.0-dev - libfreetype-dev - elfutils - libelf1 - libwebpmux3 override-prime: | craftctl default sed -e ‘s|Icon=de.haeckerfelix.AudioSharing|Icon=/usr/share/icons/hicolor/scalable/apps/de.haeckerfelix.AudioSharing|’ -i usr/share/applications/de.haeckerfelix.AudioSharing.desktop cleanup: after: # Make this part run last; list all your other parts here - audio-sharing - rust plugin: nil build-snaps: # List all content-snaps and base snaps you’re using here - gnome-42-2204 - gnome-42-2204-sdk - core22 override-prime: | set -eux for snap in “gnome-42-2204” “gnome-42-2204-sdk” “core22”; do cd “/snap/$snap/current” && find . -type f,l -exec rm -f “$SNAPCRAFT_PRIME/{}” ; done find $CRAFT_PRIME/usr/share/doc/ -type f -not -name ‘copyright’ -delete apps: audio-sharing: command: usr/bin/audio-sharing desktop: usr/share/applications/de.haeckerfelix.AudioSharing.desktop common-id: de.haeckerfelix.AudioSharing extensions: [gnome] plugs: - home - network - network-bind - mount-observe - network-manager slots: - dbus-svc

Are these errors for the same reason

Share my notes using snapcraft: Convenient ways to fix-up the missing library stage-packages prompt

We have a Snapcraft PR with the symlink fixes. With 45 files changed it’s not really trivial, so please test it when it lands on the edge channel.

1 Like

Tested snapcraft edge version with yt-dlg

➜ sudo snap refresh
➜ snapcraft --version
snapcraft 7.3
➜ sudo snap refresh --edge snapcraft
➜ snapcraft --version
snapcraft 7.3.post2+git11aaab5b
➜  snapcraft clean
➜ snapcraft --debug
➜ snapcraft upload --release=edge yt-dlg_1.8.5-0-g1c7dbf0_amd64.snap
Issues while processing snap:g
- package contains external symlinks: bin/python -> python3, bin/python3 -> /snap/gnome-42-2204-sdk/67/usr/bin/python3.10, bin/python3.10 -> python3
Full execution log: '/home/user/.local/state/snapcraft/log/snapcraft-20230228-092116.991674.log'

Keep getting external symlinks issue

That’s because the PR didn’t land yet, but it should work after it’s integrated and the new version is released to edge.

1 Like

This version work OK!

➜ sudo snap refresh
➜ snapcraft --version
snapcraft 7.3.1.post17+git8b3ed19b
➜ snapcraft clean
➜ snapcraft --debug
➜ snapcraft upload --release=edge yt-dlg_1.8.5-0-g1c7dbf0_amd64.snap
Revision 30 created for 'yt-dlg' and released to 'edge'
1 Like