升级系统到ubuntun到18.04后apt-get执行失败

系统升级到18.04后执行apt-get install的时候报错前端

root@zhf-maple:/home/zhf/桌面# apt-get install vim-scipts
E: 没法得到锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: 没法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其余进程正占用它?vim

这是由于升级后某些软件包还在占用apt资源,经过ps -aux | grep apt  查看哪些在占用apt进程,下面红色标红的这些都是在占用apt的进程frontend

root 5394 0.0 0.0 4628 772 ? Ss 14:36 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily installspa

root 5405 0.0 0.0 4628 1660 ? S 14:36 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held install进程

root 11471 0.0 0.0 55624 7128 pts/1 S+ 14:39 0:00 /usr/lib/apt/apt-helper download-file http://archive.canonical.com/pool/partner/a/adobe-flashplugin/adobe-flashplugin_20190409.1.orig.tar.gz /var/lib/update-notifier/package-data-downloads/partial/adobe-flashplugin_20190409.1.orig.tar.gz SHA256:b3ceaad9bfe610f0c6ea847b80a6cd3b6e5071c41efccc8974ea58d0e040fc9cip

_apt 11473 0.2 0.1 83828 9100 pts/1 S+ 14:39 0:01 /usr/lib/apt/methods/httpci

root 11564 0.0 0.0 55592 7184 ? S 14:39 0:00 /usr/lib/apt/apt-helper download-file http://archive.canonical.com/pool/partner/a/adobe-flashplugin/adobe-flashplugin_20190409.1.orig.tar.gz /var/lib/update-notifier/package-data-downloads/partial/adobe-flashplugin_20190409.1.orig.tar.gz SHA256:b3ceaad9bfe610f0c6ea847b80a6cd3b6e5071c41efccc8974ea58d0e040fc9c资源

_apt 11566 0.1 0.1 83828 9096 ? S 14:39 0:01 /usr/lib/apt/methods/httpget

root 12482 0.0 0.0 16180 1064 pts/2 S+ 14:52 0:00 grep --color=auto aptflash

 

执行kill命令杀掉这些进程

kill -9 5394

kill -9 5405

kill -9 11471

kill -9 11564

kill -9 11566

而后执行:

rm /var/cache/apt/archives/lock

 

 

rm /var/lib/dpkg/lock

 

 这样就能顺利执行apt-get install的命令了 

相关文章
相关标签/搜索