linux安装软件问题解决(E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission de)

a.今天linux安装程序过程中,遇到了锁《1》,百度后知道这是linux用户经常碰到的事情,真是百度一下你就知道呀!故总结如下。

因为每次安装软件的时候,系统会标记一个值,这就是加锁,当软件安装完成或者正常推出,才会解锁。

假设用户更新系统,更新到一半突然断电死机,那么这个锁没有解除,下次无法直接安装软件,会出现如图所示的提示

linux安装软件问题解决(E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission de)_第1张图片

解决方法:

1.使用超级用户

sudo apt-get...

(1)su切换root用户时出现问题(没设置root初始密码)

sudo passwd root

后依次输入密码即可

su回车

2.删除lock锁

sudo rm -rf /var/lib/dpkg/lock

sudo rm -rf /var/cache/apt/archives/lock

b.执行完之后发现还是不行,出现了如下代码提示《2》

E: Unable to locate package        (无法下载)

于是需要升级apt-get工具

sudo apt-get update

...

sudo apt-get upgrade

....

下载慢吞吞,的

c.于是,发现网络正常连接但是网速非常慢的问题,简直慢到了极点!所以问了朋友得知需要换源,于是又百度了一下ubuntu换源《3》如下

1、修改source.list,最好先备份一份

软件源的地址配置文件在 /etc/apt/sources.list

备份

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old

2、打开source.list

可以用vim,gedit,atom等工具

建议

sudo gedit /etc/apt/sources.list

然后crl c

东北大学

#deb-src http://mirror.neu.edu.cn/ubuntu/ xenial main restricted #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security multiverse

清华大学

#deb-src http://mirror.neu.edu.cn/ubuntu/ xenial main restricted #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security multiverse

阿里云

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

然后

crl  v

crl s 保存

crl w 关闭

成功换源。

或者,还可以

linux安装软件问题解决(E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission de)_第2张图片

最后,更新 apt-get

的update与upgrade

sudo apt-get update

...

sudo apt-get upgrade

....

可以正常下载安装

问题解决

你可能感兴趣的:(linux)