3 Easy Steps To Install Deb Files On Raspberry Pi + Troubleshooting
Recently, I’ve been downloading some programs and applications on my Raspberry Pi and encountered a few installations involving deb files. I made a lot of mistakes while trying to install an app using it, so I created an article to show you a 3-step method to installing deb files on your Raspberry Pi:
The steps for installing a .deb file on your Raspberry Pi are :
- Choosing a deb file that supports your Raspberry Pi OS architecture
- Downloading the file
- Installing it with either the apt or dpkg command
The rest of this article will dive deeper into each step. Moreover, I’ll go over solutions to 4 common mistakes you might make when performing these steps.
But first, let’s make sure we’re on the same page and define:
What’s A Deb File?
Most application on linux are open source. The source file of the application are usually provided to us and in order to run it on our platform, we have to either compile the sources or install it from a binary package
A binary package is an application package which contains executables, as opposed to source code. The executables are the outcomes of the compilation process. A binary package is an easier way to install and run the desired applications compared to the compiling source code.
Deb is the installation package format used by all Debian based distributions, which includes Raspberry Pi OS (operating system). A deb file an archive that contains other files including the executable application that was already compiled. Simply put, it’s a collection of code that can be executed in a Debian system.
The contents of a deb file includes:
- An archive that contains metadata information, the version, and the dependencies.
- Another archive that contains the application files
There are 2 different ways you can install deb files: apt or dpkg.
What’s DPKG?
Dpkg stands for Debian Package Manager, and it provides the low-level infrastructure for package manager. Sometimes, other higher-level infrastructure like apt will call on dpkg.
Something that’s low-level means it’s more computer friendly and readable whereas something that’s higher level is easier for humans to read and use.
The dpkg database contains a list of the installed software on the system. If you want to see information about a deb package, type the following command in your terminal (and replace the ‘deb_file’ with the name of the deb file you want to analyze):
dpkg --info 'deb_file'
To see the package version, architecture, and the short description, run:
dpkg-query -l
Sadly, dpkg doesn’t work with repositories nor does it resolve dependency problems. Instead, you’ll have to use apt if you want these features.
What’s APT?
APT, which is also known as the Advanced Packaging Tool, is the recommended way to manage software packages on Ubuntu and other Debian based distributions (like Raspberry Pi).
In the newest version of Ubuntu, the apt-get and apt-cache tools were merged into a single command called apt.
Unlike dpkg, apt does not understand .deb files. It works with packages that are downloaded from repositories and calls dpkg directly after downloading the .deb archives.
An APT repository is a web server that contains a collection of packages with metadata that is readable by the apt tool. An apt uses an index or a local database that holds records of available packages from the repos enabled in the system.
Every time you pull from the APT repository (like installing a software from it), you need to make sure to run this command before you pull:
sudo apt update
This will pull the latest version of whatever program you’re installing from the repository.
If you want to clear out the local repo of retrieved packages, run the following command in your terminal:
sudo apt clean
This will remove everything except the lock file.
If you want to get information about the available packages, then you’ll need to run:
apt list
How To Install Deb Files On Raspberry Pi
1. Choose A Deb File
Before you download a package, you’ll first need to make sure that the deb file you want is compatible with your architecture. If they don’t match, then the Raspberry Pi OS and its ARM processor will not be able to install it in the last step and will instead display an error message.
There are 2 different Raspberry Pi versions you could’ve installed: the 32-bit operating system or the 64-bit operating system.
Each one accepts only a few specific types of deb files. You can tell which files are compatible with your system based on the ending file names. You can scan the table below to decide which files to install:
32-bit OS | 64-bit OS |
armhf.deb | arm64.deb |
armv7l.deb | armv8.deb |
For example, if you have a 32-bit OS, then the deb files you install must either have the armhf.deb ending or the armv7l.deb (it’s not a 1, but the letter ‘l’) ending.
You should definitely be cautious when picking files because you don’t want to accidentally install a deb file with the amd64.deb ending. This looks very similar to arm64.deb, but it’s only compatible with the devices with AMD and Intel processors that are supported with 64-bit.
There are some software like nativefier that won’t let you create something on your Raspberry Pi because of the mismatched architecture.
For example, if you don’t include the option –arch=”armv7l”, then you’ll encounter an error and nativefier won’t create an app for you.
If you want to learn more about nativefier, consider checking out my post on installing Discord apps. I’ll show you how create a Discord app shortcut with nativefier!
Now, if you forgot what version of Raspberry Pi OS you have, don’t worry. You can easily check by going to the terminal and typing in this command:
uname -m
This should either display “aarch32” or “aarch64”. For me, I got the last option, which means I have a 64-bit Raspberry Pi OS. It’s also likely you might get “armv7l” or “armv8”. This should correspond with 32-bit and 64-bit OS respectively (you can check the previous table to make sure).
2. Download The Package
Once you have identified the deb file you want to install, you will now need to download the file. If you are using the Chromium browser (which is the default browser), you can click on the link, and the downloaded file will be stored in the Downloads folder.
Otherwise, you’ll need to use the wget command so that you know where the file will end up.
Wget is a command for downloading files from http, https, and ftp servers. It provides a number of options that can allow you to download multiple files, resume downloads, limit the bandwidth, mirror a website, and more.
It should be pre-installed with your Raspberry Pi OS, but just in case you don’t have it installed, open up your terminal and run this command:
sudo apt install wget
Here is the syntax of the wget command if you want to install the deb file:
wget <website link of the file you want to download>
Now, you may be wondering where you can obtain the website link for the deb file. All you need to do is right-click the file and select an option that resembles “Copy link address”. That’s the link you put right after wget.
Now, if you want to store it in a specific directory, then you need to include the -P option. In this example, I’ll download it in my Downloads folder:
wget -P Downloads/ <website link you want to download>
Now, you can check to make sure it’s downloaded by using the list command:
ls Downloads/
This will list all the names of the files and directories in the specified directory (which is Downloads). If you use ls by itself, then it will list everything in the directory you’re in.
3. Install It
As I mentioned before, you can install a deb file using 1 of 2 commands: dpkg and apt.
1. Using DPKG
To install the deb file with the dpkg command, type the following in your terminal (replacing deb_file with the name of your saved deb file):
sudo dpkg -i deb_file
Of course, you can install more than 1 deb packages by adding more arguments:
sudo dpkg -i deb_file1 deb_file2 deb_file3
2. Using APT
This is the structure for installing a deb file with the apt command (making the necessary substitution with absolute_path_to_deb_file):
sudo apt install absolute_path_to_deb_file
Unlike the dpkg command, you need to include the absolute (or full) path to the location of your deb file. That way, apt knows where to find and install the deb file.
For example, if I wanted to install the deb file that’s located in my current directory, I’d use the command:
sudo apt install ./deb_file
The notation ‘./’ is the path to your current directory.
Once again, you can install more than one program with apt by using the space-separated list format:
sudo apt install absolute_path_to_deb_file1 absolute_path_to_deb_file2
When you run this command, you’ll be greeted with prompts to confirm your downloads. You can press the ‘y’ key and the enter key to confirm or add the -y option to the end of your command to have the terminal automatically mark the reply to the prompts as “yes” for you.
Note that in both of these commands, you need to assume root privileges, which is what the sudo command does. In fact, sudo stands for superuser do, and it’s the account that lets you make changes to your Raspberry Pi.
Troubleshooting
Here are some of the common problems you may run into:
1. Unsupported Architecture
Like I mentioned in the first step, you will encounter this error in the terminal when attempting the third step if you install the wrong file. That’s because the executable code in the deb files are not compatible with your current Raspberry Pi OS.
To resolve this issue, I’d suggest checking the site where you downloaded the deb file to make sure you got the right one. If you do, then it’s likely that the author mislabeled the files. In any case, you should ditch that site and find a different one to use.
2. Deb File Location Unknown
If you installed a deb file and don’t know its location, don’t worry. You can run this command in the terminal to find it:
find / -name *.deb
What this command essentially does is look for any files ending in .deb (the asterisk is a placeholder) in the root directory and its subdirectory.
The root folder is at the top of the hierarchical file system, which means all the folders on your system is found in it (like the Downloads folder). Simply put, if you did download the deb file, then that file and its location will definitely appear in the output in the terminal.
3. No File With Arm-Related Endings
If you can’t find deb files with endings like armv71 or armv8, then you’ll need to pursue a different method of installing the app you want.
Here are some tools I’d use to install apps for my Raspberry Pi:
- Download Pi-Apps and search for apps there
- Download Synaptic Package Manager and look for apps there
- Run the pre-installed software called the Add/Remove Software to find apps
- Download from source code
Admittedly, the last method is a little hard, but if you want to learn more about these methods, how you can implement them, and more, go check out my guide on installing applications on your Raspberry Pi!
For example, Discord doesn’t have a deb file for you to install on Raspberry Pi, but I can install it from Pi-Apps!
4. Unable To Resolve Host Address
This error appears when you use a misspelled website link when using the wget command.
Sadly, it’s not possible to autocomplete using the tab key when typing in the link because the terminal doesn’t recognize it. That’s why I don’t recommend typing the link out letter by letter. Instead, you should just copy it by right-clicking on the link on the site and pasting it after the wget command in your terminal.
Make sure you’re actually copying the link (which should start with “https”) and not the name of the link. I admit, I’ve made this mistake a few too many times!
Summary – tl;dr (Too Long; Didn’t Read)
Here are the key takeaway points you should keep in mind after reading this article:
- The 3 steps to installing a deb file on your Raspberry Pi are:
- Choosing a deb file that supports your Raspberry Pi OS architecture
- Downloading the file
- Installing it with either the apt or dpkg command
- You might encounter problems such as:
- Unsupported architecture: make sure you have the right deb file installed
- Deb file location unknown: run this command in the terminal to find it:
- find / -name *.deb
- No file with arm-related endings: use other methods to install apps you want like Pi-Apps, Synaptic Package Manager, and the Add/Remove Software
- Unable to resolve host address: make sure you copy the link and not the name of the link
I deb-initely had a great time learning and making this post, and I hope you enjoyed learning about it too!