Ubuntu – How does update work with programs installed from .deb file


I'm having some difficulties exactly understanding how the the whole update thing work in Ubuntu and good practice for installing software.

I understand I have a /etc/apt/sources.list file where all my repositories are listed, and that these repositories are queried when I use apt-get update – to later be used with e.g.
apt-get upgrade. This makes perfect sense and I recently installed spotify by adding
deb http://repository.spotify.com stable non-free to this "sources" list.

But then I got confused…

When I went to download Google Chrome I merely had to download and grab a .deb file, and Chrome installed with no problem… but I don't see any new entry in /etc/apt/sources.list

So how does apt-get update know where to query concerning Chrome updates? Has it somehow been added to one of the already listed repositories in the sources file?

I would like all my installed software to be encompassed by the update function.

Best Answer

This is indeed kind of complicated. First, apt is a front-end to dkpg which actually handles installing/removing packages. So, /etc/apt/sources.list (and any files in /etc/apt/sources.list.d/) are read by apt, not dpkg.

Now, when you download a .deb file manually, you are bypassing apt and will use dpkg -i packagename.deb to install it instead. This means that apt's database will not be updated and that the apt system will have no knowledge of the package you installed. In other words, apt-get upgrade will never update any manually installed packages.

Having said that, chrome is actually an exception to the rule. When you go to its download page, you will see this message:

 enter image description here

At the bottom is this note:

Note: Installing Google Chrome will add the Google repository so your system will automatically keep Google Chrome up to date. If you don’t want Google's repository, do “sudo touch /etc/default/google-chrome” before installing the package.

This means that the .deb package includes a script that will add Google's repository to your system (specifically, it will create a file at /etc/apt/sources.list.d/) thereby ensuring that chrome will be updated when you use apt-get.

Related Question