Your message dated Sat, 16 Feb 2019 02:11:45 -0500
with message-id <8761620.zDEEVW8eWc@kitterma-e6430>
and subject line Re: Bug#708420: postfix: With multiple instances, the init 
script  does not start all instances
has caused the Debian Bug report #708420,
regarding postfix: With multiple instances, the init script does not start all 
instances
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
708420: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=708420
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: postfix
Version: 2.9.6-2
Severity: normal

I have multiple instances of postfix, each in /etc/postfix/ms/{01,02,...}
Postfix is correctly configured (postmulti lists my instances as enabled).

The function enabled_instances() in the init script is wrong, instead of 
getting a list
of instances directory, it returns a list of "-"

Just modifying this function makes it work again.


-- System Information:
Debian Release: 7.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages postfix depends on:
ii  adduser                3.113+nmu3
ii  cpio                   2.11+dfsg-0.1
ii  debconf [debconf-2.0]  1.5.49
ii  dpkg                   1.16.10
ii  libc6                  2.13-38
ii  libdb5.1               5.1.29-5
ii  libsasl2-2             2.1.25.dfsg1-6
ii  libsqlite3-0           3.7.13-1+deb7u1
ii  libssl1.0.0            1.0.1e-2
ii  lsb-base               4.1+Debian8
ii  netbase                5.0
ii  ssl-cert               1.0.32

Versions of packages postfix recommends:
ii  python  2.7.3-4

Versions of packages postfix suggests:
pn  dovecot-common    <none>
ii  libsasl2-modules  2.1.25.dfsg1-6
pn  mail-reader       <none>
pn  postfix-cdb       <none>
pn  postfix-doc       <none>
pn  postfix-ldap      <none>
ii  postfix-mysql     2.9.6-2
pn  postfix-pcre      <none>
pn  postfix-pgsql     <none>
pn  procmail          <none>
pn  resolvconf        <none>
pn  sasl2-bin         <none>
pn  ufw               <none>

