Tag: dpkg

  • dpkg dependency problems not removing

    dpkg dependency problems not removing

    When removing a package, I got the following error message

    root@82-165-118-245:/~# dpkg --remove psa-phpmyadmin
    dpkg: dependency problems prevent removal of psa-phpmyadmin:
     plesk-core depends on psa-phpmyadmin (>= 5.1.1); however:
      Package psa-phpmyadmin is to be removed.
    
    dpkg: error processing package psa-phpmyadmin (--remove):
     dependency problems - not removing
    Errors were encountered while processing:
     psa-phpmyadmin
    root@82-165-118-245:/~# 
    

    It is fixed by specifying –ignore-depends=plesk-core in apt command.

    Example

    root@82-165-118-245:/~# dpkg --remove --ignore-depends=plesk-core psa-phpmyadmin
    (Reading database ... 168316 files and directories currently installed.)
    Removing psa-phpmyadmin (5.1.1-v.ubuntu.18.04+p18.0.38.0+t210825.1032) ...
    root@82-165-118-245:/~# 
    
  • dpkg package pre-removal script returned error

    dpkg package pre-removal script returned error

    On a Plesk server, MySQL somehow went missing. When I tried to remove a package, I get error

    root@82-165-118-245:~# dpkg --remove plesk-config-troubleshooter
    (Reading database ... 168528 files and directories currently installed.)
    Removing plesk-config-troubleshooter (18.0-v.ubuntu.18.04+p18.0.39.2+t211117.1817) ...
    dpkg action: 
    
    ERROR while trying to detect MySQL service name
    
    Check the error reason (see log file: /var/log/plesk/install/plesk_18.0.39_installation.log), fix and try again
    dpkg action: 
    
    ERROR while trying to detect MySQL service name
    
    
    Package script failed
    
    ***** installing problem report *****
    ERROR while trying to detect MySQL service name
    Package script failed
    dpkg: error processing package plesk-config-troubleshooter (--remove):
     installed plesk-config-troubleshooter package pre-removal script subprocess returned error exit status 1
    Errors were encountered while processing:
     plesk-config-troubleshooter
    root@82-165-118-245:~#

    To fix this, I removed the prerm and postrm scripts. These scripts execute before and after a package is removed. It is not recommended to remove it, but if these scripts prevent you from uninstalling a package, you can remove them as the last option.

    mv /var/lib/dpkg/info/plesk-config-troubleshooter.prerm ~/
    mv /var/lib/dpkg/info/plesk-config-troubleshooter.postrm ~/

    Or you can just edit the file, put

    exit 0

    somewhere before the error happens.

  • dpkg

    To force delete a package, run

    dpkg --purge --force-depends PKG_NAME

    List all Installed packages

    dpkg -l

    List all files in a package

    dpkg -L PKG_NAME

    To find which package provides a file

    dpkg -S /usr/bin/nmap

    Apt

  • subprocess installed post-installation script returned error

    When installing software on Ubuntu, i get following error.

    It is likely that 4.5.2-armada375 belongs to a chroot's host
    Building only for 4.9.58-armada375
    Building initial module for 4.9.58-armada375
    Error! Bad return status for module build on kernel: 4.9.58-armada375 (armv7l)
    Consult /var/lib/dkms/spl/0.6.5.6/build/make.log for more information.
    dpkg: error processing package spl-dkms (--configure):
     subprocess installed post-installation script returned error exit status 10
    Setting up dh-python (2.20151103ubuntu1) ...
    Processing triggers for libc-bin (2.23-0ubuntu3) ...
    Errors were encountered while processing:
     spl-dkms
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    To fix this, run

    rm /var/lib/dpkg/info/PACKAGE_NAME_HERE.*
    dpkg --configure -a
    apt update
    

    Replace PACKAGE_NAME_HERE with actual package that fail. In this cause spl-dkms.

    root@ns539260:/var/lib/dpkg/info# ls -l | grep spl
    -rw-r--r-- 1 root root   11811 Nov 22 07:41 spl-dkms.list
    -rw-r--r-- 1 root root   19548 Apr  7  2016 spl-dkms.md5sums
    -rwxr-xr-x 1 root root     891 Apr  7  2016 spl-dkms.postinst
    -rwxr-xr-x 1 root root     312 Apr  7  2016 spl-dkms.prerm
    root@ns539260:/var/lib/dpkg/info# rm spl-dkms.*
    

    See apt