Offline Package Manager - apt-offline


A copy of this article is also available at: 


This article is about Offline Package Management in Debian. Debian is a pretty well known project. One of the things that makes Debian very popular is APT (a.k.a Advanced Packaging Tool) which allows remote package downloads, upgrades and dependency resolution. Unfortunately it does require a network connection - unless you use apt-offline.

In Debian, when you need to install a package, you usually would fire up the apt-get command and the software would just install without any hand holding.

While APT is really very cool one of the main reasons for its success is the Debian Policy. The Debian Policy is like the brain of the project that controls the entire project ensuring that all the bits and pieces fit well together upto the Debian Standards. APT is just a result of the fantastic Debian Policy work.

In Debian, every package is very well self-contained and is tightly related to each other using APT. APT does a very good job of integrating and resolving dependencies for Package Management and takes off all the Dependency Hell problems from the user.

This is where the problem starts - for a machine which has network access it works very well because APT generates the list of packages and their dependencies and is able to download and install them successfully.

But when it comes to downloading a package individually on a different machine, along wih resolving any dependencies this can be a big problem.

Consider this real world example: I have a Debian box at home. At home, I have no (or very slow/expensive dial-up) internet connection. At work, I (or my friend) do have a very fast connection but (as part of IT policy) am required to use Windows.

I would still like to be able to painlessly update/upgrade my Debian box at home, with all the power and flexibility of APT.

This is where apt-offline is useful. apt-offline is an offline APT Package Manager.

Using apt-offline:

  • You generate a signature on your Debian box at home and carry the signature file on a removable medium (Probably a USB Stick).(e.g. "apt-offline set /tmp/apt-offline.txt")
  • Now you take the USB Stick (with the apt-offline.txt signature file) to the office machine which could be running any linux version, or as I mentioned above, even Windows.
  • There, you could run apt-offline giving it the signature file. (e.g. "apt-offline get C:\apt-offline.txt")
  • apt-offline would generate you an archive file or a folder with all the data. That data can be copied on a removable media. The removable media can be attached back to the disconnected Debian box at home and installed. (e.g. "apt-offline install /tmp/apt-offline.zip")

Let's start with a 3 step example

Step 1

Generate a signature file on the Disconnected Debian box at home

apt-offline set /tmp/apt-offline.sig

The above command will generate all information required from apt about updating its database.

By default, with no additional arguments passed, apt-offline will extract information about APT Package Database Update i.e. the --update option as well as the list of Packages to be upgraded i.e. the --upgrade option.

These options can also be individually passed if you want only one of those.

Step 2

Download data based on the signature file generated earlier

apt-offline get C:\apt-offline.sig --threads 5

The above command will download data as mentioned in the signature file. To speed up downloads (that can be from multiple apt repositories), in this example we spawn 5 download threads.

Note: It would be good to also download the bug reports for the packages that you are downloading. So that example now becomes:

apt-offline get C:\apt-offline.sig --bug-reports --threads 5

There are many more options that you can pass to apt-offline, like the --bundle option which would generate for you, an archive file with all the data.

Once completed, you could just copy the data (an archive file, if you used the --bundle option) back to the removable medium and copy it back onto your offline host.

Step 3

Once you're back upon the home Debian machine, you feed the data from the removable medium to apt-offline:

apt-offline install /media/USB/apt-offline.zip

This will update the APT database on your disconnected machine seamlessly.

If there were packages that needed to be upgraded, now they would all be available (with dependencies) in the APT database. So if you do an apt-get upgrade now, APT won't prompt you mentioning even a single bye download. APT would find that all required packages are already present in the APT cache.

If you had used the --bug-reports switch that I mentioned earlier, during install apt-offline would prompt you with the list of bug reports related to the packages on your machine that need be upgraded/installed - not just the list but the full bug report will be available for you to look at and evaluate the severity involved.

As you can see from the article above, apt-offline helps you achieve the power of APT, in just 3 steps. apt-offline is part of Debian and isdeveloped at Alioth.




Ritesh Raj Sarraf's picture

File System corruption and Recovery

So this is the 2nd time I ran into a problem like this again. My FAT32 file system on the external USB HDD, all of a sudden, started reporting:

