Installing a Snap in chrooted enviornment

Hi,
Is there a way to update snaps (store and files) in a chrooted enviornment? I have a directory tree where I can chroot into, install stuff via APT, then I can mount it as my fs and it works as you would expect. However the problem is that when trying to do the same with Snap it won’t work. At first it complained that Snapd wasn’t initialized correctly. Then I tried to bind mount /run directory from outside to inside, but this resulted in the installation on my “host” machine and not on the chrooted environment.
Thanks!

No, unfortunately snapd is not designed to work within a chroot

If you want a chroot-like environment, one option would be to use an LXD container (kind of like a chroot on steroids). You can install snaps within an LXD container.

This has recently come up for me. Perhaps there’s a way to do this that doesn’t involve chroot and if that’s the case I’m all ears.

I have a Core 20 device that is in a persistent reboot loop. I’m pretty sure I know what the issue is and have resolved it in the offending snap. But, I would like to recover the device.

I was hoping that I could mount the filesystem and chroot it and install the updated version. If this is not possible, is there an alternative? I have full access to the filesystem in question.