“运行 newaliases”期间出错

“运行 newaliases”期间出错

我需要一些帮助。

我从这里开始提到:在这篇文章中这个帖子

nitapika@nitapika-51:~$ echo bla | mail -s testmail [email protected]

The program 'mail' is currently not installed. You can install it by typing:
sudo apt-get install mailutils

然后安装mailutils:并收到此错误

Running newaliases
newaliases: warning: valid_hostname: numeric hostname: 04
newaliases: fatal: file /etc/postfix/main.cf: parameter mydomain: bad parameter value: 04
dpkg: error processing package postfix (--configure):
 subprocess installed post-installation script returned error exit status 75
dpkg: dependency problems prevent configuration of mailutils:
 mailutils depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package mailutils (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.21-0ubuntu4) ...No apport report written because the error message indicates its a followup error from a previous failure.

Errors were encountered while processing:
 postfix
 mailutils
E: Sub-process /usr/bin/dpkg returned an error code (1)

nitapika@nitapika-51:~$ sudo /etc/init.d/postfix reload

[....] Reloading postfix configuration (via systemctl): postfix.serviceJob for postfix.service invalid.
 failed!

然后尝试:

nitapika@nitapika-51:~$ sudo apt-get -f install 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postfix (2.11.3-1ubuntu2) ...

Postfix configuration was not changed.  If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
newaliases: warning: valid_hostname: numeric hostname: 04
newaliases: fatal: file /etc/postfix/main.cf: parameter mydomain: bad parameter value: 04
dpkg: error processing package postfix (--configure):
 subprocess installed post-installation script returned error exit status 75
dpkg: dependency problems prevent configuration of mailutils:
 mailutils depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package mailutils (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.21-0ubuntu4) ...No apport report written because the error message indicates its a followup error from a previous failure.

Errors were encountered while processing:
 postfix
 mailutils
E: Sub-process /usr/bin/dpkg returned an error code (1)

进而:

nitapika@nitapika-51:~$ sudo dpkg-reconfigure -plow postfix
/usr/sbin/dpkg-reconfigure: postfix is broken or not fully installed

不确定如何修复此问题。我只需要 logcheck 应用程序向我发送异常信息。

答案1

  1. 正确mydomain/etc/postfix/main.cf

    04不是有效的域名 - 有效值是旅游的入口domain.tld

  2. valid_hostname也改变值。

    这只是一个警告,但主机名不是数字 - 使用输出

     hostname --fqdn
    

之后执行:

sudo newaliases
sudo apt-get install -f

mydomain

    The internet domain name of this mail system. The default is to use
    $myhostname minus the first component, or "localdomain" (Postfix 2.3 
    and later). $mydomain is used as a default value for many other
    configuration parameters.

myhostname

    The internet hostname of this mail system. The default is to use the
    fully-qualified domain name (FQDN) from gethostname(), or to use the
    non-FQDN result from gethostname() and append ".$mydomain".$myhostname
    is used as a default value for many other configuration parameters.

答案2

首先使用命令了解您的主机名:

hostname

编辑/etc/postfix/main.cf文件使用:

sudo nano /etc/postfix/main.cf

现在,改变:

myhostname =

myhostname = your_hostname #name of your hostname

现在重新启动系统并运行:

sudo apt install -f

答案3

在终端中输入以下命令:

$ postconf -d myhostname

现在编辑/etc/postfix/main.cf通过将文件更改为myhostname通过执行上一个命令获得的主机名。即更改:

myhostname = new_hostname

new_hostname是执行命令时获取的主机名$ postconf -d myhostname

更改文件后,保存并运行以下命令:

$ /etc/init.d/postfix reload
$ service postfix reload

相关内容