Patch existing snap without rebuilding

I want to patch a bug in installed snap, but all files are read-only even under root. Is there any common way to do that? Download, unpack and install in try mode should be fine, but I don’t see a way to unpack it.

i typically do:

(make sure the snap isnt running while doing this)

mkdir ~/tmp
cd ~/tmp
cp /snap/foobar/current/bin/myscript.sh .
vi myscript.sh
... do your edits ...
sudo mount --bind myscript.sh /snap/foobar/current/bin/myscript.sh

(dont forget to unmount again later …)

1 Like