Updatable daemon file location?

What is the best way to facilitate an easy daemon development process?

I am working on updates to my daemon app in my snap and using the normal snap process, the actual final resulting daemon file gets placed in the root file system as


which, of course, is ready-only. While I am developing and debugging the daemon app, is there a way to specify in the snapcraft.yaml file that the daemon gets placed (only temporarily while I am developing it) in a writeable location that would simply allow me to scp an updated daemon file from my dev system to replace this file whenever I have recompiled any changes?

The current process of having to rebuild and reload an entire snap for every single change I make is laborious and quite ineffective - especially since the only file that ever changes in this one file now that I have my overall snap working.

Thanks in advance.

you can bind mount the binary over the one inside the snap … then restart the snap …

mount --bind daemon /snap/<snapname>/current/bin/<daemon>

make sure to unmount/remount it after a change …

1 Like

That worked perfectly! I was unaware of being able to bind files this way, so in addition to being a perfect solution, I learned something new! Thanks so much!

You can also “install” the prime directory with snap try prime (when building with destructive mode) or snapcraft try (when building with Multipass), in which case modifying the daemon in the prime directory (or any other file) is modifying the installation.