无法安全删除“/usr/bin/gsettings.dpkg-new”:权限被拒绝

无法安全删除“/usr/bin/gsettings.dpkg-new”:权限被拒绝

当我apt-get upgrade使用 root 用户运行时,我得到......

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libglib2.0-dev : Depends: libglib2.0-bin (= 2.56.4-0ubuntu0.18.04.4) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

当我apt --fix-broken install按照提示尝试时,我得到了......

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libglib2.0-bin
The following NEW packages will be installed:
  libglib2.0-bin
0 upgraded, 1 newly installed, 0 to remove and 17 not upgraded.
9 not fully installed or removed.
Need to get 0 B/68.7 kB of archives.
After this operation, 284 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 91896 files and directories currently installed.)
Preparing to unpack .../libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb ...
Unpacking libglib2.0-bin (2.56.4-0ubuntu0.18.04.4) ...
dpkg: error processing archive /var/cache/apt/archives/libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb (--unpack):
 unable to securely remove '/usr/bin/gsettings.dpkg-new': Permission denied
Errors were encountered while processing:
 /var/cache/apt/archives/libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

基本上,有什么方法可以安装它吗libglib2.0-bin


编辑:

我试过sudo dpkg -i --force-overwrite /var/cache/apt/archives/libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb

我得到了……

(Reading database ... 91896 files and directories currently installed.)
Preparing to unpack .../libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb ...
Unpacking libglib2.0-bin (2.56.4-0ubuntu0.18.04.4) ...
dpkg: error processing archive /var/cache/apt/archives/libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb (--install):
 unable to securely remove '/usr/bin/gsettings.dpkg-new': Permission denied
Errors were encountered while processing:
 /var/cache/apt/archives/libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb

那么这unable to securely remove '/usr/bin/gsettings.dpkg-new': Permission denied意味着什么?我尝试手动处理rm此文件,但它立即又出现了。


编辑:

ls -al /usr/bin/gsettings.dpkg-new返回:

-rwxrwxrwx 0 root root 26696 Jul 4 2019 /usr/bin/gsettings.dpkg-new

lsattr /usr/bin/gsettings.dpkg-new返回:

lsattr: Inappropriate ioctl for device While reading flags on /usr/bin/gsettings.dpkg-new

答案1

我最终设法删除了所有依赖项libglib2.0-dev,然后重新安装所有依赖项,并且成功了。

答案2

看起来存档有问题。请尝试通过以下操作将其删除:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_amd64.deb

这个问题看起来很像并且已经详细解释过了

相关内容