服务器更新时发生错误。libklibc 错误

服务器更新时发生错误。libklibc 错误

我正在使用 Ubuntu Server 16.04,在更新系统时出现以下错误(sudo apt update && sudo apt upgrade -y):

You might want to run 'apt-get -f install' to correct these.  
The following packages have unmet dependencies: 
klibc-utils : Depends:
              libklibc (= 2.0.4-8ubuntu1.16.04.4) but 2.0.4-8ubuntu1.16.04.3 is installed  
E: Unmet dependencies. Try using -f.

运行之后sudo apt -f install我得到以下错误:

pkg:处理档案 /var/cache/apt/archives/libklibc_2.0.4-8ubuntu1.16.04.4_amd64.deb 时出错 (--unpack):无法创建‘/lib/klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so.dpkg-new’(处理‘./lib/klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so’时):权限被拒绝 处理时遇到错误:/var/cache/apt/archives/libklibc_2.0.4-8ubuntu1.16.04.4_amd64.deb E:子进程 /usr/bin/dpkg 返回错误代码 (1)

我无法手动重命名/移动 /lib 目录中的文件“klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so”

root@xxxxx:/lib# mv klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so_bak   
mv: cannot move 'klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so'  
  to 'klibc-k3La8MUnuzHQ0_kG8hokcGAC0PA.so_bak': Permission denied

答案1

我通过删除 /lib 上的不可变标志解决了这个问题

chattr -i /lib
rm /lib/klibc-xyzfile
apt-get -f install

那么一切都正常了。

相关内容