我正在尝试使用以下命令安装 postfix(Ubuntu 18.04.5 LTS):
apt-get install -y postfix
但我收到以下一系列错误:
Reading package lists...
Building dependency tree...
Reading state information...
postfix is already the newest version (3.3.0-1ubuntu0.3).
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 postfix (3.3.0-1ubuntu0.3) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Adding system user `postfix' (UID 111) ...
Adding new user `postfix' (UID 111) with group `postfix' ...
useradd: cannot lock /etc/passwd; try again later.
adduser: `/usr/sbin/useradd -d /var/spool/postfix -g postfix -s /usr/sbin/nologin -u 111 postfix' returned error code 1. Exiting.
dpkg: error processing package postfix (--configure):
installed postfix package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Errors were encountered while processing:
postfix
E: Sub-process /usr/bin/dpkg returned an error code (1)
为了解决此错误我尝试安装“对话”包:
sudo apt-get install dialog
但即使这样也失败了:
Reading package lists...
Building dependency tree...
Reading state information...
Package dialog is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'dialog' has no installation candidate
我必须强调的是,“apt update”也没有解决最后一个问题。
答案1
看起来您只需先设置环境变量 TERM 即可使用对话框前端。
如果它不能解决问题,您可以安装以下(小)包,该包可解决使用 apt 安装包时出现的“找不到类似对话框的前端”错误:
apt install whiptail