-- Configuration Files:
/etc/init.d/postfix changed:
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/postfix
NAME=Postfix
TZ=
unset TZ
SYNC_CHROOT="y"
test -f /etc/default/postfix && . /etc/default/postfix
test -x $DAEMON && test -f /etc/postfix/main.cf || exit 0
. /lib/lsb/init-functions
enabled_instances() {
        postmulti -l -a | awk '($3=="y") { print $4}'
}
running() {
    INSTANCE="$1"
    if [ "X$INSTANCE" = X ]; then
            POSTCONF="postconf"
    else
            POSTCONF="postmulti -i $INSTANCE -x postconf"
    fi
    queue=$($POSTCONF -h queue_directory 2>/dev/null || echo /var/spool/postfix)
    if [ -f ${queue}/pid/master.pid ]; then
        pid=$(sed 's/ //g' ${queue}/pid/master.pid)
        # what directory does the executable live in.  stupid prelink systems.
        dir=$(ls -l /proc/$pid/exe 2>/dev/null | sed 's/.* -> //; 
s/\/[^\/]*$//')
        if [ "X$dir" = "X/usr/lib/postfix" ]; then
            echo y
        fi
    fi
}
configure_instance() {
    INSTANCE="$1"
    if [ "X$INSTANCE" = X ]; then
            POSTCONF="postconf"
    else
            POSTCONF="postmulti -i $INSTANCE -x postconf"
    fi
    # if you set myorigin to 'ubuntu.com' or 'debian.org', it's wrong, and 
annoys the admins of
    # those domains.  See also sender_canonical_maps.
    MYORIGIN=$($POSTCONF -h myorigin | tr 'A-Z' 'a-z')
    if [ "X${MYORIGIN#/}" != "X${MYORIGIN}" ]; then
        MYORIGIN=$(tr 'A-Z' 'a-z' < $MYORIGIN)
    fi
    if [ "X$MYORIGIN" = Xubuntu.com ] || [ "X$MYORIGIN" = Xdebian.org ]; then
        log_failure_msg "Invalid \$myorigin ($MYORIGIN), refusing to start"
        log_end_msg 1
        exit 1
    fi
    config_dir=$($POSTCONF -h config_directory)
    # see if anything is running chrooted.
    NEED_CHROOT=$(awk '/^[0-9a-z]/ && ($5 ~ "[-yY]") { print "y"; exit}' 
${config_dir}/master.cf)
    if [ -n "$NEED_CHROOT" ] && [ -n "$SYNC_CHROOT" ]; then
        # Make sure that the chroot environment is set up correctly.
        oldumask=$(umask)
        umask 022
        queue_dir=$($POSTCONF -h queue_directory)
        cd "$queue_dir"
        # copy the CA path if specified
        ca_path=$($POSTCONF -h smtp_tls_CApath)
        case "$ca_path" in
            '') :;; # no ca_path
            $queue_dir/*) :;;  # skip stuff already in chroot
            *)
                if test -d "$ca_path"; then
                    dest_dir="$queue_dir/${ca_path#/}"
                    new=0
                    if test -d "$dest_dir"; then
                        # write to a new directory ...
                        dest_dir="${dest_dir%/}.NEW"
                        new=1
                    else
                        mkdir --parent ${dest_dir%/*}
                    fi
                    # handle files in subdirectories
                    (cd "$ca_path" && find . -name '*.pem' -print0 | cpio -0pdL 
--quiet "$dest_dir") 2>/dev/null || 
                        (log_failure_msg failure copying certificates; exit 1)
                    c_rehash "$dest_dir" >/dev/null 2>&1
                    if [ "$new" = 1 ]; then
                        # and replace the old directory
                        rm -r "${dest_dir%.NEW}"
                        mv "$dest_dir" "${dest_dir%.NEW}"
                    fi
                fi
                ;;
        esac
        # if there is a CA file, copy it
        ca_file=$($POSTCONF -h smtp_tls_CAfile)
        case "$ca_file" in
            $queue_dir/*) :;;  # skip stuff already in chroot
            '') # no ca_file
                # or copy the bundle to preserve functionality
                ca_bundle=/etc/ssl/certs/ca-certificates.crt
                if [ -f $ca_bundle ]; then
                    mkdir --parent "$queue_dir/${ca_bundle%/*}"
                    cp -L "$ca_bundle" "$queue_dir/${ca_bundle%/*}"
                fi
                ;;
            *)
                if test -f "$ca_file"; then
                    dest_dir="$queue_dir/${ca_path#/}"
                    mkdir --parent "$dest_dir"
                    cp -L "$ca_file" "$dest_dir"
                fi
                ;;
        esac
        # if we're using unix:passwd.byname, then we need to add etc/passwd.
        local_maps=$($POSTCONF -h local_recipient_maps)
        if [ "X$local_maps" != "X${local_maps#*unix:passwd.byname}" ]; then
            if [ "X$local_maps" = "X${local_maps#*proxy:unix:passwd.byname}" ]; 
then
                sed 's/^\([^:]*\):[^:]*/\1:x/' /etc/passwd > etc/passwd
                chmod a+r etc/passwd
            fi
        fi
        FILES="etc/localtime etc/services etc/resolv.conf etc/hosts \
            etc/nsswitch.conf etc/nss_mdns.config"
        for file in $FILES; do
            [ -d ${file%/*} ] || mkdir -p ${file%/*}
            if [ -f /${file} ]; then rm -f ${file} && cp /${file} ${file}; fi
            if [ -f  ${file} ]; then chmod a+rX ${file}; fi
        done
        # ldaps needs this. debian bug 572841
        (echo /dev/random; echo /dev/urandom) | cpio -pdL --quiet . 2>/dev/null 
|| true
        rm -f usr/lib/zoneinfo/localtime
        mkdir -p usr/lib/zoneinfo
        ln -sf /etc/localtime usr/lib/zoneinfo/localtime
        LIBLIST=$(for name in gcc_s nss resolv; do
            for f in /lib/*/lib${name}*.so* /lib/lib${name}*.so*; do
               if [ -f "$f" ]; then  echo ${f#/}; fi;
            done;
        done)
        if [ -n "$LIBLIST" ]; then
            for f in "$LIBLIST"; do
                rm -f "$f"
            done
            tar cf - -C / $LIBLIST 2>/dev/null |tar xf -
        fi
        umask $oldumask
    fi
}
case "$1" in
    start)
        log_daemon_msg "Starting Postfix Mail Transport Agent" postfix
        RET=0
        # for all instances that are not already running, handle chroot setup 
if needed, and start
        for INSTANCE in $(enabled_instances); do
            RUNNING=$(running $INSTANCE)
            if [ "X$RUNNING" = X ]; then
                configure_instance $INSTANCE
                CMD="/usr/sbin/postmulti -- -i $INSTANCE -x ${DAEMON}"
                if ! start-stop-daemon --start --exec $CMD quiet-quick-start; 
then
                    RET=1
                fi
            fi
        done
        log_end_msg $RET
    ;;
    stop)
        log_daemon_msg "Stopping Postfix Mail Transport Agent" postfix
        RET=0
        # for all instances that are not already running, handle chroot setup 
