Ubuntu and Debian packages are usually compatible, but installing a .deb file meant for Debian on Ubuntu can break things

Ubuntu is built on Debian, so most Debian packages (.deb files) will install and run on Ubuntu without problems. However, "usually works" is not the same as "always works". Debian and Ubuntu diverge in how they package certain libraries, what versions they include, and how they handle system dependencies. Installing a Debian package directly can leave your Ubuntu system in a state where some programs stop working or won't start at all.

The safest approach depends on what you're trying to install. If the package exists in Ubuntu's own repositories, install it from there. If it doesn't, you have several options that range from very safe to risky. This guide walks through each one so you can make the choice that fits your situation.

Key Takeaways

  • Ubuntu's package repositories contain most common software, and installing from there is always safer than installing a random .deb file.
  • If a package exists for Ubuntu, use apt install packagename in the terminal rather than downloading and installing a .deb file by hand.
  • If you must install a Debian .deb file, check the package's dependencies first using dpkg -I filename.deb to see what else it needs.
  • Installing a .deb file directly bypasses Ubuntu's dependency checks, so broken dependencies can leave your system in an inconsistent state.
  • Flatpak and Snap are safer alternatives to .deb files for software that isn't in Ubuntu's repositories, because they bundle their own dependencies.

Check Ubuntu's repositories first

Before you download a .deb file from anywhere, open a terminal and search for the package in Ubuntu's own repositories. Type apt search packagename, replacing packagename with what you're looking for. If it shows up, install it with sudo apt install packagename. This is the correct way to install software on Ubuntu, and it handles all the dependency checking for you.

Ubuntu maintains separate repositories for different categories of software: main (officially supported), universe (community-maintained), multiverse (proprietary), and restricted (drivers). By default, main and universe are enabled. If the package you want isn't showing up, it might be in multiverse or restricted. You can enable those repositories through Settings > Software & Updates, or by editing /etc/apt/sources.list in a text editor if you're comfortable with that.

Understand what a .deb file actually is

A .deb file is a compressed archive that contains a program, its configuration files, and a list of other packages it depends on. When you install a .deb file using the graphical package manager or the dpkg command, your system unpacks it and tries to satisfy those dependencies. If the dependencies aren't available or are the wrong version, the installation can fail or leave your system broken.

The key difference between apt and dpkg is that apt knows how to find and install missing dependencies automatically, while dpkg will just tell you they're missing and stop. This is why you should use apt whenever possible, and why installing a .deb file directly is riskier.

How to check a .deb file before installing it

If you've downloaded a .deb file and you're not sure whether it will work on Ubuntu, you can inspect it without installing it. Open a terminal, navigate to the folder where the file is, and type dpkg -I filename.deb. This shows you the package name, version, and most importantly, the list of dependencies it needs.

Read through the dependencies and ask yourself: do I recognize these package names? Are they things that sound like they should exist on Ubuntu? If the list includes packages you've never heard of, or if it specifies exact versions that sound very old or very new, that's a warning sign. You can cross-check by typing apt search dependencyname for each one to see if Ubuntu has it.

Installing a .deb file safely

If you've decided the .deb file is worth trying, use apt to install it rather than dpkg. Open a terminal, navigate to the folder where the file is, and type sudo apt install ./filename.deb. The ./ tells apt to look in the current folder. This way, apt will try to find and install any missing dependencies from Ubuntu's repositories before it installs the package itself.

If apt finds missing dependencies and you don't want to install them, it will ask you to confirm before proceeding. If you say no, nothing gets installed and your system stays unchanged. If you say yes and the installation fails partway through, apt can usually clean up after itself. This is much safer than using dpkg -i, which will install the package even if dependencies are missing and leave your system in an inconsistent state.

When a .deb file breaks your system

If you installed a .deb file and now something isn't working, the first step is to remove it. Type sudo apt remove packagename, replacing packagename with the name shown when you ran dpkg -I earlier. If that doesn't fix the problem, you may have broken dependencies that need to be cleaned up. Type sudo apt --fix-broken install to let apt try to repair the situation.

If your system is severely broken — for example, if you can't open the terminal or the graphical interface — you may need to boot into recovery mode or use a live USB to fix it. This is rare, but it's why installing random .deb files is risky. The safer alternatives below avoid this problem entirely.

Safer alternatives: Flatpak and Snap

If the software you want isn't in Ubuntu's repositories and you're worried about installing a .deb file, consider Flatpak or Snap instead. Both are containerized package formats that bundle the program and all its dependencies together, so they can't break your system the way a .deb file can. Flatpak and Snap are already installed on most Ubuntu systems.

To search for a program on Flathub (the Flatpak repository), visit flathub.org and search for the name. To install it, type flatpak install flathub appname. For Snap, type snap search appname to search, then sudo snap install appname to install. Both are slower to start than native packages because they're running inside a container, and they use more disk space, but they're much safer if you're installing something you're not sure about.

Frequently Asked Questions

Can I install any Debian package on Ubuntu?

Most Debian packages work on Ubuntu because Ubuntu is based on Debian, but not all. Packages that depend on very specific library versions or system configurations may fail. Always check the dependencies first using dpkg -I before installing.

What's the difference between apt and dpkg?

dpkg installs a single .deb file but doesn't find missing dependencies. apt installs packages and automatically finds and installs what they need from repositories. Always use apt when you can, because it's safer and handles dependency problems for you.

Is it safe to install a .deb file from a website I don't know?

No. A .deb file can contain any code and run it with root privileges. Only install .deb files from sources you trust — the official website of the software, your Linux distribution's repositories, or well-known package hosting sites. When in doubt, use Flatpak or Snap instead.

How do I know if a package is in Ubuntu's repositories?

Type apt search packagename in the terminal. If it shows up, it's in one of your enabled repositories. You can also visit packages.ubuntu.com, search for the package name, and see which Ubuntu versions have it.

What should I do if installing a .deb file broke something?

Remove the package with sudo apt remove packagename. If that doesn't fix it, run sudo apt --fix-broken install to let apt repair broken dependencies. If your system is severely broken, boot into recovery mode from the GRUB menu and use command-line tools to fix it.