Score:0

I can not install packages from terminal in ubuntu 18.04.5

ca flag

When I tried to install Python I got this:

$ sudo apt install python3.7
[sudo] password for ubuntu: 
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:
 libgd3 : Breaks: libgd3:i386 (!= 2.2.5-4ubuntu0.2) but 2.2.5-4ubuntu0.4 is to be installed
 libgd3:i386 : Breaks: libgd3 (!= 2.2.5-4ubuntu0.4) but 2.2.5-4ubuntu0.2 is to be installed
 libjpeg-turbo8 : Breaks: libjpeg-turbo8:i386 (!= 1.5.2-0ubuntu5.18.04.1) but 1.5.2-0ubuntu5.18.04.4 is to be installed
 libjpeg-turbo8:i386 : Breaks: libjpeg-turbo8 (!= 1.5.2-0ubuntu5.18.04.4) but 1.5.2-0ubuntu5.18.04.1 is to be installed
 libjpeg-turbo8-dev : Depends: libjpeg-turbo8 (= 1.5.2-0ubuntu5.18.04.4) but 1.5.2-0ubuntu5.18.04.1 is to be installed
 libpng16-16 : Breaks: libpng16-16:i386 (!= 1.6.34-1ubuntu0.18.04.1) but 1.6.34-1ubuntu0.18.04.2 is to be installed
 libpng16-16:i386 : Breaks: libpng16-16 (!= 1.6.34-1ubuntu0.18.04.2) but 1.6.34-1ubuntu0.18.04.1 is to be installed
 python3.7 : Depends: python3.7-minimal (= 3.7.5-2~18.04.4) but it is not going to be installed
             Depends: libpython3.7-stdlib (= 3.7.5-2~18.04.4) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I tried apt --fix-broken install.. I got this:

$ apt --fix-broken install
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Please help me to fix this!

Edit: the version of my system is:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:    18.04
Codename:   bionic

The errors I got after using sudo apt --fix-broken install are:

Errors were encountered while processing:
/var/cache/apt/archives/libjpeg-turbo8_1.5.2-0ubuntu5.18.04.4_amd64.deb
/var/cache/apt/archives/libpng16-16_1.6.34-1ubuntu0.18.04.2_amd64.deb
/var/cache/apt/archives/libgd3_2.2.5-4ubuntu0.4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Edit 2: I tried

$ sudo apt update --fix-missing
Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease                      
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease                    
Hit:4 http://in.archive.ubuntu.com/ubuntu bionic-security InRelease                                             
Hit:5 http://dl.google.com/linux/chrome/deb stable InRelease                                                   
Hit:6 http://archive.canonical.com/ubuntu bionic InRelease                               
Reading package lists... Done
Building dependency tree       
Reading state information... Done
446 packages can be upgraded. Run 'apt list --upgradable' to see them.

