unable to securely remove '/usr/bin/gsettings.dpkg-new': Permission denied

When I run apt-get upgrade using root user, I got...

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).

When I try apt --fix-broken install as it prompted, I got...

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)

Basically, is there any way I can install that libglib2.0-bin?


Edit:

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

and I got...

(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

So what does unable to securely remove '/usr/bin/gsettings.dpkg-new': Permission denied mean? I tried to manually rm this file and it appeared again immediately.


Edit:

ls -al /usr/bin/gsettings.dpkg-new returns:

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

and

lsattr /usr/bin/gsettings.dpkg-new returns:

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


Solution 1:

I finally managed to delete everything depending on libglib2.0-dev and install everything again and it worked.