E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
一周前安装 rabbitMQ 时,上来就遇到错误E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using
总结:
20211123 ,又一次遇到这个错误之后,总结了一下
应该直接一个命令定位错误
$ sudo dpkg --configure -a
删除每次找到的错误文件
重新来过,直到没有错误!
之前操作的记忆步骤
一周前安装 rabbitMQ 时,上来就遇到错误
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
以下是记忆中使用过的办法,现记录一下,下次遇到再整理
-
以前遇到过,一般直接删除 lock 文件即可
$ sudo rm /var/lib/apt/lists/lock
$ sudo apt update
就好了 -
这次多折腾了几回合,大概有以下几条处理办法
$ sudo rm /var/cache/apt/archives/lock
$ lsof /var/lib/dpkg/lock
$ sudo rm /var/lib/dpkg/lock
如果是E: Some packages could not be authenticated错误:
sudo apt-get update 即可 -
但是
$ sudo apt-get update
又出现以下错误E: dpkg was interrupted, you must manually run ‘sudo dpkg --configure -a’ to correct the problem.
-
按照提示
$ sudo dpkg --configure -adpkg: error: parsing file '/var/lib/dpkg/updates/0001' near line 0: newline in field name '#padding'
-
直接删除这个文件
$ sudo rm /var/lib/dpkg/updates/0001 -
然后再来 install,结果还报错!
$ sudo apt-get install curl gnupg apt-transport-https -yE: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
-
再执行一次
$ sudo dpkg --configure -a
没有提示了! -
现在可以正常 install 了!
$ sudo apt-get install curl gnupg apt-transport-https -y
又一次遇到后的处理过程
前几天练习忘记 root 密码的虚拟机,今天拿来安装 php-fpm ,又见到了熟悉而讨厌的错误
这次现场记录一下过程!
-
先按照之前的记录操作一遍
$ sudo rm /var/lib/apt/lists/lock
$ sudo apt update
$ sudo rm /var/cache/apt/archives/lock
$ lsof /var/lib/dpkg/lock
$ sudo rm /var/lib/dpkg/lock -
再来安装依然报错
$ sudo apt install php-fpmE: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
$ lsof /var/lib/dpkg/
没有什么程序占用 dpkg$ sudo rm /var/lib/dpkg/lock
-
按照提示操作
$ sudo dpkg --configure -aSetting up linux-image-4.15.0-158-generic (4.15.0-158.166) …
Processing triggers for linux-image-4.15.0-158-generic (4.15.0-158.166) …
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-158-generic
/etc/kernel/postinst.d/x-grub-legacy-ec2:
Searching for GRUB installation directory … found: /boot/grub
Searching for default file … found: /boot/grub/default
Testing for an existing GRUB menu.lst file … found: /boot/grub/menu.lst
Searching for splash image … none found, skipping …
Found kernel: /boot/vmlinuz-4.15.0-158-generic
Found kernel: /boot/vmlinuz-4.15.0-154-generic
Found kernel: /boot/vmlinuz-4.15.0-123-generic
dpkg-query: error: parsing file ‘/var/lib/dpkg/updates/0026’ near line 0:
newline in field name ‘#padding’
run-parts: /etc/kernel/postinst.d/x-grub-legacy-ec2 exited with return code 10
dpkg: error processing package linux-image-4.15.0-158-generic (–configure):
installed linux-image-4.15.0-158-generic package post-installation script subprocess returned error exit status 1
dpkg: error: failed to remove my own update file /var/lib/dpkg/updates/0000: No such file or directory注意提示中的以下信息
dpkg-query: error: parsing file ‘/var/lib/dpkg/updates/0026’ near line 0:
newline in field name ‘#padding’删除他之后再来!
$ sudo rm /var/lib/dpkg/updates/0026 -
再次操作
$ sudo dpkg --configure -aSetting up linux-image-4.15.0-158-generic (4.15.0-158.166) ... Processing triggers for linux-image-4.15.0-158-generic (4.15.0-158.166) ... /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-4.15.0-158-generic /etc/kernel/postinst.d/x-grub-legacy-ec2: Searching for GRUB installation directory ... found: /boot/grub Searching for default file ... found: /boot/grub/default Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst Searching for splash image ... none found, skipping ... Found kernel: /boot/vmlinuz-4.15.0-158-generic Found kernel: /boot/vmlinuz-4.15.0-154-generic Found kernel: /boot/vmlinuz-4.15.0-123-generic Found kernel: /boot/vmlinuz-4.15.0-158-generic Found kernel: /boot/vmlinuz-4.15.0-154-generic Found kernel: /boot/vmlinuz-4.15.0-123-generic Updating /boot/grub/menu.lst ... done /etc/kernel/postinst.d/zz-update-grub: Sourcing file `/etc/default/grub' Sourcing file `/etc/default/grub.d/50-curtin-settings.cfg' Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.15.0-158-generic Found initrd image: /boot/initrd.img-4.15.0-158-generic Found linux image: /boot/vmlinuz-4.15.0-154-generic Found initrd image: /boot/initrd.img-4.15.0-154-generic Found linux image: /boot/vmlinuz-4.15.0-123-generic Found initrd image: /boot/initrd.img-4.15.0-123-generic done
-
这次没有看到什么错误提示了!
$ sudo apt install php-fpm
可以正常安装了!
更多推荐
所有评论(0)