0

A similar problem is posted before here but the answeres in that post don't work for me.

My problem is as follows, when I try to install en package, or run autoremove I get:

emiel@server:~$ sudo 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:
 ghostscript : Depends: libgs9 (= 9.18~dfsg~0-0ubuntu2.7) but it is not     installed
 libspectre1 : Depends: libgs9 (>= 8.61.dfsg.1) but it is not installed
E: Unmet dependencies. Try using -f.

So as sugested I tried "sudo apt-get install -f" which gives me the following error:

emiel@server:~$ sudo apt-get 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:
  libllvm3.8 libmircommon5 linux-headers-4.4.0-81 linux-headers-4.4.0-81-generic linux-headers-4.4.0-83 linux-headers-4.4.0-83-generic linux-headers-4.4.0-89
  linux-headers-4.4.0-89-generic linux-image-4.4.0-81-generic linux-image-4.4.0-83-generic linux-image-4.4.0-89-generic linux-image-extra-4.4.0-81-generic
  linux-image-extra-4.4.0-83-generic linux-image-extra-4.4.0-89-generic linux-signed-image-4.4.0-81-generic linux-signed-image-4.4.0-83-generic linux-signed-image-4.4.0-89-generic
  snap-confine
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libgs9
The following NEW packages will be installed:
 libgs9
0 upgraded, 1 newly installed, 0 to remove and 173 not upgraded.
42 not fully installed or removed.
Need to get 0 B/2057 kB of archives.
After this operation, 16,2 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Selecting previously unselected package libgs9:amd64.
dpkg: warning: files list file for package 'libcurl3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'crda' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libsasl2-modules-db:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libudisks2-0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libsasl2-2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libhogweed4:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libubuntutoolkit5:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libusb-1.0-0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liburi-perl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liburl-dispatcher1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'cron' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libusb-0.1-4:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libubuntugestures5:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libsane-hpaio:amd64' missing; assuming package has no files currently installed
(Reading database ... 388901 files and directories currently installed.)
Preparing to unpack .../libgs9_9.18~dfsg~0-0ubuntu2.7_amd64.deb ...
Unpacking libgs9:amd64 (9.18~dfsg~0-0ubuntu2.7) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives    /libgs9_9.18~dfsg~0-0ubuntu2.7_amd64.deb (--unpack):
 cannot copy extracted data for './usr/lib/x86_64-linux-gnu/libgs.so.9.18' to '/usr/lib/x86_64-linux-gnu/libgs.so.9.18.dpkg-new': unexpected end of file or stream
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libgs9_9.18~dfsg~0-0ubuntu2.7_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I want to try suggestions from other Questions but they all end with something like:

Errors were encountered while processing:
 libnspr4
 libnspr4:i386

Wich is followed by a suggestion to remove these packages, but my error is not with a package name but with a .deb file. I'm relatively new to Ubuntu and all my other problems I could solve by browsing here, but this one I cant fix.

EDIT after suggestion from George:

I ran the first command

