0

When I install anything like sudo apt install -y putty

I get error:

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:
 imagemagick : Depends: imagemagick-6.q16 (>= 8:6.9.2.10+dfsg-2~)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I try apt --fix-broken install

I get error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  libept1.6.0
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  imagemagick-6.q16 netpbm
Suggested packages:
  imagemagick-doc autotrace enscript ffmpeg gimp gnuplot grads graphviz hp2xx
  html2ps libwmf-bin mplayer povray radiance texlive-base-bin transfig
  ufraw-batch
The following NEW packages will be installed:
  imagemagick-6.q16 netpbm
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
2 not fully installed or removed.
Need to get 0 B/1,444 kB of archives.
After this operation, 5,009 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 193102 files and directories currently installed.)
Preparing to unpack .../imagemagick-6.q16_8%3a6.9.10.23+dfsg-2.1ubuntu11.4_amd64.deb ...
Unpacking imagemagick-6.q16 (8:6.9.10.23+dfsg-2.1ubuntu11.4) ...
dpkg: error processing archive /var/cache/apt/archives/imagemagick-6.q16_8%3a6.9.10.23+dfsg-2.1ubuntu11.4_amd64.deb (--unpack):
 unable to create '/usr/bin/animate-im6.q16.dpkg-new' (while processing './usr/bin/animate-im6.q16'): Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../netpbm_2%3a10.0-15.3build1_amd64.deb ...
Unpacking netpbm (2:10.0-15.3build1) ...
dpkg: error processing archive /var/cache/apt/archives/netpbm_2%3a10.0-15.3build1_amd64.deb (--unpack):
 unable to create '/usr/bin/pbmtobbnbg.dpkg-new' (while processing './usr/bin/pbmtobbnbg'): Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/imagemagick-6.q16_8%3a6.9.10.23+dfsg-2.1ubuntu11.4_amd64.deb
 /var/cache/apt/archives/netpbm_2%3a10.0-15.3build1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

when I check ls -al /usr

I get:

drwxr-xr-x   2 root root      69632 Jul 23 15:16 bin

And I am not able to create any file in /usr/bin directory

How can I create any file in /usr/bin directory so that apt --fix-broken install can work?

5
  • "When I try apt --fix-broken install" Are you actually typing sudo apt --fix-broken install? If not, the lack of sudo is your problem. Commented Jul 26, 2022 at 23:28
  • still same error in it. Why does root not have write access to /usr/bin directory Commented Jul 26, 2022 at 23:48
  • Does sudo touch /usr/bin/file succeed? Commented Jul 26, 2022 at 23:50
  • 2
    Try chattr -i /usr/bin (or even, with -R)?
    – Tom Yan
    Commented Jul 27, 2022 at 1:37
  • chattr -i /usr/bin worked Commented Jul 28, 2022 at 9:05

2 Answers 2

1

@tom-yan "chattr -i /usr/bin" worked

1
  • 3
    Great that you were able to solve the problem. But it's practice here to ask people who provide a solution in the comments to post them as an answer, so they can get the credit that is due. Commented Jul 28, 2022 at 9:09
-1

$ sudo apt-get clean

$ sudo apt-get update

$ sudo apt-get install --reinstall "Application"

$ sudo apt-get -f install

Replace application with whatever you're trying to install

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 3, 2022 at 10:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .