How to Fix snap Package Dependency Errors in Ubuntu
Ubuntu now allows you to use the snap command to install apps from a store. While it’s not designed to replace the Debian-derived apt-get system currently in use on most Ubuntu Linux installations, it does have the benefit of being fairly platform-agnostic. This is why it’s become popular on Ubuntu mobile installations.
You’ll need the command prompt for this, so you can start it from the Ubuntu Dash or by holding down Ctrl, Alt and T at the same time. You could also start it from the Dash or the LXDE menu’s System Tools list on Lubuntu. Xubuntu users may wish to start it up from the Whisker Menu. Before you attempt to use these methods, you’ll want to make sure that a good old sudo apt-get update command doesn’t fix your error right away. Many people aren’t actually using snaps yet.
Method 1: Refreshing the core snap Package
Unlike .deb packages, snap packages contain more or less everything that a particular piece of software needs to run so there aren’t really dependencies. Therefore if you’re getting dependency errors and you’re sure that it’s not with any package installed or updated via apt-get, then you’re more than likely suffering a problem with one of the two core snap packages. Assuming that you don’t have administrator access shown by a # symbol at your prompt, type sudo snap refresh core at the command prompt and push enter. You might get prompted for your administrator password.
Once you’ve typed it and pushed return, the snap package manager will start to update automatically. If it succeeded, then try running the program you were having issues with again and see if the dependency issues are gone. For instance, if you installed the 287 MB or so LibreOffice snap previously and got an error then start LibreOffice either from the Dash or by searching for it. You’ll find in the vast majority of cases this single command was enough to fix the issue and you won’t need to move on at all. If you wanted to see more about what type of error you were looking at, then just type libreoffice or whatever other package names at the command line with no other arguments to see if anything else were wrong.
Method 2: Reinstalling the core snap Package
Very few users will suffer any further problems beyond this, but if you had then you could uninstall the core snap package and any other snaps you’ve installed and then reinstall them. Keep in mind that if the first method worked, then this is totally unnecessary and can make you loose some of your configurations. You’ll want to make sure your data is backed up like usual before doing this, but fortunately, it can still be accomplished with an absolute minimum of playing around.
Make sure you’ve got nothing else open and then run sudo snap remove core snap-package1 snap-package2 from the command line and wait as it runs through the snap packages you have installed. Once it’s done, then type sudo snap install core snap-package1 snap-package2 from the command line and push enter. You’ll need to wait again for the packages to reconfigure themselves, but these two easy commands are enough to sort the issue out.
Method 3: Listing Installed snaps and Changes
You can check the details of any installed snaps at any time by simply running snap list from the command line, and you probably won’t need sudo access for it.
Likewise just run snap changes from the command line when you’re done with any of these tasks to see what changes have been made. Once you have your packages working again, presumably from the technique in the first method, you can always run sudo snap refresh from the command line to update all snaps at once.