Possibility of Snap corruption

Dear all,

I have a doubt. Let’s say I have a snap called “myawesomesnap” installed on my system. This mounts a read only squashfs partition like:

/var/lib/snapd/snaps/myawesomesnap_69.snap on /snap/myawesomesnap/69 type squashfs (ro,nodev,realtime)

Now imagine that for some reason (my hdd is faulty or the snap is running on an unshielded computer in outer space, whatever) and /var/lib/snapd/snaps/myawesomesnap_69.snap gets corrupted.

What would happen?
Does snapd realize it and does not allow you to run “myawesomesnap”?
If the corruption is not lethal to the squashfs format, would snapd run my snap and get undefined behavior (likely a segmentation fault somewhere)?

Thank you in advance for your insight.

Snapd does not perform any checking of Snap Package data consistency beyond that which your computer is already doing. Your applications are exactly as susceptible to bit flipping in a Snap as they are without. Having said that, when mounting the squashfs image the kernel can fail if the image is corrupt in which case your snap will be marked as “Broken” by snapd. In this case, you’ll need to either revert to a non-broken revision or refresh to a newer revision or remove and reinstall the snap.

I’m wrong. Snapd will check the cryptographic signature before mounting the squashfs image. So there is some basic sanity checking :slight_smile: That is better than your system would do normally without Snaps. Sorry I got my first reply wrong :woman_facepalming:


Thank you Daniel!

That is exactly what I wanted to know.

Best regards,

1 Like