How to simulate package installation on Linux (How to create and install a dummy package)
June 23, 2021
Sometimes, when installing packages from source code, you may encounter the problem that the required dependency is missing from the system. Usually you need to solve this problem by installing the necessary dependencies from the standard repository, or by compiling them from source.
Sometimes the required package is present, but its version is not suitable, a similar example and solution is described in the article “How to install a package for which there is no dependency of the required version”.
But I ran into a situation where the required dependency is:
a) does not exist at all (the package was removed from the package repository)
b) functionality has been moved to another package that can be installed
Take a look at the following message:
Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: detectiteasy : Depends: qt5-default but it is not installable E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
The program installed from source requires the qt5-default package. This package contains one single configuration file. The package itself was removed as unnecessary or due to the fact that its functionality was transferred to the qtchooser package that I installed. That is, from a practical point of view, the dependency is not needed, but I cannot update the system, because, as the package manager thinks, the dependencies are broken.
The way out of this situation is to install a dummy package.
How to create and install a dummy package on Linux (Debian, Linux Mint, Kali Linux, Ubuntu)
There is a Debian package called equivs that can create fake packages. Install it by running
sudo apt install -y equivs
Due to unresolved dependencies, I was unable to install the equivs package on the problematic OS – I used another computer to help.
After installation, you create a “control” template file using the following command:
Alternative package name can be used like postfix-custom for postfix or something else.
Let's open the generated file for editing:
An example of the content in my case:
### Commented entries have reasonable defaults. ### Uncomment to edit them. # Source: <source package name; defaults to package name> Section: misc Priority: optional # Homepage: <enter URL here; no default> Standards-Version: 3.9.2 Package: <package name; defaults to equivs-dummy> # Version: <enter version here; defaults to 1.0> # Maintainer: Your Name <email@example.com> # Pre-Depends: <comma-separated list of packages> # Depends: <comma-separated list of packages> # Recommends: <comma-separated list of packages> # Suggests: <comma-separated list of packages> # Provides: <comma-separated list of packages> # Replaces: <comma-separated list of packages> # Architecture: all # Multi-Arch: <one of: foreign|same|allowed> # Copyright: <copyright file; defaults to GPL2> # Changelog: <changelog file; defaults to a generic changelog> # Readme: <README.Debian file; defaults to a generic one> # Extra-Files: <comma-separated list of additional files for the doc directory> # Links: <pair of space-separated paths; First is path symlink points at, second is filename of link> # Files: <pair of space-separated paths; First is file to include, second is destination> # <more pairs, if there's more than one file to include. Notice the starting space> Description: <short description; defaults to some wise words> long description and info . second paragraph
The lines with comments indicate which defaults will be applied when creating the package – you can delete these lines or uncomment and specify your own value.
Also in the line “Package” enter the name of the package, I got it like this:
Section: misc Priority: optional Standards-Version: 5.15.2+dfsg-7 Version: 5.15.2 Package: qt5-default
The “Provides” line indicates that my package provides the capabilities offered by another package that one is trying to spoof.
Finally, after generating the template control file, use the equivs-build command to create a fake package like
In my case, this is:
It will take a few seconds to build the package and then you can run
sudo dpkg -i PACKAGE_NAME*.deb
For example, in my case, after transferring the package to the problem system, the command is as follows:
sudo dpkg -i qt5-default_5.15.2_all.deb
After installing the package, the work of the package manager returned to normal – it is again possible to install and remove packages, update the system.
For advanced users, if your template control file has the “Requires” line, you can create metapackages to install a group of programs.
- Package management in Kali Linux and other Debian-based distributions (searching, installing and removing programs, troubleshooting)
- Kali Linux Meta-packages
- Warning: apt-key is deprecated (SOLVED) (82.5%)
- How to completely uninstall a package along with dependencies on Arch Linux (as well as BlackArch and Manjaro) (72.5%)
- How to change the login shell in Linux. chsh instruction (58.8%)
- Linux PowerShell Basics (Beginner's Guide) (58.8%)
- pacman error “warning: failed to retrieve some files” (SOLVED) (56.3%)
- How to install PowerShell in Linux Mint (RANDOM - 50%)