호스트 이름: 이름 또는 서비스를 알 수 없음

호스트 이름: 이름 또는 서비스를 알 수 없음

2개의 패키지를 설치하는 동안 이 오류가 발생합니다.

root@blackbox:~# apt-get install mpack ssmtp
Reading package lists... Done
Building dependency tree
Reading state information... Done
mpack is already the newest version.
ssmtp is already the newest version.
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.
Do you want to continue? [Y/n] Y
Setting up ssmtp (2.64-8) ...
hostname: Name or service not known
dpkg: error processing package ssmtp (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mailutils:
 mailutils depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package mail-transport-agent is not installed.
  Package ssmtp which provides mail-transport-agent is not configured yet.

dpkg: error processing package mailutils (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 ssmtp
 mailutils
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@blackbox:~#

답변1

문제는 입력한 값이 /etc/hostname의 어떤 항목과도 ​​일치하지 않는다는 것입니다 /etc/hosts.

이로 인해 명령이 hostname --fqdn확인되지 않은 호스트 이름을 반환하여 ssmtp설치를 방해합니다.

컴퓨터의 호스트 이름을 /etc/hosts.

관련 오류:

답변2

정말 끔찍해 보입니다.

hostname: Name or service not known
dpkg: error processing package ssmtp (--configure):
 subprocess installed post-installation script returned error exit status 1

hostname스크립트에 사용됩니다 postinst(데비안 패키지 유지관리자 가이드에 설명되어 있습니다 -협회)실패한.

버전 2.64-8(amd64)에 언급된 패키지를 확인하면 ssmtp다음 스크립트가 있습니다.

#!/bin/sh

set -e

if test -L /usr/doc/ssmtp
then
    rm -f /usr/doc/ssmtp 2>/dev/null || true
fi

. /usr/share/debconf/confmodule

db_get ssmtp/root
root="$RET"

db_get ssmtp/mailhub
mailhub="${RET:-mail}"

db_get ssmtp/port
port="$RET"

db_get ssmtp/hostname
hostname="${RET:-`hostname --fqdn`}"

db_get ssmtp/rewritedomain
rewritedomain="$RET"

if test -s /etc/mailname
then
    :
else
    test -n "$hostname" && MailName="$hostname"
    test -n "$rewritedomain" && MailName="$rewritedomain"

    touch /etc/mailname
    chmod 644 /etc/mailname
    echo "$MailName" > /etc/mailname
fi

db_get ssmtp/fromoverride
test "$RET" = "true" && FromOverride=YES

test -d /etc/ssmtp || exit 1

if test -s /etc/ssmtp/ssmtp.conf
then
    if test "$port" = "25" -o -z "$port"
    then
        :
    else
        mailhub=${mailhub}:$port
    fi
    test -z "$FromOverride" && FromOverride=NO

    touch /etc/ssmtp/ssmtp.conf.tmp
    chmod 644 /etc/ssmtp/ssmtp.conf.tmp

    sed "s/^root=.*/root=$root/;s/^mailhub=.*/mailhub=$mailhub/;s/^rewriteDomain=.*/rewriteDomain=$rewritedomain/;s/^hostname=.*/hostname=$hostname/;s/^FromLineOverride=.*/FromLineOverride=$FromOverride/;s/^#FromLineOverride=.*/FromLineOverride=$FromOverride/" /etc/ssmtp/ssmtp.conf > /etc/ssmtp/ssmtp.conf.tmp
    mv -f /etc/ssmtp/ssmtp.conf.tmp /etc/ssmtp/ssmtp.conf
else
    touch /etc/ssmtp/ssmtp.conf
    chmod 644 /etc/ssmtp/ssmtp.conf

    exec 1>/etc/ssmtp/ssmtp.conf

    echo "#"
    echo "# Config file for sSMTP sendmail"
    echo "#"
    echo "# The person who gets all mail for userids < 1000"
    echo "# Make this empty to disable rewriting."
    echo "root=$root"
    echo
    echo "# The place where the mail goes. The actual machine name is required no "
    echo "# MX records are consulted. Commonly mailhosts are named mail.domain.com"
    if test "$port" = "25" -o -z "$port"
    then
        echo "mailhub=$mailhub"
    else
        echo "mailhub=${mailhub}:$port"
    fi
    echo
    echo "# Where will the mail seem to come from?"
    test -z "$rewritedomain" && echo -n "#"
    echo "rewriteDomain=$rewritedomain"
    echo ""
    echo "# The full hostname"
    echo "hostname=$hostname"
    echo
    echo "# Are users allowed to set their own From: address?"
    echo "# YES - Allow the user to specify their own From: address"
    echo "# NO - Use the system generated From: address"
    test -z "$FromOverride" && echo -n "#"
    echo "FromLineOverride=YES"
fi

# Program End
exit 0

가장 중요한 것은:

hostname="${RET:-`hostname --fqdn`}"

언급했듯이 hostname --fqdn실패했습니다. 다음 사항을 확인하세요.

  • 명령이 존재합니다
  • hostname --fqdn어떤 명령이 반환됩니까?

관련 정보