2

I run Ubuntu 20.04 and just Just ran sudo apt update twice posted the output below.

My question:

  • Why are the 2 apt run different? (1 goes to 16 the other to 4)

(FYI: I did a sudo apt upgrade between the two but I cancelled it with Ctrl+C)

blabla@PMQG:~$ sudo apt update
[sudo] password for noob: 
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]    
Hit:2 http://de.archive.ubuntu.com/ubuntu focal InRelease                    
Get:3 http://de.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://de.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:5 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [279 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [356 kB]
Get:7 http://de.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [363 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1.135 kB]
Get:9 http://de.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B]
Get:10 http://de.archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [8.012 B]
Get:11 http://de.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [11,3 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [38,2 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [675 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/universe i386 Packages [532 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [66,3 kB]
Get:16 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2.464 B]
Fetched 3.804 kB in 8s (448 kB/s)                                              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.

blabla@PMQG:~$ apt list --upgradable Listing... Done linux-generic-hwe-20.04/focal-updates 5.13.0.25.26~20.04.12 amd64 [upgradable from: 5.11.0.46.51~20.04.23] linux-headers-generic-hwe-20.04/focal-updates 5.13.0.25.26~20.04.12 amd64 [upgradable from: 5.11.0.46.51~20.04.23] linux-image-generic-hwe-20.04/focal-updates 5.13.0.25.26~20.04.12 amd64 [upgradable from: 5.11.0.46.51~20.04.23]

blabla@PMQG:~$ sudo apt update [sudo] password for noob: Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://de.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://de.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:4 http://de.archive.ubuntu.com/ubuntu focal-backports InRelease Reading package lists... Done Building dependency tree
Reading state information... Done 3 packages can be upgraded. Run 'apt list --upgradable' to see them.

Noob
  • 49

2 Answers2

1

The mirror that you are downloading updates from keeps track of the last time that a user connected to the update server from your Ubuntu. It can make an intelligent guess as to which Ubuntu instance is connected to it by comparing the list of installed software that you are trying to update with lists of installed software saved from Ubuntu users who have downloaded updates from the same mirror. If you connected to the update server recently then it serves you the delta changes from the last time that you connected to that mirror and resynchronized the package index files from their sources instead of making you download all of the package index files from their sources every time as you would have to do if you changed to a different update server.

karel
  • 122,292
  • 133
  • 301
  • 332
0

To further explain this post: What does Ign , Get or Hit mean when running an apt-get update? (of which I still believe this is Q&A is a duplicate..)

Recap:

  • Hit means apt checked the timestamps on the package lists (Release/InRelease* and Index files), those match and there are no changes.

  • Get means apt checked the timestamps on package lists (Release/InRelease* and Index files), there were changes and those will be downloaded.

So the first time you run sudo apt update, there are changes to the InRelease files for 3 of the 4 repositories (those returning Get in the first 4 lines), as well as the Index files for the underlying components (the last 12 lines).

However, the second time you run sudo apt update, it only Hits the InRelease files, meaning there are no changes to the underlying Index files.

Therefore, apt does not bother to check the underlying Index files again, because it knows there are no changes this time (since all InRelease files returned Hit).

This is further evident by the fact that none of the 12 last lines of the first run contains the focal repo. All subsequent Gets or Hits are from focal-security, focal-updates and focal-backports - only those 3 which returned a Get from the InRelease file.

*: The difference between Release and InRelease files: InRelease files are signed in-line while Release files should have an accompanying Release.gpg file.

Artur Meinild
  • 31,035