-   Linux - Software (
-   -   offline update package lists in Ubuntu (

uaa 07-27-2008 02:24 AM

offline update package lists in Ubuntu
how to update the packages index offline
running this command will update my software lists


sudo apt-get update
if I ran this instead


sudo apt-get update --print-uris
I'll get links to the files that apt-get use to update, OK.

lets say I'm a user without any kind of internet connection and I want to get the latest software list to my Ubuntu system. so I can chose what I want and run "generate download script" from synaptic so I ran this:


sudo apt-get update --print-uris | grep ^\' | cut -d\' -f2 > file.txt
It gave me the links to the file that the apt-get update gets it's informations from.


in apt-get man page:
This also works with the source and update commands. When used with the update command the MD5 and size are not included, and it is up to the user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.
is that right I mean no other way that if I downloaded these files to do something make the apt-get update command use the files I downloaded instead of the files from the internet.
please provide some way it would be nice to those who doesn't have internet so they can chose the software they want and download it later.

the same:

jomen 07-28-2008 11:25 AM


uaa 07-28-2008 01:51 PM

I'm sorry I wasn't clear.
after I got the files. how to make "apt-get update" use them instead of trying to connect to internet.

Many files have the same name so moving them as is to the lists folder won't fix it.
like the file Packages.bz2 .

And where to put the *.gpg files

I ran the command

sudo apt-get upate --print-uris
and I got this result:


'' security.ubuntu.com_ubuntu_dists_hardy-security_restricted_binary-i386_Packages 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_main_binary-i386_Packages 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_universe_binary-i386_Packages 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_multiverse_binary-i386_Packages 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_restricted_source_Sources 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_main_source_Sources 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_universe_source_Sources 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_Release 0
'' security.ubuntu.com_ubuntu_dists_hardy-security_Release.gpg 0
'' security.ubuntu.com_ubuntu_dists_hardy-security_restricted_i18n_Translation-en%5fUS 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_main_i18n_Translation-en%5fUS 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_universe_i18n_Translation-en%5fUS 0 :
'' security.ubuntu.com_ubuntu_dists_hardy-security_multiverse_i18n_Translation-en%5fUS 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0
'' 0
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0 :
'' 0
'' 0
'' 0 :
'' 0 :
'' 0 :
'' 0 :

It seems like the command shows the files needed and the names they should stored by.

after downloading these files should I rename them manually, or there is better way to do it.
and what should I do with *.gpg files again.

jomen 07-28-2008 03:35 PM

The method described does this:
- it creates a file "wget-script" - it contains all the adresses of all the files which need to be downloaded
You save this file to a usb-drive for example and then take to a machine with good internet connection.
- there you use that file to fetch all the packages (using "wget") sh -x ./wget-script
- you then bring the drive back home - and use the directory on the usb-drive to which you saved all these files as the archive for apt to do the update

You still have to "sync" (update the list of newly available packages on your machine - but just the update of the _list_) This does not use much bandwidth
- whereas the download of all these packages will require a lot of time on a slow connection and use quite a lot of bandwidth.
This approach is ideal for situations where you have only a limited amount of traffic per month available - or where the connection is slow.

I have done this all the time when I had only a 56k modem connection - I took the file on a usb-drive to the computer-pool of my university, downloaded, and made the upgrade using this at home.

If this is not what you actually asked for ... I misunderstood you completely.

uaa 07-28-2008 04:34 PM

Thank you I do the same as you used to do. because I've dial up connection, but using Synaptic package manger when you only download the lists, mark updates or program then Generate download scrip.
it's all automatic.

Now I need to update the list without having internet at all for some other people. I know I can copy what inside the folder /var/lib/apt/lists
but I don't prefer it.

like I said earlier I want the update command to use the files I download instead of internet.

Thanks any way

jomen 07-28-2008 04:58 PM

If /var/lib/apt/lists is the one and only file which holds the info on the newest/all available packages - IF you know that to be the case...
- then why not go that way and transfer this file to the others?
With the updated/current list of packages they too could use the same procedure (I suppose).
You could then also make them to use the files you downloaded. If they have no internet connection the only files available to them would be the files you provide.
You could also edit the file (apt sources list?) which defines which sources are to be used to do any upgrade - similar to specifying a CD as an install source - and remove all other sources.

uaa 07-28-2008 10:02 PM

Thought /var/lib/apt/lists/ is a directory what you said is still true. I can transfer it to others.
But when working on forums it's hard to do it. and there come the architecture of the packages i386 and AMD64 problems.

What I really need is an apt expert. or a script that will put the files I donwloaded for update lists in their respective palaces.

All times are GMT -5. The time now is 10:29 PM.