After sudo apt install -f

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  fonts-horai-umefont fonts-unfonts-core gcc-5-base:i386 gcc-6-base:i386 gir1.2-gkbd-3.0 gir1.2-grilo-0.2 gir1.2-networkmanager-1.0
  gir1.2-nmgtk-1.0 gir1.2-tracker-1.0 gnome-characters gnome-icon-theme-symbolic gnome-keyring-pkcs11:i386 gnome-packagekit-data
  gnome-weather libaio1 libamd2.4.1 libaqhbci22 libass5 libavcodec-ffmpeg56 libavfilter-ffmpeg5 libavformat-ffmpeg56 libavresample-ffmpeg2
  libavutil-ffmpeg54 libblas-common libbluray1 libcamd2.4.1 libccolamd2.9.1 libcholmod3.0.6 libchromaprint0 libclutter-gst-2.0-0 libcryptui0a
  libdirectfb-1.2-9 libestools2.4 libgfortran3 libgif7:i386 libgit2-24 libhardware2 libhttp-parser2.1 libhybris libhybris-common1
  libice6:i386 libicu55:i386 libidn11:i386 libiso9660-10 libiso9660-8 libjavascriptcoregtk-3.0-0 libjson-c2:i386 liblivemedia50
  libllvm3.8:i386 libmedia1 libmimic0 libmozjs-24-0v5 libnetplan0 libofx6 libopencv-calib3d2.4v5 libopencv-contrib2.4v5 libopencv-core2.4v5
  libopencv-features2d2.4v5 libopencv-flann2.4v5 libopencv-highgui2.4v5 libopencv-imgproc2.4v5 libopencv-legacy2.4v5 libopencv-ml2.4v5
  libopencv-objdetect2.4v5 libopencv-video2.4v5 libopenjpeg5 libp11-kit-gnome-keyring:i386 libpanel-applet0 libpaps0 libparams-validate-perl
  libpng12-0:i386 libpodofo0.9.3 libpostproc-ffmpeg53 libqt5clucene5 libqtwebkit4 libschroedinger-1.0-0 libsm6:i386 libsodium18
  libspice-client-gtk-3.0-4 libsrtp0 libssl1.0.0:i386 libswresample-ffmpeg1 libswscale-ffmpeg3 libtbb2 libtracker-control-1.0-0
  libtracker-miner-1.0-0 libtxc-dxtn-s2tc0:i386 libumfpack5.7.1 libva-drm1 libva-x11-1 libva1 libvcdinfo0 libvpx3:i386 libwebkitgtk-3.0-0
  libwildmidi1 libx264-148 libx265-79 libxcb-composite0 libxcb-xf86dri0 libxt6:i386 linux-generic linux-generic-hwe-16.04
  linux-headers-generic-hwe-16.04 linux-image-generic-hwe-16.04 p11-kit-modules:i386 paps python-beautifulsoup python-pyatspi seahorse-daemon
  snapd-login-service wine-gecko2.21:i386 wine-gecko2.21 wine-mono0.0.8 wine1.6-amd64 wine1.6-i386:i386 xserver-xorg-input-all-hwe-16.04
  xserver-xorg-input-evdev-hwe-16.04 xserver-xorg-input-synaptics-hwe-16.04 xserver-xorg-input-wacom-hwe-16.04
  xserver-xorg-video-amdgpu-hwe-16.04 xserver-xorg-video-qxl-hwe-16.04 xserver-xorg-video-vesa-hwe-16.04
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libgd3 libjpeg-turbo8 libpng16-16
Suggested packages:
  libgd-tools
The following packages will be upgraded:
  libgd3 libjpeg-turbo8 libpng16-16
