Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-26-2016, 02:55 AM   #16
LQ Newbie
Registered: Oct 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled

Originally Posted by Jjanel View Post
lsof /var/lib/apt/lists/lock
pgrep apt (oh, you said none running)
ls -l /var/lib/apt/lists/lock
what does this code do ??

does it purge apt's
Old 10-26-2016, 03:02 AM   #17
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
No, it's 'safe': it only does `ls` & ps...grep (you can check with `man` or web-searches)

That link mentions `rm...lock` which sounds fairly safe, but I don't know about the
sudo dpkg --configure -a (seems safe from reading `man dpkg` but may still 'hit' that lock)

sudo ls -l /var/lib/apt/lists/partial (to see what if any might be relevant)
Also, Post [a `cat` of] /etc/apt/sources.list.d/official-package-repositories.list

That link links to this, which mentions a 'race condition': "apt overlaps with update-manager automatically ..." but I don't know the `ps` name of UpdMgr... yes, pkg mgmt is complex... tons for me to research&learn... cache? Also, maybe post: sudo ls -lR /var/cache/apt

This displayed the lock filenames for me:
sudo strace -f -o zzz apt update; grep /lock zzz
(later, rm zzz) From all this, I'm guessing it is safe to `sudo rm` the lock file(s).
I did `rm` mine, and `apt update` still worked after I tried:
sudo rm /var/lib/apt/lists/lock /var/lib/dpkg/lock

I welcome replys from 'more-senior' LQ'ers here....

Last edited by Jjanel; 10-26-2016 at 02:27 PM.
Old 10-26-2016, 02:53 PM   #18
LQ Addict
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
ok, i didn't follow what jjanel suggested meanwhile, but...

Originally Posted by bengaminrdx View Post
i got this as a response
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
i saw this recently on a ubuntu system after a borked upgrade, and it fixed the system!

so, the good news: you are connected to the internet, and your system seems to be somewhat working.

the bad news:
your package management is messed up somehow.

please run
sudo dpkg --configure -a
in a terminal.
it will probably take a looooong time; 15min, 30min, who knows.

then make a FULL reboot.

then try the usual updates and upgrades.

if it still doesn't work, go back to post #3 and do what i asked.
Old 10-28-2016, 12:13 AM   #19
LQ Newbie
Registered: Oct 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
alright nothings working

how do i restore the system
Old 10-28-2016, 03:40 AM   #20
Senior Member
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
Originally Posted by bengaminrdx View Post
what does this code do ??

does it purge apt's
Bonus points to you just for asking. Always good habit to know whhat you're doing.

Ok, now, I have helped many who have broken apt (probably 7 of the 11 pages in my "subscribed threads"), and there becomes a point where you just have to fix it by forc, but before we do...

Now, I noticed you didn't try ondoho's suggestion. Try that first:

dpkg --configure -a
If any package was not fully installed and configured, this will fix that, if possible.

If it can't, it should tell you which package failed, and why it failed. You'll want to reinstall the package causing the problem, which may not be the package that's failing to install properly (note to self: I really should keep a bunch of error snippets handy for these cases). It may be a missing or broken dependency. Read dpkg's output carefully, and if unsure, post the output here.

[edit]I hesitate to mention this now, because you really want to fix this the right way. However, I don't know how impatient you are. Proceed past this point at your own risk.[/edit]


If all of the above does not work, we can start to open up APT by force, make a backup of APT's stuff first:

cp -arf /var/lib/dpkg /var/lib/dpkg.backup
then remove the lock files (if you get an error any particular file doesn't exist, that's fine, we just want to be sure any possible lock file is removed):

After removing those files, run
apt-get update

Hopefully now you should be up and running.

Last edited by goumba; 10-28-2016 at 03:41 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables - Reply Forwarding Error / Destination unreachable (Host unreachable) keflex87 Linux - Networking 1 05-12-2015 12:03 AM
Software Sources randolindso0 Linux - Newbie 2 01-04-2014 08:08 AM
[SOLVED] Snort Signature: ICMP Destination Unreachable Port Unreachable very noisy mhollis Linux - Security 4 08-15-2011 02:01 PM
8.04 software sources oversword Linux - Software 1 05-13-2008 01:27 PM
Software Sources Manager, how to add installation cd sources after deletion Lakota Mandriva 1 10-23-2003 12:39 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration