Unable to lock the list directory

Asked by shekhar

Hi

My already slow internet connection went two slow after i made a failed attempt to download and install google earth.
Just to check what was wrong I did:
shekhar@shekhar-laptop:~$ apt-get update --fix-missing
E: Could not open lock file /var/lib/apt/lists/lock - open (13 Permission denied)
E: Unable to lock the list directory

I tried the following to repair this:

sudo dpkg clear-avail

sudo dpkg --configure -a
sudo apt-get -f install
sudo apt-get --fix-missing install
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get clean
sudo apt-get autoremove

sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-old

sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status-old and then try to update / upgrade.

None solved the issue to my surprise!!!

Please help.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu update-manager Edit question
Assignee:
No assignee Edit question
Solved by:
Soul-Sing
Solved:
Last query:
Last reply:
Revision history for this message
shekhar (shekhar-sharmaa) said :
#1

Something is running in the background and is connecting to the Internet.Please help me salvage it.

Revision history for this message
shekhar (shekhar-sharmaa) said :
#2

shekhar@shekhar-laptop:~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-old
mv: cannot stat `/var/lib/dpkg/status': No such file or directory

shekhar@shekhar-laptop:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status-old
cp: `/var/lib/dpkg/status-old' and `/var/lib/dpkg/status-old' are the same file

Revision history for this message
anonymous1 (anonymous1-deactivatedaccount) said :
#3

"sudo apt-get update"

Revision history for this message
shekhar (shekhar-sharmaa) said :
#4

That did not help either.

Revision history for this message
shekhar (shekhar-sharmaa) said :
#5

E: Could not open file /var/lib/dpkg/status - open (2 No such file or directory)
E: The package lists or status file could not be parsed or opened.
E: _cache->open() failed, please report.

Revision history for this message
Soul-Sing (soulzing) said :
#6

That happens when synaptic or another package update / installation application is already running. Close any other package managers (including Add/Remove application, language pack installer, etc.) and retry.

sudo rm /var/lib/dpkg/lock
sudo apt-get update

if this doesn't work:

sudo killall apt-get

Revision history for this message
shekhar (shekhar-sharmaa) said :
#7

Unfortunately, Of No help.

shekhar@shekhar-laptop:~$ sudo killall apt-get
apt-get: no process killed

Revision history for this message
Soul-Sing (soulzing) said :
#8

please: sudo rm /var/lib/dpkg/lock
sudo apt-get update

Revision history for this message
shekhar (shekhar-sharmaa) said :
#9

As mentioned,Of no use again.
Output
shekhar@shekhar-laptop:~$ sudo rm /var/lib/dpkg/lock
[sudo] password for shekhar:
shekhar@shekhar-laptop:~$

Revision history for this message
shekhar (shekhar-sharmaa) said :
#10

The update works well but the the problem stays on.Even I am surprised why is it happening.And yes, Merry Christmas and Happy New Year.

Revision history for this message
Soul-Sing (soulzing) said :
#11

try uninstall googleearth: sudo dpkg --remove --force-remove-reinstreq googleearth
if you are/were stuck in the license part of the install process in this the way to remove googleearth.
and prob. a working -apt.

Revision history for this message
shekhar (shekhar-sharmaa) said :
#12

shekhar@shekhar-laptop:~$ sudo dpkg --remove --force-remove-reinstreq googleearth
[sudo] password for shekhar:
dpkg: failed to open package info file `/var/lib/dpkg/status' for reading: No such file or directory

Synaptic fails to start.Notification says:

Could not initialize the package information

An unresolvable problem occurred while initializing the package information.

Please report this bug against the 'update-manager' package and include the following error message:

'E:Could not open file /var/lib/dpkg/status - open (2 No such file or directory), E:The package lists or status file could not be parsed or opened.'

Revision history for this message
shekhar (shekhar-sharmaa) said :
#13

shekhar@shekhar-laptop:~$ sudo dpkg --remove --force-remove-reinstreq googleearth
[sudo] password for shekhar:
dpkg: failed to open package info file `/var/lib/dpkg/status' for reading: No such file or directory

sudo apt-get install update && sudo apt-get install upgrade works from terminal BUT
Synaptic fails to start.Notification says:

Could not initialize the package information

An unresolvable problem occurred while initializing the package information.

