views:

28

answers:

3

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?

+1  A: 

chroot /mnt/partition1

Paulo Scardine
+1  A: 

Running chroot /mnt/partition1 will start a new shell in which the root of the filesystem is /mnt/partition1. Assuming the apt-get on your hard drive still works correctly, you can proceed from there.

dpkg --root=/mnt/partition1 -i mypackage.deb is an option that doesn't require chroot, but does require you to download the package yourself.

Jander
+2  A: 

Also this should work:

sudo apt-get -o Dir=/media/partitioni1 update
enzotib
+1 for finding the `apt-get` solution that I missed!
Jander