How do I get apt-get to ignore some dependencies?
Solution 1:
Simple and easy solution: just specify the unwanted packages with an extra -
after each of them.
Example without the -
switch:
root@debian:~# apt-get install bsd-mailx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
exim4-base exim4-config exim4-daemon-light liblockfile-bin liblockfile1
[...]
Example using the switch to avoid installing exim4-base
. Notice the -
at the end:
root@debian:~# apt-get install bsd-mailx exim4-base-
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'exim4-base' is not installed, so not removed
The following extra packages will be installed:
liblockfile-bin liblockfile1 ssmtp
[...]
As you can see, apt-get
does not try anymore to install the exim4-base
package, and it does not try to install its various dependencies (exim4-config
etc).
And if you were wrong and needed that exim4-base
dependency after all, you can just apt-get install
it later!
Solution 2:
You can change the dependencies of a deb package like this:
- Unpack deb:
ar x golden-linux.deb
(will create i.e. three files: debian-binary control.tar.gz data.tar.gz) - Unpack control archive:
tar xzf control.tar.gz
(will create: postinst postrm preinst prerm md5sums control) - Fix dependencies in
control
(use a text editor) - Repack control.tar.gz:
tar --ignore-failed-read -cvzf control.tar.gz {post,pre}{inst,rm} md5sums control
- Repack deb:
ar rcs newpackage.deb debian-binary control.tar.gz data.tar.gz
(order important! See [Note] )
[Note]: dpkg wouldn't be able to read the metadata of a package quickly if it had to search for where the data section ended!
Solution 3:
After you install the package with the --ignore-depends
option, go and edit the /var/lib/dpkg/status
file, and remove whatever dependency you think is not needed.
Just be very careful. In order a dep. to be required, it is more than likely to BE required
Solution 4:
You can try the --nodeps
flag with apt-get
.
Or download the package and install it using dpkg
with the option --ignore-depends
.
For example, if you want to install package foo
without dependency bar
:
dpkg --ignore-depends=bar -i foo_1.2.3_amd64.deb
Solution 5:
Since you installed postfix from source, you need to install a "dummy" package which will satisfy the mail-transport-agent dependency of mailx (or bsd-mailx). The "equivs" package in debian exists to create such a dummy package which you can install to tell dpkg "this dependency is satisfied"
The reason that telling dpkg to simply ignore dependencies is not a good solution, is that you are only telling dpkg/apt to ignore it for a single transaction, you can't tell it to ignore dependencies forever. Everytime you use apt it checks the dependencies on all packages