Running apt-get for another partition/directory?

Avall picture Avall · Oct 17, 2010 · Viewed 25.4k times · Source

I have booted my system from a live Ubuntu CD, and I need to fix some package problems. I have mounted my hard drive, and now I want to run apt-get as if I booted normally. ie change the working directory for apt-get so it will work on my hard drive. I have done this before, but I can't remember the syntax. I think it was only some flag, like this:

apt-get --root-directory=/mnt/partition1 install....

But I only get "Command line option...is not understood". Any ideas?

Answer

enzotib picture enzotib · Oct 17, 2010

Also this should work:

sudo apt-get -o Dir=/media/partitioni1 update