Troubleshoot Problems with apt


Troubleshoot Problems with apt

Of course, as great as apt is, you might run into problems. Here are some problems and their workarounds.

One simple problem that will result in a smack to your own forehead is the "Could not open lock file" error. You'll try to run apt-get, but instead of working, you get this error message:

E: Could not open lock file /var/lib/dpkg/lock -  open (13 Permission denied) E: Unable to lock the administration directory  (/var/lib/dpkg/), are you root? 


The solution to this issue is right there in the second line: You're not logged in as root! Simply log in as root and try again, and everything should work.

Note

If you're running K/Ubuntu, or any other distribution that uses sudo instead of root, the error means that you didn't preface the command with sudo. In other words, you ran this:

$ apt-get upgrade 


You're seeing the error message because you should have run this instead:

$ sudo apt-get upgrade 



The next common issue occurs when apt complains about broken dependencies. You'll know this one's happening when apt encourages you to run apt-get -f install. This suggestion is the program's way of telling you that your system has some broken dependencies that prevent apt from finishing its job.

There are a couple of possible solutions. You can follow apt's advice, and run apt-get -f install, which tries to fix the problem by downloading and installing the necessary packages. Normally, this solves the problem, and you can move on.

If you don't want to do that, you can instead try running apt-get -f remove, which tries to fix the problem by removing packages that apt deems troublesome. These might sound like potentially dangerous steps to takeand they could be if you don't pay attentionbut each option gives you the chance to review any proposed changes and give your assent. Just be sure to examine apt's proposals before saying yes.

Finally, apt might warn you that some packages "have been kept back." This warning tells you that apt has found a conflict between the requested package or one of its dependencies and another package already installed on your system. To resolve the issue, try to install the package that was kept back with the -u option, which gives you information about exactly what needs to be upgraded.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net