emiel@server:~$ sudo dpkg --configure -a
Setting up libgs9-common (9.18~dfsg~0-0ubuntu2.7) ...
Setting up linux-image-4.4.0-96-generic (4.4.0-96.119) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-96-generic
Found initrd image: /boot/initrd.img-4.4.0-96-generic
Found linux image: /boot/vmlinuz-4.4.0-92-generic
Found initrd image: /boot/initrd.img-4.4.0-92-generic
Found linux image: /boot/vmlinuz-4.4.0-91-generic
Found initrd image: /boot/initrd.img-4.4.0-91-generic
Found linux image: /boot/vmlinuz-4.4.0-89-generic
Found initrd image: /boot/initrd.img-4.4.0-89-generic
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
Found linux image: /boot/vmlinuz-4.4.0-83-generic
Found initrd image: /boot/initrd.img-4.4.0-83-generic
Found linux image: /boot/vmlinuz-4.4.0-81-generic
Found initrd image: /boot/initrd.img-4.4.0-81-generic
Found linux image: /boot/vmlinuz-4.4.0-70-generic
Found initrd image: /boot/initrd.img-4.4.0-70-generic
Adding boot menu entry for EFI firmware configuration
done
Setting up libisc-export160 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up bluez-cups (5.37-0ubuntu5.1) ...
Setting up linux-signed-image-4.4.0-96-generic (4.4.0-96.119) ...
warning: file-aligned section .text extends beyond end of file
warning: checksum areas are greater than image size. Invalid section table?
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-96-generic
Found initrd image: /boot/initrd.img-4.4.0-96-generic
Found linux image: /boot/vmlinuz-4.4.0-92-generic
Found initrd image: /boot/initrd.img-4.4.0-92-generic
Found linux image: /boot/vmlinuz-4.4.0-91-generic
Found initrd image: /boot/initrd.img-4.4.0-91-generic
Found linux image: /boot/vmlinuz-4.4.0-89-generic
Found initrd image: /boot/initrd.img-4.4.0-89-generic
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
Found linux image: /boot/vmlinuz-4.4.0-83-generic
Found initrd image: /boot/initrd.img-4.4.0-83-generic
Found linux image: /boot/vmlinuz-4.4.0-81-generic
Found initrd image: /boot/initrd.img-4.4.0-81-generic
Found linux image: /boot/vmlinuz-4.4.0-70-generic
Found initrd image: /boot/initrd.img-4.4.0-70-generic
Adding boot menu entry for EFI firmware configuration
done
Setting up libbluetooth3:amd64 (5.37-0ubuntu5.1) ...
Setting up linux-libc-dev:amd64 (4.4.0-96.119) ...
Setting up libdns-export162 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up libgd3:amd64 (2.1.1-4ubuntu0.16.04.8) ...
Setting up libgdk-pixbuf2.0-common (2.32.2-1ubuntu1.3) ...
Setting up linux-headers-4.4.0-96 (4.4.0-96.119) ...
Setting up linux-headers-4.4.0-96-generic (4.4.0-96.119) ...
dpkg: dependency problems prevent configuration of ghostscript:
 ghostscript depends on libgs9 (= 9.18~dfsg~0-0ubuntu2.7); however:
  Package libgs9:amd64 is not installed.

dpkg: error processing package ghostscript (--configure):
 dependency problems - leaving unconfigured
Setting up libxml2:amd64 (2.9.3+dfsg1-1ubuntu0.3) ...
Setting up tcpdump (4.9.2-0ubuntu0.16.04.1) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.tcpdump ...
Setting up liblouis-data (2.6.4-2ubuntu0.1) ...
Setting up bluez-obexd (5.37-0ubuntu5.1) ...
Setting up liblwres141:amd64 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up linux-image-extra-4.4.0-96-generic (4.4.0-96.119) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-96-generic
Found initrd image: /boot/initrd.img-4.4.0-96-generic
Found linux image: /boot/vmlinuz-4.4.0-92-generic
Found initrd image: /boot/initrd.img-4.4.0-92-generic
Found linux image: /boot/vmlinuz-4.4.0-91-generic
Found initrd image: /boot/initrd.img-4.4.0-91-generic
Found linux image: /boot/vmlinuz-4.4.0-89-generic
Found initrd image: /boot/initrd.img-4.4.0-89-generic
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
Found linux image: /boot/vmlinuz-4.4.0-83-generic
Found initrd image: /boot/initrd.img-4.4.0-83-generic
Found linux image: /boot/vmlinuz-4.4.0-81-generic
Found initrd image: /boot/initrd.img-4.4.0-81-generic
Found linux image: /boot/vmlinuz-4.4.0-70-generic
Found initrd image: /boot/initrd.img-4.4.0-70-generic
Adding boot menu entry for EFI firmware configuration
done
dpkg: dependency problems prevent configuration of ghostscript-x:
 ghostscript-x depends on ghostscript (= 9.18~dfsg~0-0ubuntu2.7); however:
  Package ghostscript is not configured yet.

dpkg: error processing package ghostscript-x (--configure):
 dependency problems - leaving unconfigured
