为什么我会收到错误“子进程 /usr/bin/dpkg 返回错误代码 (1)”(与 openstack-dashboard 相关)?

为什么我会收到错误“子进程 /usr/bin/dpkg 返回错误代码 (1)”(与 openstack-dashboard 相关)?

每当我尝试使用sudo apt-get updatesudo apt-get upgrade,我总是会收到一个与相关的错误openstack-dashboard

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  openstack-dashboard-ubuntu-theme
The following packages will be upgraded:
  heroku
1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/14.0 MB of archives.
After this operation, 190 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 413428 files and directories currently installed.)
Removing openstack-dashboard-ubuntu-theme (2:9.1.2-0ubuntu3) ...
Collecting and compressing static assets...
Traceback (most recent call last):
  File "manage.py", line 18, in <module>
    from django.core.management import execute_from_command_line  # noqa
ImportError: No module named django.core.management
dpkg: error processing package openstack-dashboard-ubuntu-theme (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 openstack-dashboard-ubuntu-theme
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

每次升级或安装新软件包时,您都会收到此错误,因为openstack-dashboard-ubuntu-theme系统中的软件包已损坏。 解决方案:

sudo rm /var/lib/dpkg/info/openstack-dashboard-ubuntu-theme.*

检查您的问题是否解决,如果没有,则执行这些命令。

sudo apt remove --purge openstack-dashboard-ubuntu-theme
sudo apt -f install
sudo apt update

相关内容