18
$ ls
wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb

$ sudo apt install wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb
E: Couldn't find any package by glob 'wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb'
E: Couldn't find any package by regex 'wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb'

I was wondering why the deb file can't be located?

Is it because of sudo or apt install?

Thanks.

Note that

$ sudo apt install ./wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb

works, but I was asking for the reason of the previous failure.

Related How to install a deb file, by dpkg -i or by apt?

Tim
  • 101,790
  • 1
    Try specifying the absolute path to the .deb file perhaps? Also, I wonder if the tildes in the filename are potentially causing issues. I have often used sudo apt install package.deb, so I know that in general it will work as you appear to expect. – DopeGhoti Jun 08 '18 at 17:07
  • Off-topic, but sudo dpkg -i package_name.deb is probably the answer to how many people will view this question. Also off-topic, using dpkg is vastly faster because it won't do dependency checking, and also works on distros that don't even have apt installed. Hope many of you find that helpful. – Wil Jun 08 '18 at 20:19
  • dpkg not doing dependency checking is why I prefer to use apt to install one-off packages. – DopeGhoti Jun 08 '18 at 21:51

2 Answers2

23

Since version 1.1~exp1, apt and apt-get support installing from package files accessible via the file system, and not just from repositories. However, in order to preserve backwards compatibility, the feature only works for package specifiers which are unmistakably files, i.e. which contain /. Anything else is processed as a package name rather than a package file, using the pre-existing mechanisms.

Thus

sudo apt install wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb

is handled as a request to install the package named “wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb”, and apt goes looking for that in its repositories and fails.

But

sudo apt install ./wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb

is handled as a request to install the package contained in the file named “./wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb” (along with its dependencies, if necessary). This also works for absolute paths.

I can’t find any trace of this in the apt documentation though, apart from the brief mention in the changelog:

  • add support for "apt-get install foo_1.0_all.deb"

There is a bug requesting that this feature be documented.

Stephen Kitt
  • 434,908
-3

The command apt install doesn't install .deb files. To install the deb file wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb, use dpkg -i wkhtmltox_0.12.5-0.20180604.140.rc~6f77c46~bionic_amd64.deb. dpkg -i is used to install .deb files.

  • 5
    dpkg -i can be used to install .deb packages, but so can apt install; I do it routinely when updating Plex Media server with sudo apt install ./packagefile.deb. – DopeGhoti Jun 08 '18 at 17:10
  • 3
    From the apt changelog, 1.1~exp1: add support for "apt-get install foo_1.0_all.deb" – steeldriver Jun 08 '18 at 17:33