When debugging issues with MAAS, we often find ourselves modifying the source code of a running deployment. This is to add more debugging logging, since we can’t anticipate everything that we need log.
When MAAS in installed as a deb packages, it’s easy. Modify the code in place and restart MAAS.
When MAAS is installed as a snap it gets a bit trickier, since obviously you can’t simply modify the source code that’s in /snap/maas/current/.
It would would be nice if there was a way of telling snapd to make the snap writable temporarily. Then when you’re done debugging, you can tell snapd to make it read-only again, reverting back the code to the previous state.
I currently do this:
sudo unsquashfs -d mutable-dir /var/lib/snapd/snaps/maas_5229.snap
sudo snap try mutable-dir
- <make changes, debug, etc.>
sudo snap refresh maas channel=2.7/edge --amend
It works, but I think the experience could be better. It has the following problems:
- There’s no guarantee that the
maas_5229.snapactually is the snap that is currently running
- If someone else looks as
snap list, there’s no indication of what’s going on, except that the revision is
- When switching back to the pristine code and make it read-only again, you have to make sure that you choose the right channel.
snap revert maas kind of could be used, but you risk loosing data that was written by the app during the debugging session.
Is there any better way of doing what I want to do?