Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ext2 partition on CF card to use in external device. I've inserted this card into my PC and mount it as /mnt/linux. I've installed (extracted) a linux distribution to this partition. And I want to add some .deb packages to this partition. How should I do this? Is it possible?

The alternative way I use: I copy .deb packages into /mnt/linux/tmp dir, then insert CF card into external device, and install cd /tmp; dpkg -i XXX.deb from this device.

share|improve this question
Do a chroot /mnt/linux and instal there? (Would need the deb machinery in there, perhaps mounted from the outside). This more or less assumes you have a full Debian installtion in there. – vonbrand May 2 '13 at 11:01
up vote 1 down vote accepted

As vonbrand suggested, assuming you have a working Debian install on the CF card, you should be able to chroot to it and install normally:

sudo chroot /mnt/linux
sudo dpkg -i XXX.deb 
share|improve this answer
This is the command I'm looking for. Thank you. – egor7 May 2 '13 at 14:37
But how can I change the base_os archive, without mounting CF card? I have a base os for CF-card in base_os.tgz file, then I put it into mounted (in /mnt/linux) CF-card via tar zxvf base_os.tgz -C /mnt/linux. – egor7 May 2 '13 at 14:42
Not sure what you mean, for the chroot to work, you need to chroot to a directory that contains a working Linux system (things like /bin/bash etc). – terdon May 2 '13 at 14:44

You can use the --root option of dpkg to specify the directory where the target root filesystem is mounted.

In your case:

sudo dpkg --install --root=/mnt/linux XXX.deb

I've found that this invocation may produce the following error (not sure if this is a dpkg bug, or something related to the filesystem I'm using):

dpkg: error: unable to access dpkg status area: No such file or directory

The workaround is to use the --admindir option to specify the var/lib/dpkg. In your case:

sudo dpkg --install --root=/mnt/linux --admindir=/mnt/linux/var/lib/dpkg XXX.deb

This solution helps if you are building the filesystem and you cannot perform a chroot because the target filesystem is incomplete.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.