How to patch a broken snap locally? (changing base)

Currently there is a confirmed bug affecting snap users with AMD graphic cards: opening an dropdown menu would cause the entire app to freeze.

This bug does not only affect chromium snap. The spotify snap and many other snaps are affected too.

The workaround seems to be updating the snaps to use core20. So here is my question: how can I edit the spotify snap locally so that it uses core20 ? (it currently uses core18)

I don’t really have a high hope that Spotify would notice and fix the issue so I’d rather just focus on fixing it for myself.

In addition, I’d like to ask: in general, how can one edit (or fork, patch, rebuild) a snap that comes from the snap store locally for themselves?

You can download the snap, extract it to some location, change its content, repack it and then install with --dangerous switch. Note that this is not the same as building the software inside the snap, it merely repacks it with some changes you do. Once installed, the snap will not be refreshed anymore since it cannot be validated (since you have modified it locally). Clearly the approach will not scale in the long run.

In theory the snaps should list a contact field in snap info <snap> output, which you can go/send email to and report issues. Unfortunately it’s still up to the publisher to act on those reports.

For spotify:

$ snap info spotify
name:      spotify
summary:   Music for everyone
publisher: Spotify✓
store-url: https://snapcraft.io/spotify
contact:   https://community.spotify.com/t5/Desktop-Linux/bd-p/desktop_linux

Thank you for your quick response!

I’m able to repack spotify and it also launches normally. The bug is also gone.

Here are the steps that I took, for other people who might want the same thing:

  1. snap download spotify
  2. unsquashfs spotify_*.snap
  3. cd squashfs-root/
  4. Edit meta/snap.yaml to change base: core18 to base: core20
  5. cd ..
  6. snap pack ./squashfs-root
  7. snap install --dangerous spotify_1.1.84.716.gc5f8b819_amd64.snap (no need to remove existing spotify snap, the new one will install alright and inherits user data from the existing snap.)

References: