重新安装 isc-dhcp-server 时出错“安装后脚本返回错误退出状态 255”

重新安装 isc-dhcp-server 时出错“安装后脚本返回错误退出状态 255”

因此我尝试安装 isc-dhcp-server,但是当我尝试安装它时,显示以下错误。

$ sudo apt-get install isc-dhcp-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
isc-dhcp-server is already the newest version (4.3.3-5ubuntu12.7).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up isc-dhcp-server (4.3.3-5ubuntu12.7) ...
/sbin/restorecon: lstat(/var/lib/dhcpd/dhcpd.leases) failed: No such file or directory
dpkg: error processing package isc-dhcp-server (--configure):
  subprocess installed post-installation script returned error exit status 255
Errors were encountered while processing:
  isc-dhcp-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试先清除它(我尝试重新安装它,因为我在 DRBL 中遇到无法连接到 upstart 的错误)。它被成功删除,但当我尝试重新安装它时,错误就出现了。

还尝试了这些命令:

sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade

然后

sudo apt-get install isc-dhcp-server

============================================

好的,没关系。我找到了解决方案。我删除了 /var/lib/dpkg/info/ 下的所有 isc-dhcp-server 文件。然后重新安装它。

sudo rm /var/lib/dpkg/info/isc-dhcp-server*
sudo apt-get install isc-dhcp-server

答案1

哇... 对我有用。谢谢!我托管了我的服务器,试图编辑权限和其他内容。我试图清理旧租约,但所有内容都受到写保护。卸载并重新安装它,但一切都无法正常工作。这让我可以重新安装它并告诉它覆盖或重新创建丢失的配置文件。

sudo rm /var/lib/dpkg/info/isc-dhcp-server

sudo apt install isc-dhcp-server

相关内容