00:47:32 rrs@champaran:/tmp$ sudo dosfsck /dev/sdb1
dosfsck 3.0.9, 31 Jan 2010, FAT32, LFN
Logical sector size is zero.


I had been taking a lot of care to ensure that I don't run into situation like this. No body likes losing data. The good part is that I've been lucky enough that, even without backups (now who's gonna backup a backup disk), I have recovered all my data. All thanks to Christophe GRENIER for Testdisk.


So what caused the problem

I don't know. I do remember what I did last that must have triggered the problem. I started 5 copy operations from my Laptop HDD to the External HDD (FAT32 which got corrupted) using the File Manager, effectively triggering a random write for the I/O Scheduler.

And at the very same time, I was also running Handbrake to try re-encode a corrupted MP4 video from my camera - CPU Intensive task.

Well nothing RTOS or Mission critical, but unfortunately, the linux kernel couldn't take much. The moment it ran out of VM, it started paging. And looks like paging is the ugliest state for the linux kernel. Because the moment it starts paging, you have a very high probability of hitting an OOM. And that's what happened in my case.

I wish Linux actually thawed processes instead of trying to give every a fair share, and thus ending up in an OOM situation. But anyways, having become good at predicting Linux's behavior, I decided to not touch the laptop at all. Left it as it is over night thinking it would eventually trigger OOM and the prime candidate would be Handbrake. And once Handbrake is killed, everything would recover.

In the morning, every thing was back to normal. The HDD was idle and showed no more signs of the paging abuse the kernel did last night. The only evidence was syslog which did impress me for my predictability of Linux's OOM. The kernel did trigger OOM and just kill the most abusive (CPU intensive) process, Handbrake, and everything else had recovered to normal.


Well. All good. I did not have to reboot my laptop. So just hibernated and pushed to work.


Why FAT32? Is that the best?

My beautiful Playstation 3, with which I like to share some of the files, does not understand anything else apart from FAT32.

So back to home, plugged-in the External HDD and........... sigh!!! Does not detect.

Plugged it into my laptop ...... No KDE automount...

Something wrong....

00:47:32 rrs@champaran:/tmp$ sudo dosfsck /dev/sdb1
dosfsck 3.0.9, 31 Jan 2010, FAT32, LFN
Logical sector size is zero.


I wonder why does a file system have to get corrupted for extensive I/O on it..



The Recovery..

Done is done. Having run into similar problems before, I looked back at testdisk.

It started off with a disappointment stating that the file system was damaged.


Luckily, doing an advanced mode lookup did show some hope. 


And doing a listing further yielded that the boot sector was available.


Which when rebuilt, allowed me access to the partition.


For some reason, the [undelete] option listed no data. It reported that there was no data available.

Selecting the [Boot] option listed down all my files, which I quickly copied over to my other External USB HDD with a btrfs file system ;-)


Testdisk has twice turned out to be my favorite data recovery tool from b0rken file systems.




Ritesh Raj Sarraf's picture


Wrestling (WWE) is entertaining. The way the ww[ef] superstars (Especially the ones like Undertaker, Triple H) are presented is fun to watch. Or the kind of high flying maveuveurs the wwf superstars are able to perform, it really is super cool. The only catch is - it is not a sport. The feuds are all pre-defined to juicen things up.

I recently came to know of UFC. I hope some day they start airing it in my part of the world. I'm still getting acquianted to MMA, but it really is an awesome sport. This is one forum which does show size does not matter. Was watching Royce Gracie's matches from UFC 4. Awesome matches clearly showing the skill with which one can beat any size or power. The final was in between a pro-jiu jitsu vs pro-wrestler. Gracie won it but was given a tough fight by the wrestler.

That brings me to EA Sports MMA

I downloaded this demo some time back but never played it. Only after the recent interest in MMA I looked back at this demo. The demo was good enought to convince for the full version. The gameplay primarily comes in 2 modes:  1 x 1 fighter mode and a Career Mode.

If you start with the 1x1 fighter mode, you'll very soon be beaten out. Just like The Fight, this game does need some practising and getting a hang of the game controls. Uncommon - Attacks are triggered by the R1 key, with L3 as the modifier for kicks.