if needed, and start
        for INSTANCE in $(enabled_instances); do
            RUNNING=$(running $INSTANCE)
            if [ "X$RUNNING" != X ]; then
                CMD="/usr/sbin/postmulti -i $INSTANCE -x ${DAEMON}"
                if ! ${CMD} quiet-stop; then
                    RET=1
                fi
            fi
        done
        log_end_msg $RET
    ;;
    restart)
        $0 stop
        $0 start
    ;;
    force-reload|reload)
        log_action_begin_msg "Reloading Postfix configuration"
        if ${DAEMON} quiet-reload; then
            log_action_end_msg 0
        else
            log_action_end_msg 1
        fi
    ;;
    status)
        ALL=1
        ANY=0
        # for all instances that are not already running, handle chroot setup 
if needed, and start
        for INSTANCE in $(enabled_instances); do
            RUNNING=$(running $INSTANCE)
            if [ "X$RUNNING" != X ]; then
                ANY=1
            else
                ALL=0
            fi
        done
        # handle the case when postmulti returns *no* configured instances
        if [ $ANY = 0 ]; then
           ALL=0
        fi
        if [ $ALL = 1 ]; then
           log_success_msg "postfix is running"
           exit 0
        elif [ $ANY = 1 ]; then
           log_success_msg "some postfix instances are running"
           exit 0
        else
           log_success_msg "postfix is not running"
           exit 3
        fi
    ;;
    flush|check|abort)
        ${DAEMON} $1
    ;;
    *)
        log_action_msg "Usage: /etc/init.d/postfix 
{start|stop|restart|reload|flush|check|abort|force-reload|status}"
        exit 1
    ;;
esac
exit 0


-- debconf information excluded

--- End Message ---
--- Begin Message ---
On Mon, 09 Sep 2013 10:34:15 +0200 Vincent Rischmann <[email protected]> 
wrote:
> 
> On 09/09/2013 03:14, LaMont Jones wrote:
> > tag 708420 + moreinfo
> > --
> > On Wed, May 15, 2013 at 06:57:04PM +0200, Vincent Rischmann wrote:
> >> I have multiple instances of postfix, each in /etc/postfix/ms/{01,02,...}
> >> Postfix is correctly configured (postmulti lists my instances as 
enabled).
> > What is "multi_instance_name" set to in the various instance main.cf 
files?
> multi_instance_name is empty.
> >
> >> The function enabled_instances() in the init script is wrong, instead of 
getting a list
> >> of instances directory, it returns a list of "-"
> > It gets a list of instance names, and then uses them as instance names...
> >
> >> Just modifying this function makes it work again.
> > Although, postmulti does seem to take the full-path directory as well as
> > the instance name, so this may make sense.
> >
> > lamont
> 
> Well the modified script does work in my case, but I guess something is 
> wrong in my configuration since nobody else seems to be having this problem.
> 
> Since I made the bug report, I didn't investigate further, but I'd be 
> happy to help.

The multi-instance support has been rewritten and test pretty widely tested 
since this was filed.  If you still have a problem with this, please reopen 
the bug with further details.

Scott K

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---

Reply via email to