在 Raspberry Pi 中安装/更新包时出现权限被拒绝错误

在 Raspberry Pi 中安装/更新包时出现权限被拒绝错误

我收到一条有关软件包的错误消息,并且我确实使用管理权限运行了推荐的命令:

$ sudo apt-get -f install
Preparing to unpack .../libgdk-pixbuf2.0-common_2.31.1-2+deb8u7_all.deb ...
Unpacking libgdk-pixbuf2.0-common (2.31.1-2+deb8u7) over (2.31.1-2+deb8u6) ...
dpkg: error processing archive /var/cache/apt/archives/libgdk-pixbuf2.0-common_2.31.1-2+deb8u7_all.deb (--unpack):
unable to create `/usr/share/locale/xh/LC_MESSAGES/gdk-pixbuf.mo.dpkg-new' (while processing `./usr/share/locale/xh/LC_MESSAGES/gdk-pixbuf.mo'): Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/libgdk-pixbuf2.0-common_2.31.1-2+deb8u7_all.deb

为什么root用户的权限被拒绝?我怎样才能解决这个问题?提前致谢。

$ apt-cache policy libgdk-pixbuf2.0-common
libgdk-pixbuf2.0-common:
Installed: 2.31.1-2+deb8u6
Candidate: 2.31.1-2+deb8u7
Version table:
 2.31.1-2+deb8u7 0
500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages
 *** 2.31.1-2+deb8u6 0
100 /var/lib/dpkg/status

在 Raspberry Pi 2 上尝试这个

$ apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
libgdk-pixbuf2.0-0 : Depends: libgdk-pixbuf2.0-common (= 2.31.1-2+deb8u7) but 2.31.1-2+deb8u6 is installed
E: Unmet dependencies. Try using -f.

e在显示文件属性时设置属性是否会导致lsattr任何问题?

我也无法手动移动文件:

$ sudo mv gdk-pixbuf.mo gdk-pixbuf.mo.old
mv: cannot move ‘gdk-pixbuf.mo’ to ‘gdk-pixbuf.mo.old’: Operation not permitted`

$ ls -lh
-rw-r--r-- 1 root       root      17K Sep 15 17:07 gdk-pixbuf.mo

$ getfacl gdk-pixbuf.mo
# file: gdk-pixbuf.mo
# owner: root
# group: root
user::rw-
group::r--
other::r--

$ getfacl LC_MESSAGES
# file: LC_MESSAGES/
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

答案1

尝试清理你的包:

sudo apt-get autoremove

然后再次运行:

sudo apt-get -f install

另外,该目录看起来像是软件包的一部分language-pack-gnome-xh-base,因此也可能是 apt-get 安装的。

相关内容