节目结束

节目结束

你能帮我解决一下这个问题吗?因为我从 18.04 LTS 升级到了 ubuntu 20.04 LTS。看来脚本在导出值或信息时有问题。我不知道该怎么办。谢谢您的帮助!

错误:

Building dependency tree
Reading state information... Done
ssmtp is already the newest version (2.64-8.1ubuntu1).
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up ssmtp (2.64-8.1ubuntu1) ...
/var/lib/dpkg/info/ssmtp.config: 11: export: #enables: bad variable name
dpkg: error processing package ssmtp (--configure):
 installed ssmtp package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of bsd-mailx:
 bsd-mailx depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not installed.
  Package mail-transport-agent is not installed.
  Package ssmtp which provides mail-transport-agent is not configured yet.
  Package postfix which provides mail-transport-agent is not installed.

dpkg: error processing package bsd-mailx (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apticron:
 apticron depends on bsd-mailx | mailx; however:
  Package bsd-mailx is not configured yet.
  Package mailx is not installed.
  Package bsd-mailx which provides mailx is not configured yet.

dpkg: error processing package apticron (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                                                                                                                                    Errors were encountered while processing:
 ssmtp
 bsd-mailx
 apticron
E: Sub-process /usr/bin/dpkg returned an error code (1)´´´

答案1

以下是 /var/lib/dpkg/info/ssmtp.config 的输出:

/bin/sh 设置 -e

./usr/share/debconf/confmodule

如果 [ -f /etc/ssmtp/ssmtp.conf ] 则 for v 在grep -E >"^(root|mailhub|rewriteDomain|hostname|FromLineOverride)=" /etc/ssmtp/ssmtp.conf do 中导出 $v 完成

  db_set ssmtp/root "$root"
  if [ -n "$mailhub" ]
  then
          if [ `expr index "$mailhub" :` -ne 0 ]
          then
                  db_set ssmtp/port "${mailhub#*:}"
                  db_set ssmtp/mailhub "${mailhub%:*}"
          else
                  db_set ssmtp/port 25
                  db_set ssmtp/mailhub "$mailhub"
          fi
   fi
  if [ -n "$rewriteDomain" ]
  then
          db_set ssmtp/rewritedomain "$rewriteDomain"
  fi
  if [ -n "$hostname" ]
  then
          db_set ssmtp/hostname "$hostname"
  fi
  if [ -n "$FromLineOverride" ]
  then
          if [ "$FromLineOverride" = "YES" ]
          then
                  db_set ssmtp/fromoverride true
          else
                  db_set ssmtp/fromoverride false
          fi
  fi

db_input 中等 ssmtp/root || true db_go

db_input 中等 ssmtp/mailhub || true db_go

db_input 低 ssmtp/port || true db_go

db_input 中等 ssmtp/rewritedomain || true db_go

db_input 低 ssmtp/主机名 || true db_go

db_input 中等 ssmtp/fromoverride || true db_go

节目结束

出口 0

答案2

我可以通过检查 /etc/ssmtp/ 下的 ssmtp.config 文件来解决问题

有一行包含 FromLineOverride=YES 参数,后面跟着一个注释。这个注释似乎是问题所在。当我将注释向上移动一行,使一行中只有参数 i 时,问题就解决了。

相关内容