Brief: Quick tutorial to show you how to get fix “snapd returned status code 400: Bad Request” error encountered while installing applications from Software Center.
I was trying to install Visual Studio Code, one of the best open source code editors that surprisingly comes from Microsoft. I have written about ways to install Visual Studio Code on Ubuntu earlier, but since then it has been available in the Software Center. Therefore I tried to install it from there.
To my surprise, I was greeted with an error when I hit the install button.
The error read:
Sorry, this did not work
Installation of Visual Studio Code failed.
And the details of the error was this:
Detailed errors from the package manager follow:
snapd returned status code 400: Bad Request
I don’t like silly errors but I like fixing them or in cases like these, getting around the errors. If you are facing a similar issue, then I am going to share with you why you got this error and how could you install the application that threw this error.
Get rid of ‘snapd returned status code 400: Bad Request’
If you prefer videos, you can watch this video on It’s FOSS YouTube channel.
Subscribe to YouTube Channel for more Linux videos
Let’s see how to install an application that shows the above-mentioned error. The workaround here is to use the command line. It’s not very complicated to use these commands. Just follow the instructions.
If you have read my guide to using snap commands in Ubuntu, you know that we can use the find option to search for available snap packages with a given name. In my case, I was trying to install Visual Studio Code so I can search for either “visual studio code” or simply “visual”.
Do note that if the program name has more than one word, group them together in inverted commas:
snap find "visual studio code"
As you can see in the command output, the system has Visual Studio Code version 1.18 available in Classic mode. I’ll explain what is this classic mode in the next section. You should also note the exact name of the package. It’s vscode for Visual Studio Code.
Now use the command in the following fashion to install the snap package:
sudo snap install vscode --classic
Enter your password and you’ll see that the application has been installed. You can now use the application like any regular software in your system.
Now that you have seen how to ‘fix’ this snapd error, you may jump straight to the comment section for a quick thank you. However, I recommend that you stay with me and read the next section to know a little about snaps and its classic mode.
Reason behind the ‘snapd returned status code 400: Bad Request’ error
I do not know how much do you know about Linux packaging here so I would try to explain the basics to you.
You might know that various Linux distributions have their own packaging system. You can download .deb packages on Debian and Ubuntu-based Linux distributions but Fedora will use its own .rpm packages and so on. By design, it’s not possible to use Debian packages on Fedora and vice versa.
Universal packages have been introduced to avoid the dependency on the distributions. Ubuntu launched its own universal packaging system called Snap. It allows you to use these Snap packaged applications on any Snap supported Linux distributions, not just Ubuntu.
The problem here is that the application you tried to install is actually a Snap package. This is why the error shows snapd which stands for snap daemon.
Classic Snap applications don’t work in Software Center
History aside, you could and you should ask if Snap packaging is from Ubuntu, how come it is not working in its Software Center?
The answer is the change in the design of Snap packaging. Originally, snap packages are installed and mounted in a tightly controlled space. They don’t have access to the vast majority of system resources and they bundle libraries they need and have a read-only file-system. This is called ‘strict’ confinement policy and they ensure a more secure environment.
However, with the release of snapd 2.20, Ubuntu introduced a new confinement policy called Classic. Apps in classic mode have access to the rest of the system same as most legacy packaged apps like Debian packages.
Unfortunately, Snap packages that use the Classic confinement policy are not supported by the Software Center. You’ll have to go through the command line option to install such Snap apps.
Did it work for you?
I hope this quick tip helped you to fix the issue and you also learned a thing or two about the snap packages. If you have questions or suggestions, please use the comment section below.