3 upgraded, 0 newly installed, 0 to remove and 443 not upgraded.
20 not fully installed or removed.
Need to get 0 B/405 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 279851 files and directories currently installed.)
Preparing to unpack .../libjpeg-turbo8_1.5.2-0ubuntu5.18.04.4_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (1.5.2-0ubuntu5.18.04.4) over (1.5.2-0ubuntu5.18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libjpeg-turbo8_1.5.2-0ubuntu5.18.04.4_amd64.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libjpeg-turbo8/changelog.Debian.gz', which is different from other instances of package libjpeg-turbo8:amd64
Preparing to unpack .../libpng16-16_1.6.34-1ubuntu0.18.04.2_amd64.deb ...
Unpacking libpng16-16:amd64 (1.6.34-1ubuntu0.18.04.2) over (1.6.34-1ubuntu0.18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libpng16-16_1.6.34-1ubuntu0.18.04.2_amd64.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libpng16-16/changelog.Debian.gz', which is different from other instances of package libpng16-16:amd64
Preparing to unpack .../libgd3_2.2.5-4ubuntu0.4_amd64.deb ...
Unpacking libgd3:amd64 (2.2.5-4ubuntu0.4) over (2.2.5-4ubuntu0.2) ...
dpkg: error processing archive /var/cache/apt/archives/libgd3_2.2.5-4ubuntu0.4_amd64.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libgd3/changelog.Debian.gz', which is different from other instances of package libgd3:amd64
Errors were encountered while processing:
 /var/cache/apt/archives/libjpeg-turbo8_1.5.2-0ubuntu5.18.04.4_amd64.deb
 /var/cache/apt/archives/libpng16-16_1.6.34-1ubuntu0.18.04.2_amd64.deb
 /var/cache/apt/archives/libgd3_2.2.5-4ubuntu0.4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

After sudo dpkg --configure -a

$ sudo dpkg --configure -a
dpkg: error processing package libpng16-16:amd64 (--configure):
 package libpng16-16:amd64 1.6.34-1ubuntu0.18.04.1 cannot be configured because libpng16-16:i386 is at a different version (1.6.34-1ubuntu0.18.04.2)
dpkg: error processing package libpng16-16:i386 (--configure):
 package libpng16-16:i386 1.6.34-1ubuntu0.18.04.2 cannot be configured because libpng16-16:amd64 is at a different version (1.6.34-1ubuntu0.18.04.1)
dpkg: dependency problems prevent configuration of libwebkit2gtk-4.0-37:amd64:
 libwebkit2gtk-4.0-37:amd64 depends on libpng16-16 (>= 1.6.2-1); however:
  Package libpng16-16:amd64 is not configured yet.

dpkg: error processing package libwebkit2gtk-4.0-37:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: error processing package libgd3:amd64 (--configure):
 package libgd3:amd64 2.2.5-4ubuntu0.2 cannot be configured because libgd3:i386 is at a different version (2.2.5-4ubuntu0.4)
dpkg: error processing package libgd3:i386 (--configure):
 package libgd3:i386 2.2.5-4ubuntu0.4 cannot be configured because libgd3:amd64 is at a different version (2.2.5-4ubuntu0.2)
dpkg: error processing package libjpeg-turbo8:amd64 (--configure):
 package libjpeg-turbo8:amd64 1.5.2-0ubuntu5.18.04.1 cannot be configured because libjpeg-turbo8:i386 is at a different version (1.5.2-0ubuntu5.18.04.4)
dpkg: error processing package libjpeg-turbo8:i386 (--configure):
 package libjpeg-turbo8:i386 1.5.2-0ubuntu5.18.04.4 cannot be configured because libjpeg-turbo8:amd64 is at a different version (1.5.2-0ubuntu5.18.04.1)
dpkg: dependency problems prevent configuration of libpoppler73:amd64:
 libpoppler73:amd64 depends on libpng16-16 (>= 1.6.2-1); however:
  Package libpng16-16:amd64 is not configured yet.

dpkg: error processing package libpoppler73:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libwebkitgtk-1.0-0:amd64:
 libwebkitgtk-1.0-0:amd64 depends on libpng16-16 (>= 1.6.2-1); however:
  Package libpng16-16:amd64 is not configured yet.

dpkg: error processing package libwebkitgtk-1.0-0:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgs9:amd64:
 libgs9:amd64 depends on libpng16-16 (>= 1.6.2-1); however:
  Package libpng16-16:amd64 is not configured yet.

dpkg: error processing package libgs9:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libpoppler-glib8:amd64:
 libpoppler-glib8:amd64 depends on libpoppler73 (= 0.62.0-2ubuntu2.7); however:
  Package libpoppler73:amd64 is not configured yet.

dpkg: error processing package libpoppler-glib8:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of poppler-utils:
 poppler-utils depends on libpoppler73 (= 0.62.0-2ubuntu2.7); however:
  Package libpoppler73:amd64 is not configured yet.

dpkg: error processing package poppler-utils (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libmagickcore-6.q16-3:amd64:
 libmagickcore-6.q16-3:amd64 depends on libpng16-16 (>= 1.6.2-1); however:
  Package libpng16-16:amd64 is not configured yet.

dpkg: error processing package libmagickcore-6.q16-3:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gir1.2-webkit2-4.0:amd64:
 gir1.2-webkit2-4.0:amd64 depends on libwebkit2gtk-4.0-37 (>= 2.21.92); however:
  Package libwebkit2gtk-4.0-37:amd64 is not configured yet.

dpkg: error processing package gir1.2-webkit2-4.0:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of imagemagick-6.q16:
 imagemagick-6.q16 depends on libmagickcore-6.q16-3 (>= 8:6.9.6.8); however:
  Package libmagickcore-6.q16-3:amd64 is not configured yet.

dpkg: error processing package imagemagick-6.q16 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ghostscript:
 ghostscript depends on libgs9 (= 9.26~dfsg+0-0ubuntu0.18.04.6); however:
  Package libgs9:amd64 is not configured yet.

dpkg: error processing package ghostscript (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libmagickcore-6.q16-3-extra:amd64:
 libmagickcore-6.q16-3-extra:amd64 depends on libmagickcore-6.q16-3 (>= 8:6.9.6.8); however:
  Package libmagickcore-6.q16-3:amd64 is not configured yet.

dpkg: error processing package libmagickcore-6.q16-3-extra:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libmagickwand-6.q16-3:amd64:
 libmagickwand-6.q16-3:amd64 depends on libmagickcore-6.q16-3 (>= 8:6.9.6.8); however:
  Package libmagickcore-6.q16-3:amd64 is not configured yet.

dpkg: error processing package libmagickwand-6.q16-3:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of imagemagick:
 imagemagick depends on imagemagick-6.q16 (>= 8:6.9.2.10+dfsg-2~); however:
  Package imagemagick-6.q16 is not configured yet.

dpkg: error processing package imagemagick (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ghostscript-x:
 ghostscript-x depends on ghostscript (= 9.26~dfsg+0-0ubuntu0.18.04.6); however:
  Package ghostscript is not configured yet.

dpkg: error processing package ghostscript-x (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...
Errors were encountered while processing:
 libpng16-16:amd64
 libpng16-16:i386
 libwebkit2gtk-4.0-37:amd64
 libgd3:amd64
 libgd3:i386
 libjpeg-turbo8:amd64
 libjpeg-turbo8:i386
 libpoppler73:amd64
 libwebkitgtk-1.0-0:amd64
 libgs9:amd64
 libpoppler-glib8:amd64
 poppler-utils
 libmagickcore-6.q16-3:amd64
 gir1.2-webkit2-4.0:amd64
 imagemagick-6.q16
 ghostscript
 libmagickcore-6.q16-3-extra:amd64
 libmagickwand-6.q16-3:amd64
 imagemagick
 ghostscript-x
vanadium avatar
cn flag
You have broken packages. There is no "one fits all" solution. See here for inspiration: https://askubuntu.com/questions/216998/broken-packages
Rajashree Das avatar
ca flag
Is there any command to detect them?
vanadium avatar
cn flag
There are already a few in the output of your question. This may be caused by adding incompatible PPA's, or could also be caused by a previously interrupted installation.
Rajashree Das avatar
ca flag
Can you please suggest commands to fix them? I can not install anything because of this. Plese help.
vanadium avatar
cn flag
Try `sudo apt update --fix-missing`, `sudo apt install -f`, and if that does not fix the issue, `sudo dpkg --configure -a`. Include all commands *and* terminal output in your question - use "edit".
Rajashree Das avatar
ca flag
Hey, I tried them please check the edit and kindly help me.
karel avatar
sa flag
Does this answer your question? [Trying to overwrite ... which is different from other instances of package](https://askubuntu.com/questions/855474/trying-to-overwrite-which-is-different-from-other-instances-of-package)
Rajashree Das avatar
ca flag
not exactly, please suggest a way to get rid of this issue.
vanadium avatar
cn flag
Check the output of `sudo dpkg -l | grep ^..r` If you see core packages, you will have a big problem. Otherwise, remove the packages you see in this list using `sudo dpkg --remove --force-remove --reinstreq`. After that, `sudo apt clean` and `sudo apt update` Again, document the output.
Rajashree Das avatar
ca flag
``` sudo dpkg -l | grep ^..r ``` shows no output
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.