In career mode, you can create your own custom character and start from scratch to becoming a fighter. You start off with the basics, learn the standards tactics on how to Clinch, Take Down, Block and Submit your opponent. With these skills learnt, the game starts to becoming a real fun. But the real gem about the game is in the Stamina. The developers ensured that this is not just another "who's the better button masher" game. You need to be careful to not run out of stamina. The stamina is the biggest key to winning in this game, just like in real life fighting. If you run out of stamina, you can't even submit your opponent even if you have a full body mount. To beat down the tough fighters you will need to master the key combinations with great speed. Be fast enough to Jab + Jab + Hook + Side Kick, all of this with minimal stamina spent.


Overall, a great game to have if you like Mixed Martial Arts.




Ritesh Raj Sarraf's picture

Console Gaming - Sony Playstation 3

I have been thinking of this topic for some time. I am a happy owner of the old Phat PS3 Model. At one time, I use to do a fair amount of gaming on my computers. So when Sony marketed the PlayStation 3 product, it was cool to see a machine that did:

  1. Gaming
  2. Movies, Music, Pictures
  3. Blu-Ray
  4. Ran Linux

I convinced myself to buy a PlayStation 3, that I'd use it for playing with Linux apart from gaming. The regular gaming did not excite any more, perhaps it had to do with the limitation of time. On running Debian on it, was when I realized that the Linux support was merely a joke. The Linux support included running a Linux distribution in a VM with not much access to the full hardware resources. Not a Great Experience

Soon, as many would be aware, Sony did the meanest thing. They pulled off the Linux support citing security concerns. To ensure further updates, most users were left with no choice but to update the firmware. This was Not A Good Thing as they had advertised the Linux feature during marketing of the product. Losing the Linux support made the PlayStation pile up more dust, as I am an occasional gamer.

But then came the good thing. Sony announced the PlayStation Move product, its answer to the Motion Gaming. This is the best thing they did and they did it good. The PS Move product was well priced and is an awesome product. The level of precision in the PS Move is told to be the best by most of the reviewers that I follow.

The 2 games that make the PS Move shine are Sports Champions and The Fight.

The Sports Champions demo came bundled with the PS Move kit. The disc houses 5 - 6 games on it of which Table Tennis, Sword Fight and Archery are very good.

Sports Champions

The good part about these games is that they start off with easy levels but eventually (the Champions Cup) get tougher. Playing the Champions Cup level is going to be both, Fun and Tiring. It is surprising that this game was given just a 7.5 rating, I think it deserves a 10/10 Cool The folks at Zindagi Games did an awesome job.



The Fight started off with a different impression. First of all, Sony did not push a demo for this game on the PlayStation Network. Even with low ratings, I took the plunge to buy the game. The game was not responsive. It wouldn't react to the moves I made physically and that'd lead to the opponent beating me. Game development rules are very simple: Don't make a game which people can't win, you'll lose your gamers. Also don't make a game which is just too easy to win, you'll still lose your gamers. A good example is the Prince of Persia game. Was disappointed with The Fight until I read this well done review by Pace J Miller.

The Fight

Both Sony and Coldwood Interactive did a bad job in marketing this game. I think Sony should pay Pace for doing the right review. The Fight is a good game. It expects the user to train in the system. A user cannot just walk-in into the game and start beating the opponents. The Fight forces the users to earn points (which can be used to improve health, stamina and fighting skills) before they can be a fighter fit enough for fighting the in-game opponents. Points are earned through sparring sessions and working out in the gym.

I am glad I bought The Fight. After reading Pace's review, I have been thoroughly enjoying this game. It is a great game and at the same time a very great way to get away from lethargy. Be prepared to sweat like hell when playing The Fight

Despite all the debacle Sony went through (1. pulling off the Linux support 2. PS3 Compromised 3. PSN Compromised), they still have the best product in the market for the Motion Gaming experience




Ritesh Raj Sarraf's picture

Fibre Channel over Ethernet - FCoE

With the final package, fcoe-utils, clearing the NEW packages queue, the Open-FCoE project's Fibre Channel over Ethernet stack is now in the Debian archive. I had anticipated to have access to FCoE hardware by the time the packaging would complete but that didn't work out. It has been delayed, hence the packages are in experimental. If you have access to FCoE hardware, please test and provide your feedback.





Subscribe to RSS - RHUT