最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

solve the error : Could not open lock file /var/lib/apt/lists/lock

工作和技术 crifan 1648浏览 0评论

Now,I’m in Ubuntu enviremennt and can’t input Chinese.
So following in English.

Yestoday ,I encount an problem:
When I want to install bulid-essential onto Ubuntu.
so input :
sudo apt-get install build-essential

but come out error,sth. like this (but not is this ,just very the same):

E: Could not open lock file /var/lib/apt/lists/lock - open (13 Permission denied)<br />     E: Unable to lock the  directory , are you root?

http://www.debian.org/doc/manuals/apt-howto/ch-erros.zh-cn.html

that mean,the lock file may be use by others in the same time .so I restart the Ubuntu
but there is still the same error when I input above command.

……..
Eventually I found there is a "X" above the lock file in
/var/lib/apt/lists/
may be It’s mean the lock file is be
damaged.So I try to delete the lock:
sudo rm -d /var/lib/apt/lists/lock

then :
sudo apt-get install build-essential
now,It’s OK .
But You should to find a good source to download the file .
you can find a good source in :
http://wiki.ubuntu.org.cn/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%88%91%E4%BB%AC%E6%8E%A8%E8%8D%90%E7%9A%84%E6%BA%90#Feisty_.287.04.29_.E7.89.88.E6.9C.AC

Feisty (7.04) 版本

sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup<br />sudo gedit /etc/apt/sources.list
  • 用以下内容替换文件中的所有内容
deb http://archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse<br />deb http://archive.ubuntu.com/ubuntu/ feisty-security main restricted universe multiverse<br />deb http://archive.ubuntu.com/ubuntu/ feisty-updates main restricted universe multiverse<br />deb http://archive.ubuntu.com/ubuntu/ feisty-backports main restricted universe multiverse<br />deb http://archive.ubuntu.com/ubuntu/ feisty-proposed main restricted universe multiverse<br />deb http://ubuntu.cn99.com/ubuntu-cn/ feisty main restricted universe multiverse

这里你也可以直接使用更快速的ubuntu.cn99.com的源(推荐):

<p>deb http://ubuntu.cn99.com/ubuntu/ feisty main restricted universe multiverse<br />deb http://ubuntu.cn99.com/ubuntu/ feisty-security main restricted universe multiverse<br />deb http://ubuntu.cn99.com/ubuntu/ feisty-updates main restricted universe multiverse<br />deb http://ubuntu.cn99.com/ubuntu/ feisty-backports main restricted universe multiverse<br />deb http://ubuntu.cn99.com/ubuntu/ feisty-proposed main restricted universe multiverse<br />deb http://ubuntu.cn99.com/ubuntu-cn/ feisty main restricted universe multiverse</p>

这里你还可以使用速度也非常快的的mirror.lupaworld.com的源:

<p>deb http://mirror.lupaworld.com/ubuntu/archive/ feisty main restricted universe multiverse<br />deb http://mirror.lupaworld.com/ubuntu/archive/ feisty-security main restricted universe multiverse<br />deb http://mirror.lupaworld.com/ubuntu/archive/ feisty-updates main restricted universe multiverse<br />deb http://mirror.lupaworld.com/ubuntu/archive/ feisty-backports main restricted universe multiverse<br />deb http://mirror.lupaworld.com/ubuntu/archive/ feisty-proposed main restricted universe multiverse<br />deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ feisty main restricted universe multiverse</p>

如果是教育网用户请使用上海交通大学的源:

<p>deb http://ftp.sjtu.edu.cn/ubuntu/ feisty main multiverse restricted universe<br />deb http://ftp.sjtu.edu.cn/ubuntu/ feisty-security main multiverse restricted universe<br />deb http://ftp.sjtu.edu.cn/ubuntu/ feisty-updates main multiverse restricted universe<br />deb http://ftp.sjtu.edu.cn/ubuntu/ feisty-backports main multiverse restricted universe<br />deb http://ftp.sjtu.edu.cn/ubuntu/ feisty-proposed main multiverse restricted universe<br />deb http://ftp.sjtu.edu.cn/ubuntu-cn/ feisty main multiverse restricted universe bleeding</p>

上海电信的一个源:

<p>deb http://mirror.rootguide.org/ubuntu/ feisty main restricted universe multiverse<br />deb http://mirror.rootguide.org/ubuntu/ feisty-proposed main restricted universe multiverse<br />deb http://mirror.rootguide.org/ubuntu/ feisty-updates main restricted universe multiverse<br />deb http://mirror.rootguide.org/ubuntu/ feisty-backports main restricted universe multiverse<br />deb http://mirror.rootguide.org/ubuntu/ feisty-security main restricted universe multiverse<br />deb http://mirror.rootguide.org/ubuntu-cn/ feisty main restricted universe multiverse</p>
  • 保存编辑好的文件
sudo apt-get update

转载请注明:在路上 » solve the error : Could not open lock file /var/lib/apt/lists/lock

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
79 queries in 0.175 seconds, using 22.11MB memory