无法删除 PHPMyAdmin。Ubuntu 18.04。通常不起作用

无法删除 PHPMyAdmin。Ubuntu 18.04。通常不起作用

我发现升级到 18.04 后 PHPMyAdmin 不再工作,因为它php-mcrypt已被弃用。我收到有关该软件包的错误。我决定删除 phpmyadmin 并尝试重新安装它。

以下是我的尝试:

balter@spectre:/etc/apache2/mods-enabled$ sudo dpkg-reconfigure phpmyadmin
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
balter@spectre:/etc/apache2/mods-enabled$ sudo apt-get purge phpmyadmin*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'phpmyadmin' for glob 'phpmyadmin*'
The following packages were automatically installed and are no longer required:
  dbconfig-common dbconfig-mysql libjs-sphinxdoc php-bz2 php-phpseclib php-tcpdf php7.2-bz2
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  phpmyadmin*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 25.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
(Reading database ... 84795 files and directories currently installed.)
Removing phpmyadmin (4:4.6.6-5) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package phpmyadmin (--remove):
 installed phpmyadmin package pre-removal script subprocess returned error exit status 1
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error while cleaning up:
 installed phpmyadmin package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
balter@spectre:/etc/apache2/mods-enabled$ sudo apt-get remove phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dbconfig-common dbconfig-mysql libjs-sphinxdoc php-bz2 php-phpseclib php-tcpdf php7.2-bz2
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  phpmyadmin
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 25.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
(Reading database ... 84795 files and directories currently installed.)
Removing phpmyadmin (4:4.6.6-5) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package phpmyadmin (--remove):
 installed phpmyadmin package pre-removal script subprocess returned error exit status 1
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error while cleaning up:
 installed phpmyadmin package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)

尝试 1:

balter@spectre:/var/cache/debconf$ sudo rm /var/cache/debconf/*.dat
balter@spectre:/var/cache/debconf$ sudo dpkg-reconfigure phpmyadmin
/usr/sbin/dpkg-reconfigure: phpmyadmin is broken or not fully installed
balter@spectre:/var/cache/debconf$ sudo apt purge phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dbconfig-common dbconfig-mysql libjs-sphinxdoc php-bz2 php-phpseclib php-tcpdf php7.2-bz2
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  phpmyadmin*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 25.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 84795 files and directories currently installed.)
Removing phpmyadmin (4:4.6.6-5) ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
dpkg: error processing package phpmyadmin (--remove):
 installed phpmyadmin package pre-removal script subprocess returned error exit status 10
dbconfig-common: flushing administrative password
dpkg: error while cleaning up:
 installed phpmyadmin package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
balter@spectre:/var/cache/debconf$ sudo apt remove phpmyadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dbconfig-common dbconfig-mysql libjs-sphinxdoc php-bz2 php-phpseclib php-tcpdf php7.2-bz2
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  phpmyadmin
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 25.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 84795 files and directories currently installed.)
Removing phpmyadmin (4:4.6.6-5) ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
dpkg: error processing package phpmyadmin (--remove):
 installed phpmyadmin package pre-removal script subprocess returned error exit status 10
dbconfig-common: flushing administrative password
dpkg: error while cleaning up:
 installed phpmyadmin package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)

第二次尝试

balter@spectre:/var/cache/debconf$ sudo apt autoremove
[sudo] password for balter:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up phpmyadmin (4:4.6.6-5) ...
dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
Replacing config file /etc/dbconfig-common/phpmyadmin.conf with new version
Replacing config file /etc/phpmyadmin/config-db.php with new version
dbconfig-common: flushing administrative password
dpkg: error processing package phpmyadmin (--configure):
 installed phpmyadmin package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

看了看这个错误

debconf:DbDriver“config”:/var/cache/debconf/config.dat 被另一个进程锁定:资源暂时不可用

您需要在重新安装之前解决这个问题phpmyadmin

运行此命令来清除它。

sudo rm /var/cache/debconf/*.dat 

编辑

根据尝试 2 的错误

dpkg:错误处理软件包 phpmyadmin(--remove):已安装的 phpmyadmin 软件包删除前脚本子进程返回错误退出状态 10

我们可以通过运行以下代码手动删除 dpkg 文件:

rm -r /var/lib/dpkg/info/phpmyadmin.*

更多详情请参阅尝试卸载 phpmyadmin “dpkg:清理时出错:”

相关内容