0

So I don't know how this happened, but every time I try to install something or do an update, it won't finish and fails. I am using Ubuntu 17.04. Here's what happens when I try to run sudo apt upgrade:

into@poppistus:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-4.10.0-24 linux-headers-4.10.0-24-generic
  linux-image-4.10.0-24-generic linux-image-extra-4.10.0-24-generic
The following packages will be upgraded:
  apport click firefox firefox-locale-en firefox-locale-fi gir1.2-click-0.4
  gir1.2-javascriptcoregtk-4.0 gir1.2-webkit2-4.0 gnome-calendar
  gnome-desktop3-data gnome-settings-daemon-schemas imagemagick
  imagemagick-6-common imagemagick-6.q16 irssi libc-bin libclick-0.4-0
  libgnome-desktop-3-12 libgnutls30 libimage-magick-perl
  libimage-magick-q16-perl libjavascriptcoregtk-4.0-18 libldap-2.4-2
  libldap-common libmagick++-6.q16-7 libmagickcore-6.q16-3
  libmagickcore-6.q16-3-extra libmagickwand-6.q16-3 libmirclient9
  libmircommon7 libmircookie2 libmircore1 libmirplatform15 libmirprotobuf3
  libmirserver43 libmwaw-0.3-3 libnl-3-200 libnl-genl-3-200 libnm-glib-vpn1
  libnm-glib4 libnm-util2 libnm0 libsndfile1 libssl1.0.0 libtasn1-6
  libwebkit2gtk-4.0-37 libwebkit2gtk-4.0-37-gtk2 lintian linux-generic
  linux-headers-generic linux-image-generic locales mir-client-platform-mesa5
  mir-graphics-drivers-desktop mir-platform-graphics-mesa-kms12
  mir-platform-graphics-mesa-x12 mir-platform-input-evdev6 multiarch-support
  network-manager openssl python3-click-package python3-distupgrade sudo
  ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk
65 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/151 MB of archives.
After this operation, 310 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 263567 files and directories currently installed.)
Preparing to unpack .../apport_2.20.4-0ubuntu4.1_all.deb ...
/var/lib/dpkg/info/apport.prerm: 19: /var/lib/dpkg/info/apport.prerm: pyclean: Permission denied
dpkg: warning: subprocess old pre-removal script returned error exit status 126
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 19: /var/lib/dpkg/tmp.ci/prerm: pyclean: Permission denied
dpkg: error processing archive /var/cache/apt/archives/apport_2.20.4-0ubuntu4.1_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 126
/var/lib/dpkg/info/apport.postinst: 13: /var/lib/dpkg/info/apport.postinst: pycompile: Permission denied
*** Error in `/usr/bin/dpkg': munmap_chunk(): invalid pointer: 0x0000564558183bf8 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7908b)[0x7f74655da08b]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x1f8)[0x7f74655e7ed8]
/usr/bin/dpkg(+0x20cd0)[0x564555e87cd0]
/usr/bin/dpkg(+0x21119)[0x564555e88119]
/usr/bin/dpkg(+0x283cd)[0x564555e8f3cd]
/usr/bin/dpkg(+0x17737)[0x564555e7e737]
/usr/bin/dpkg(+0x17915)[0x564555e7e915]
/usr/bin/dpkg(+0x17b5d)[0x564555e7eb5d]
/usr/bin/dpkg(+0xaed7)[0x564555e71ed7]
/usr/bin/dpkg(+0x20c0b)[0x564555e87c0b]
/usr/bin/dpkg(+0x20e01)[0x564555e87e01]
/usr/bin/dpkg(+0xa962)[0x564555e71962]
/usr/bin/dpkg(+0x72fd)[0x564555e6e2fd]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f74655813f1]
/usr/bin/dpkg(+0x743a)[0x564555e6e43a]
======= Memory map: ========
564555e67000-564555eac000 r-xp 00000000 fd:00 11796786                   /usr/bin/dpkg
5645560ac000-5645560af000 r--p 00045000 fd:00 11796786                   /usr/bin/dpkg
5645560af000-5645560b0000 rw-p 00048000 fd:00 11796786                   /usr/bin/dpkg
5645560b0000-5645562c4000 rw-p 00000000 00:00 0 
564557bc4000-56455afd2000 rw-p 00000000 00:00 0                          [heap]
7f7464069000-7f746407f000 r-xp 00000000 fd:00 25690128                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f746407f000-7f746427e000 ---p 00016000 fd:00 25690128                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f746427e000-7f746427f000 r--p 00015000 fd:00 25690128                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f746427f000-7f7464280000 rw-p 00016000 fd:00 25690128                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f7464280000-7f746428b000 r-xp 00000000 fd:00 25690165                   /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f746428b000-7f746448a000 ---p 0000b000 fd:00 25690165                   /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f746448a000-7f746448b000 r--p 0000a000 fd:00 25690165                   /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f746448b000-7f746448c000 rw-p 0000b000 fd:00 25690165                   /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f746448c000-7f7464492000 rw-p 00000000 00:00 0 
7f7464492000-7f746449d000 r-xp 00000000 fd:00 25690167                   /lib/x86_64-linux-gnu/libnss_nis-2.24.so
7f746449d000-7f746469c000 ---p 0000b000 fd:00 25690167                   /lib/x86_64-linux-gnu/libnss_nis-2.24.so
7f746469c000-7f746469d000 r--p 0000a000 fd:00 25690167                   /lib/x86_64-linux-gnu/libnss_nis-2.24.so
7f746469d000-7f746469e000 rw-p 0000b000 fd:00 25690167                   /lib/x86_64-linux-gnu/libnss_nis-2.24.so
7f746469e000-7f74646b4000 r-xp 00000000 fd:00 25690159                   /lib/x86_64-linux-gnu/libnsl-2.24.so
7f74646b4000-7f74648b3000 ---p 00016000 fd:00 25690159                   /lib/x86_64-linux-gnu/libnsl-2.24.so
7f74648b3000-7f74648b4000 r--p 00015000 fd:00 25690159                   /lib/x86_64-linux-gnu/libnsl-2.24.so
7f74648b4000-7f74648b5000 rw-p 00016000 fd:00 25690159                   /lib/x86_64-linux-gnu/libnsl-2.24.so
7f74648b5000-7f74648b7000 rw-p 00000000 00:00 0 
7f74648b7000-7f74648bf000 r-xp 00000000 fd:00 25690160                   /lib/x86_64-linux-gnu/libnss_compat-2.24.so
7f74648bf000-7f7464abe000 ---p 00008000 fd:00 25690160                   /lib/x86_64-linux-gnu/libnss_compat-2.24.so
7f7464abe000-7f7464abf000 r--p 00007000 fd:00 25690160                   /lib/x86_64-linux-gnu/libnss_compat-2.24.so
7f7464abf000-7f7464ac0000 rw-p 00008000 fd:00 25690160                   /lib/x86_64-linux-gnu/libnss_compat-2.24.so
7f7464ac0000-7f7464ecc000 r--p 00000000 fd:00 11797986                   /usr/lib/locale/locale-archive
7f7464ecc000-7f7464ee4000 r-xp 00000000 fd:00 25690314                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f7464ee4000-7f74650e4000 ---p 00018000 fd:00 25690314                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f74650e4000-7f74650e5000 r--p 00018000 fd:00 25690314                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f74650e5000-7f74650e6000 rw-p 00019000 fd:00 25690314                   /lib/x86_64-linux-gnu/libpthread-2.24.so
7f74650e6000-7f74650ea000 rw-p 00000000 00:00 0 
7f74650ea000-7f74650ed000 r-xp 00000000 fd:00 25690155                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f74650ed000-7f74652ec000 ---p 00003000 fd:00 25690155                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f74652ec000-7f74652ed000 r--p 00002000 fd:00 25690155                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f74652ed000-7f74652ee000 rw-p 00003000 fd:00 25690155                   /lib/x86_64-linux-gnu/libdl-2.24.so
7f74652ee000-7f7465360000 r-xp 00000000 fd:00 25690207                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f7465360000-7f746555f000 ---p 00072000 fd:00 25690207                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f746555f000-7f7465560000 r--p 00071000 fd:00 25690207                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f7465560000-7f7465561000 rw-p 00072000 fd:00 25690207                   /lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f7465561000-7f746571f000 r-xp 00000000 fd:00 25690151                   /lib/x86_64-linux-gnu/libc-2.24.so
7f746571f000-7f746591e000 ---p 001be000 fd:00 25690151                   /lib/x86_64-linux-gnu/libc-2.24.so
7f746591e000-7f7465922000 r--p 001bd000 fd:00 25690151                   /lib/x86_64-linux-gnu/libc-2.24.so
7f7465922000-7f7465924000 rw-p 001c1000 fd:00 25690151                   /lib/x86_64-linux-gnu/libc-2.24.so
7f7465924000-7f7465928000 rw-p 00000000 00:00 0 
7f7465928000-7f746594d000 r-xp 00000000 fd:00 25690210                   /lib/x86_64-linux-gnu/libselinux.so.1
7f746594d000-7f7465b4c000 ---p 00025000 fd:00 25690210                   /lib/x86_64-linux-gnu/libselinux.so.1
7f7465b4c000-7f7465b4d000 r--p 00024000 fd:00 25690210                   /lib/x86_64-linux-gnu/libselinux.so.1
7f7465b4d000-7f7465b4e000 rw-p 00025000 fd:00 25690210                   /lib/x86_64-linux-gnu/libselinux.so.1
7f7465b4e000-7f7465b50000 rw-p 00000000 00:00 0 
7f7465b50000-7f7465b76000 r-xp 00000000 fd:00 25690116                   /lib/x86_64-linux-gnu/ld-2.24.so
7f7465d4d000-7f7465d4f000 rw-p 00000000 00:00 0 
7f7465d71000-7f7465d75000 rw-p 00000000 00:00 0 
7f7465d75000-7f7465d76000 r--p 00025000 fd:00 25690116                   /lib/x86_64-linux-gnu/ld-2.24.so
7f7465d76000-7f7465d77000 rw-p 00026000 fd:00 25690116                   /lib/x86_64-linux-gnu/ld-2.24.so
7f7465d77000-7f7465d78000 rw-p 00000000 00:00 0 
7ffeb6364000-7ffeb6385000 rw-p 00000000 00:00 0                          [stack]
7ffeb63cd000-7ffeb63cf000 r--p 00000000 00:00 0                          [vvar]
7ffeb63cf000-7ffeb63d1000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
E: Sub-process /usr/bin/dpkg exited unexpectedly

I would really like to get this fixed and I will be very thankful for even the littlest help!

1

I solved this by doing the next set of commands:

sudo mv /var/lib/dpkg/info/apport.* /tmp/
sudo dpkg --remove --force-remove-reinstreq apport
sudo apt remove apport
sudo apt autoremove && sudo appt autoclean

Thanks for the help everyone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.