Setting up bluez (5.37-0ubuntu5.1) ...
Setting up linux-image-generic (4.4.0.96.101) ...
Setting up python3-jwt (1.3.0-1ubuntu0.1) ...
Setting up linux-headers-generic (4.4.0.96.101) ...
Setting up libisc160:amd64 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up linux-signed-image-generic (4.4.0.96.101) ...
Setting up libgdk-pixbuf2.0-0:amd64 (2.32.2-1ubuntu1.3) ...
Setting up gir1.2-gdkpixbuf-2.0:amd64 (2.32.2-1ubuntu1.3) ...
Setting up liblouis9:amd64 (2.6.4-2ubuntu0.1) ...
Setting up thunderbird (1:52.3.0+build1-0ubuntu0.16.04.1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Setting up libisccc140:amd64 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up thunderbird-gnome-support (1:52.3.0+build1-0ubuntu0.16.04.1) ...
Setting up linux-generic (4.4.0.96.101) ...
Setting up python3-louis (2.6.4-2ubuntu0.1) ...
Setting up libdns162:amd64 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up linux-signed-generic (4.4.0.96.101) ...
Setting up libisccfg140:amd64 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up thunderbird-locale-en (1:52.3.0+build1-0ubuntu0.16.04.1) ...
Setting up thunderbird-locale-en-us (1:52.3.0+build1-0ubuntu0.16.04.1) ...
Setting up libbind9-140:amd64 (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up bind9-host (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Setting up dnsutils (1:9.10.3.dfsg.P4-8ubuntu1.8) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Errors were encountered while processing:
 ghostscript
 ghostscript-x

After that I ran update:

emiel@server:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://nl.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://nl.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://nl.archive.ubuntu.com/ubuntu xenial-backports InRelease                      
Hit:5 http://shell.ninthgate.se/packages/debian jessie InRelease
Fetched 102 kB in 2s (48,2 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
173 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2

After that I tried again but got the same error as above.

I did comment out line 2 in the file /etc/apt/sources.list.d/plex.list. After that "Update" worked as expected.

emiel@server:~$ sudo apt update
Hit:1 http://nl.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:3 http://nl.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://nl.archive.ubuntu.com/ubuntu xenial-backports InRelease                                                
Hit:5 http://shell.ninthgate.se/packages/debian jessie InRelease
Fetched 102 kB in 1s (51,6 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
173 packages can be upgraded. Run 'apt list --upgradable' to see them.

But "install -f" unfortunately still gets me the same message.

So I removed the debian repository and did an update which runs just fine. After that I tried the configure again:

emiel@server:/etc/apt/sources.list.d$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of ghostscript:
 ghostscript depends on libgs9 (= 9.18~dfsg~0-0ubuntu2.7); however:
  Package libgs9:amd64 is not installed.

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

dpkg: error processing package ghostscript-x (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 ghostscript
 ghostscript-x

Trying to install -f still gives me the same error.

Kind Regards, Emiel

  • 1
    Run sudo dkpg --configure -a, then sudo apt update and try again – George Udosen Oct 28 '17 at 09:47
  • Look at these lines /etc/apt/sources.list.d/plex.list:1 and /etc/apt/sources.list.d/plex.list:2 put a # in front of any of the duplicates you desire then do an sudo apt update, after sudo dpkg --configure -a – George Udosen Oct 28 '17 at 10:14
  • I tried your suggestions George, see my edit. I greatly appreciate your help so far! – E. Brommer Oct 28 '17 at 10:57
  • Why do you have a Debian repo in your sources? Will lead to nothing but problems in Ubuntu.. – doug Oct 28 '17 at 12:10
  • Ok except for the observation by @doug you good to go! Why is this Hit:5 http://shell.ninthgate.se/packages/debian jessie InRelease in your repo? – George Udosen Oct 28 '17 at 12:26
  • It looks like I added it to install my plex server. I did remove it. But still I can't get apt to autoremove :( – E. Brommer Oct 28 '17 at 12:49
  • Is the plex server still installed? – George Udosen Oct 28 '17 at 13:07
  • I fixed my problem! I had to do "apt-get clean" to remove the .deb file. After that I was able to install libgs9 and now autoremove is running. The plex server is still installed, but when there is an update it notifies me and provides a download to update plex. – E. Brommer Oct 28 '17 at 13:18
  • @E.Brommer I'm glad you solved your problem - I noted that you had several possibly corrupt deb files, and the clean procedure apparently removed them so that you could download. Perhaps you should consider typing up what you did to fix the issue, as an answer to your own question. – Charles Green Oct 29 '17 at 01:45

1 Answers1

0

For someone else encountering this problem I solved it like this:

The problem is that when I try to reinstall my missing dependency "libgs9" it uses a corrupt .deb file which is already on my server. To solve (remove) this problem I ran

emiel@server:~$ sudo apt-get clean

This removes the corrupt .deb file. After that I ran the suggested command which did reinstall "libgs9".

emiel@server:~$ sudo apt-get install -f

I hope it also solves your problem!

Many thanks to George and doug for helping me finding a solution to this problem.

Emiel