在 Debian 10.9 服务器上安装一些软件时,我收到此错误:
$ sudo apt-get install fail2ban
... [cut]
Running sa-compile (may take a long time)
command 're2c -i -b -o scanner1.c scanner1.re' failed: exit 0
dpkg: error processing package sa-compile (--configure):
installed sa-compile package post-installation script subprocess returned error exit status 12
Setting up fail2ban (0.10.2-2.1)...
... [cut]
Errors were encountered while processing:
sa-compile
E: Sub-process /usr/bin/dpkg returned an error code (1)
我之前已经安装过spamassassin
(sa-compile
的依赖项)。这让我很困惑,所以我尝试 dpkg-reconfigure:
$ sudo dpkg-reconfigure sa-compile
/usr/sbin/dpkg-reconfigure: sa-compile is broken or not fully installed
安装软件包--reinstall
是无操作的。使用--fix-broken
它会返回一个熟悉的错误:
$ sudo apt-get install --fix-broken sa-compile
Setting up sa-compile (3.4.2-1+deb10u3) ...
Running sa-compile (may take a long time)
command 're2c -i -b -o scanner1.c scanner1.re' failed: exit 0
dpkg: error processing package sa-compile (--configure):
installed sa-compile package post-installation script subprocess returned error exit status 12
Errors were encountered while processing:
sa-compile
E: Sub-process /usr/bin/dpkg returned an error code (1)
我该如何解决这个问题?
答案1
退出代码 12 通常是ENOMEM
(如果它没有被换行),所以我猜你根本没有足够的内存来完成 sa 的编译。首先尝试停止某些操作(泄漏内存或占用大量内存),或者重新启动它或重新启动整个主机,然后重试。