How to overcome emerge lock file hindrance

In this article I will show how you can overcome some hindrance pose by the Gentoo package manager emerge. I was recently trying get latest stable firefox from the repo and got this lock file error to fetch it.
Say you are emerging a package and all of sudden due to various reason it has interrupted. Now next time you try to emerge the same piece of software and you get a line saying ” waiting for the the lock file.…” and wait infinitum.

Now what was the cause off it? As it was interrupted previously,so it cannot go and do the emerging.It is good feature built into emerge.So it gives indication that something going wrong.What would be the first action?to delete the file as the path will be clearly shown by the package manager.If you delete that file and re-emerge that software you get same error.Because it is not fulfilling the package manager requirements.

So you need to do the below thing at the terminal:

bhaskar@bhaskar-laptop_23:33:26_Tue Feb 08:~> sudo emerge -f packagename

Yep! you got it right ;that “-f” stand for “fetch“,means it will re-fetch it from the repo,but from the place where it was interrupted. Clear??

Here is clue straight out of the emerge manual and it says,

-fetchonly (-f)
Instead of doing any package building, just perform fetches for all packages (fetch things from SRC_URI based upon USE setting).

Now before that you need to check whether two emerge are trying to run concurrently..if not then go and remove /var/tmp/portage,which probably preventing you from fetching.Once you are done with clean up the mentioned dir then run the above mentioned command will fetch thing normally.

Hope this will help.




About unixbhaskar
GNU/Linux Consultant

5 Responses to How to overcome emerge lock file hindrance

  1. Pingback: Links 9/2/2011: Members Choice Award, GNOME 2.91.6, Linux 2.6.38 RC4 | Techrights

  2. This information really helped me, I am sharing with a few friends.

  3. stop snoring says:

    I must say you have a cool post. This hit the spot and then some! Thanks for posting this and sharing it with the world. I’ve just bookmarked your site. And I will check back soon to read your other articles. Keep up your awesome work.

  4. rking says:

    Though it’s probably OK to do a remove of the full /var/tmp/portage/ dir, as instructed above, a more precise way is to simply remove the specific lockfile.

    E.g., I was stuck on dev-libs and my fix was to sudo rm /var/tmp/portage/.dev-libs.portage_lockfile

  5. rking says:

    Crud. So sloppy of me. I was wrong about that.

    I don’t fully understand it, but I was mistaken — a full rm -r /var/tmp/portage was indeed necessary to get my emerge unstuck.

    unixbhaskar: Please delete the previous comment and this one. (Or leave them both in. Either way, as long as my misinformation isn’t let to stand, I’ll sleep better tonight.)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: