Sudo apt install /path/to/package.deb doesn't work

Hello Kaisens,

So for some reason
sudo apt install /path/to/package.deb
doesn’t work:

user@t937 ~ $ cd /home/user/Downloads
user@t937 ~/Downloads $ ls
ft-day-program-application_comp.pdf megasync-Debian_9.0_amd64.deb Telegram TTC_SystemMap_2021-11.pdf
ft-day-program-application.pdf megasync-xUbuntu_22.04_amd64.deb ‘Telegram Desktop’ zoom_amd64.deb
megasync-Debian_11_amd64.deb skypeforlinux-64.deb tsetup.4.7.1.tar.xz
user@t937 ~/Downloads $ sudo apt install zoom_amd64.deb
[sudo] password for user:
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package zoom_amd64.deb

Beating myself over the head that I cannot type. But then:

user@t937 ~/Downloads $ sudo -i
root@t937 ~ # apt install /home/user/Downloads/zoom_amd64.deb
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Note, selecting ‘zoom’ instead of ‘/home/user/Downloads/zoom_amd64.deb’
The following additional packages will be installed:
dconf-cli gir1.2-ibus-1.0 ibus ibus-gtk ibus-gtk3 ibus-gtk4 im-config libegl-mesa0 libegl1-mesa libgbm1 libgl1-mesa-dri
libgl1-mesa-glx libglapi-mesa libglx-mesa0 libxatracker2 libxcb-xtest0 mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers
python3-ibus-1.0
Suggested packages:
ibus-clutter ibus-doc
The following NEW packages will be installed:
dconf-cli gir1.2-ibus-1.0 ibus ibus-gtk ibus-gtk3 ibus-gtk4 im-config libegl1-mesa libgl1-mesa-glx libxcb-xtest0 python3-ibus-1.0
zoom
The following packages will be upgraded:
libegl-mesa0 libgbm1 libgl1-mesa-dri libglapi-mesa libglx-mesa0 libxatracker2 mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers
9 upgraded, 12 newly installed, 0 to remove and 210 not upgraded.
Need to get 26.2 MB/194 MB of archives.
After this operation, 625 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Then it goes on as supposed to. However, ends with:

No VM guests are running outdated hypervisor (qemu) binaries on this host.
N: Download is performed unsandboxed as root as file ‘/home/user/Downloads/zoom_amd64.deb’ couldn’t be accessed by user ‘_apt’. - pkgAcquire::Run (13: Permission denied)

How can permission be denied after sudo -i?
And why in the world if i type in package name correctly it says it’s not there?

I am baffled and waffled.

Any help is appreciacted.

Hello @chyrei,

First of first I would like to explain difference beetweeb apt and dpkg. dpkg is the pachage manager which installs your package, even if you use apt. apt on the other hand is build to resolve dependencies of the package and it works with repos placed in /etc/apt/sources.list.

So to traditionaly you would do :

sudo dpkg -i the_name_of_the_package.deb

the name of the package could be written without “./ (current directory)” if you are in the same directory (which is what you did but with apt)

Today we have repos and package managers like apt to resolve depencies. If you want to INSTALL and RESOLVE dependecies of localy downloaded package you should do :

sudo apt install ./the_name_of_the_package.deb

You didn’t used the “./” and apt tried to serch repos for package with the name of zoom_amd64.deb → Result E: Unable to locate package zoom_amd64.deb

Second : sudo -i would never resolve any problem. It’s also a realy bad practice. The reson you was able to install zoom is what you’ve indicated the full path to the package, you could also indicate the realtif one as I explained before.
In this situation, the root user didn’t allow you to install your package : Download is performed unsandboxed as root as file.

My explanation may be unclear but I will give you an example. Zoom is part of app what require internet beacause all of the content is online. In most cases if not in all of this cases, this type of apps are sandboxed. It a mechanism to isolate every “process” of the app from your system by using it as unpriveled user.
As a perfect example I will do the same with firefox (Kaisen’s default web browser).

niki@nikilabmob ~ $ sudo -i
[sudo] password for niki: 
root@nikilabmob ~ # firefox
Running Firefox as root in a regular user's session is not supported.  ($XAUTHORITY is /home/niki/.Xauthority which is owned by niki.)
root@nikilabmob ~ # 

Take a look at the USER column :

All subprocesses are launched with my unpriviliged user.

Have a nice day

Thank you @niki for the detailed response! Much appreciated. Please consider the topic closed.

1 Like