Ubuntu 服务器 14.04
apt-get install <package>
产生错误:
E: Waited for /usr/sbin/dpkg-preconfigure --apt || true but it wasn't there
E: Failure running script /usr/sbin/dpkg-preconfigure --apt || true
dpkg 似乎已经安装,请参阅:
$ sudo apt-get install dpkg
Reading package lists... Done
Building dependency tree
Reading state information... Done
dpkg is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
我该如何修复这个包裹?
我试过
sudo apt-get install --reinstall dpkg
但这个操作当然会产生同样的错误。
答案1
这意味着您的配置脚本存在一些问题,因为它DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
不存在,所以您必须创建它。
尝试使用这个命令来创建它:
sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};' >> /etc/apt/apt.conf.d/70debconf"
分步进行:
打开 /etc/apt/apt.conf.d/70debconf
gksudo gedit /etc/apt/apt.conf.d/70debconf
添加此行并保存:
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
现在再试一次