Snap Apps Crash Silently Due to Cross-Filesystem Symlinks
tech tips linux ubuntu troubleshooting
This won’t mean much to many, but there seems to be a small number of people stymied by a weird problem: some Snap apps won’t work on Linux. You install a Snap app, and it might work the first time you launch it. But every subsequent time you launch the app, nothing happens. There’s no error message or indication that anything is wrong; your app just won’t start. If you run snap run appname in your terminal, you won’t see anything, either, but the app still won’t launch. I’d had this issue with a couple of Snap apps (namely the Authy two-factor authentication app and HEY Mail). It’s an issue that’s frustrated me for a year, and one for which I’ve searched in vain for a solution. But the apps weren’t critical enough that I spent any serious effort tracking down the issue until now.
Some terminology for folks who aren’t following this (though if you’re not following this, you probably aren’t facing this problem). There are a bunch of distributions (known as “distros”) of the open source GNU/Linux kernel/operating system combination. Most Linux distros use some sort of package management system to deliver software to users. Package management is great because it allows easy installation, uninstallation, and updating of software. However, the fact that there are a ton of different package management systems creates a huge mess, because software developers need to create different versions of their software for each package management system. Most don’t, so delivery of software across Linux distros is a disaster. Snap is an effort to create a cross-distro software delivery system. It’s controversial for a variety of reasons. But that controversy is well beyond the scope of this post; for our purposes, it’s enough to know that Snap is a way to install software on a Linux system.
And for some reason, a lot of Snap apps weren’t working for me. Since the apps crashed silently with no error message, it was hard to search for a solution. I found a lot of threads on Snap’s forums, but they all seemed to end without resolution, or the solutions that were proposed didn’t work for me (this was not a display issue caused by problems with Wayland—which was one of my initial suspicions). I also found reviews for the apps I used that described the same issue: the app refusing to open without any feedback or error message. Here’s a review for the podcast app Pocket Casts:
Once upon a time this worked and was really handy… Alas now it does nothing… Not even an error message… Nada, zip, bubkiss, noffin….
Finally, I found this thread from Snap’s forums. Someone figured out that, if you create a symbolic link across devices or partitions of different filesystems (my Linux installation is on ext4, and my Windows installation is on NTFS), AppArmor (a Linux kernel security module) gets freaked out. This causes some, but not all, Snap apps to be unable to find certain files they expect to see. The result is that the app won’t open. Like the poster in the thread, I dual-boot Linux and Windows, and my music files are stored on my Windows partition. I created a symbolic link to my Windows music folder in my Linux home folder so my music would be easy to find. I deleted the symbolic link, and my Snap apps started working at once.
How do you know if you have this problem? Well, you’ll have some Snap apps that simply don’t work. Some of the affected ones include Authy, Bitwarden, HEY, and Pocketcasts, but I’m sure there are others. If you run a non-functioning app through the command line using the strace flag like so:
snap run --strace [APP NAME]
you will see a bunch of output that won’t mean much to you, but there will be several references to files that can’t be found (you can find the app names for your snap apps by running snap list). If that’s the case, you’re likely having this problem. The solution is to delete any cross-filesystem symlinks. If you really need something like those symlinks (turns out I don’t), you can try using bind mounts in your fstab file to achieve a similar result.