Please report this bug against the 'update-manager' package and include the following error message:

'E:Could not open file /var/lib/dpkg/status - open (2 No such file or directory), E:The package lists or status file could not be parsed or opened.'

Revision history for this message
shekhar (shekhar-sharmaa) said :
#14

Also
shekhar@shekhar-laptop:~$ sudo dpkg --purge -a
dpkg: failed to open package info file `/var/lib/dpkg/status' for reading: No such file or directory
shekhar@shekhar-laptop:~$ sudo apt-get autoremove
Reading package lists... Error!
E: Could not open file /var/lib/dpkg/status - open (2 No such file or directory)
E: The package lists or status file could not be parsed or opened.

Revision history for this message
Best Soul-Sing (soulzing) said :
#15

sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status

Revision history for this message
Soul-Sing (soulzing) said :
#16

or sudo apt-get install synaptic

Revision history for this message
shekhar (shekhar-sharmaa) said :
#17

Hey Leoquant
Worked like a charm for me!! Thanks a lot!!! Really appreciate it.I am new to Ubuntu.This support has encouraged me to go ahead with this great OS.

Revision history for this message
shekhar (shekhar-sharmaa) said :
#18

Thanks leoquant, that solved my question.

Revision history for this message
Cazacu Bogdan (cazacub) said :
#19

hey guys...tried that solution to but no luck form me :((

here's the output from the terminal... :(

---------------------------------------------------------------------
bogo@Prometeus-U:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status

bogo@Prometeus-U:~$ ping google.com

PING google.com (74.125.43.99) 56(84) bytes of data.
64 bytes from bw-in-f99.1e100.net
(74.125.43.99): icmp_seq=1 ttl=54 time=37.8 ms
64 bytes from bw-in-f99.1e100.net
(74.125.43.99): icmp_seq=2 ttl=54 time=38.2 ms
64 bytes from bw-in-f99.1e100.net
(74.125.43.99): icmp_seq=3 ttl=54 time=38.0 ms
64 bytes from bw-in-f99.1e100.net
(74.125.43.99): icmp_seq=4 ttl=54 time=38.4 ms

^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 37.883/38.171/38.480/0.217 ms

bogo@Prometeus-U:~$ sudo apt-get install synaptic

Reading package lists... Done

Building dependency tree

Reading state information... Done

synaptic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

bogo@Prometeus-U:~$ sudo apt-get update --fix-missing

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)

E: Unable to lock the list directory

bogo@Prometeus-U:~$ sudo dpkg clear-avail
dpkg: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;

Type dpkg -Dhelp for a list of dpkg debug flag values;

Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Type dpkg --license for copyright license and lack of warranty (GNU GPL) [*].

Options marked [*] produce a lot of output - pipe it through `less' or `more' !
bogo@Prometeus-U:~$ sudo dpkg --configure -a

bogo@Prometeus-U:~$ sudo apt-get -f install

Reading package lists... Done

Building dependency tree

Reading state information... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

bogo@Prometeus-U:~$ sudo apt-get --fix-missing install

Reading package lists... Done

Building dependency tree

Reading state information... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

bogo@Prometeus-U:~$ sudo apt-get clean

bogo@Prometeus-U:~$ sudo apt-get update

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)

E: Unable to lock the list directory

bogo@Prometeus-U:~$ sudo apt-get upgrade

Reading package lists... Done

Building dependency tree

Reading state information... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

bogo@Prometeus-U:~$ sudo apt-get dist-upgrade

Reading package lists... Done

Building dependency tree

Reading state information... Done

Calculating upgrade... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

bogo@Prometeus-U:~$ sudo apt-get clean

bogo@Prometeus-U:~$ sudo apt-get autoremove

Reading package lists... Done

Building dependency tree

Reading state information... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

bogo@Prometeus-U:~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-old

bogo@Prometeus-U:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status-old
cp: `/var/lib/dpkg/status-old' and `/var/lib/dpkg/status-old' are the same file
bogo@Prometeus-U:~$ sudo apt-get update

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)

E: Unable to lock the list directory

bogo@Prometeus-U:~$
-------------------------------------

Revision history for this message
Pagadala Rajesh (pagadalarajesh) said :
#20

sudo rm /var/lib/apt/lists/lock will help u try this.