15

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.

Kirbies
  • 333
  • 4
  • 9

2 Answers2

12

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.

terdon
  • 100,812
  • Ok, makes sense...but is there then any way to easily manage the updates for all my manually installed packages? – Kirbies Mar 15 '14 at 00:18
  • 2
    @Morten no, that's exactly why apt etc exist, if you step outside that system you're on your own. There are tricks but it is rarely worth the effort for the few packages you might install manually. – terdon Mar 15 '14 at 00:26
  • 2
    The package manager actually doesn't care whether a package has been installed by dpkg or apt. If it finds a newer version of a package in the repositories that newer version gets installed. – Florian Diesch Jan 17 '15 at 18:08
  • @FlorianDiesch yes, of course. My point was for packages that are not in the repositories. – terdon Jan 17 '15 at 18:13
2

apt searches in the sources listed in /etc/apt/sources.list and also all files in /etc/apt/source.list.d. You will have a file such as google-chrome.list in /etc/apt/sources.list.d which will have the following line:

deb http://dl.google.com/linux/chrome/deb/ stable main

This is used as the source for updating google-chrome.

When you downloaded the deb file for google-chrome manually and installed it, a script in the deb file created this file, so that you don't have to manually search for updates.

jobin
  • 27,708