vmware的Ubuntu的apt-get开机后一开始就报错。
第一个错误 Resource temporarily unavailable
apt-get install xxx 发现如下:
Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
表明是apt已经在被使用了。
先查看谁在占用apt:
ps afx | grep apt
jopin@jopin-virtual-machine:~$ ps afx | grep apt
1071 ? Ss 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily
3199 pts/2 Ds+ 0:00 \_ /usr/bin/dpkg --status-fd 10 --unpack --auto-deconfigure /var/cache/apt/archives/git-svn_1%3a2.7.4-0ubuntu1.6_all.deb /var/cache/apt/archives/git-el_1%3a2.7.4-0ubuntu1.6_all.deb /var/cache/apt/archives/git-man_1%3a2.7.4-0ubuntu1.6_all.deb /var/cache/apt/archives/perl-base_5.22.1-9ubuntu0.6_amd64.deb
3206 pts/6 S+ 0:00 \_ grep --color=auto apt
先杀死占用进程:
执行 sudo kill -9 1071
删除锁定文件: sudo rm /var/lib/dpkg/lock
强制重新配置软件包: sudo dpkg --configure -a
第二个错误 Errors were encountered while processing
sudo dpkg --configure -a 出现:
Errors were encountered while processing:
runit
git-daemon-run
说明应该重装 runit:
sudo apt-get install --reinstall runit
第三个错误 E: Internal Error, No file name for runit:amd64
sudo apt-get install --reinstall runit 出现如下错误
E: Internal Error, No file name for runit:amd64
所以我尝试更新源:
sudo apt-get update
第四个错误 E: Sub-process returned an error code
执行 sudo apt-get update 出现以下错误:
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi'
E: Sub-process returned an error code
先杀死 appstream:
sudo pkill -KILL appstreamcli
重新获取和安装:
wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb
运行 sudo apt-get update正常
但是。。。。sudo apt-get install runit 仍然保错:此时内心是崩溃的~
E: Internal Error, No file name for runit:amd64
深吸一口气,首先再重新用apt自动更新并安装最新的appstream:
sudo apt-get --upgrade appstream
sudo apt-get install --reinstall git-daemon-run
至此,问题解决`~
参考:
https://www.cnblogs.com/EasonJim/p/7343892.html
https://askubuntu.com/questions/728581/how-to-fix-error-processing-package-git-daemon-run
https://www.cnblogs.com/yun6853992/p/9343816.html