qmail-inject: fatal: qq trouble creating files in queue (#4.3.0)

I'm having trouble getting qmail to work. Trying to put a script together for all to use but getting stuck.
When I try
echo "hello" | /var/qmail/bin/qmail-inject
I get the error qmail-inject: fatal: qq trouble creating files in queue (#4.3.0)
On top of that, having issues connecting to it via port 995. Pretty sure it's the /usr/local/etc/rc.d/qmail.sh I have at the end of the script.
Absolutely any suggestions welcome :)

If anyone can see where I've made the mistake on the install script, please let me know. I've had it working perfectly in the past with DKIM, etc... but stupidly didn't save the installation scripts and have forgotten what I did :( Right now, just want to get the base working so I can progress and get the entire script complete with the dns and dkim settings.

These are the permissions that it results in with the installation
Code:
drwxr-sr-x   2 alias   qmail    5 Mar  8 07:45 alias/
drwxr-xr-x   2 root    qmail   48 Mar  8 07:45 bin/
drwxr-xr-x   2 root    qmail   15 Mar  8 07:45 boot/
drwxr-xr-x   2 root    qmail   10 Mar  8 07:45 configure/
drwxr-xr-x   2 root    qmail   19 Mar  8 07:45 control/
drwxr-xr-x   2 root    qmail   35 Mar  8 07:45 doc/
drwxr-xr-x   6 root    qmail    6 Mar  8 07:45 man/
drwxr-x---  11 qmailq  qmail   11 Mar  8 07:45 queue/
-r-xr-xr-x   1 root    qmail  347 Mar  8 07:45 rc*
drwxr-xr-x   2 root    qmail    4 Mar  8 07:45 scripts/
drwxr-xr-x   2 root    qmail    5 Mar  8 07:45 users/
Code:
alias:*:81:81:User &:/var/qmail/alias:/sbin/nologin
qmaild:*:82:81:User &:/var/qmail:/sbin/nologin
qmaill:*:83:81:User &:/var/qmail:/sbin/nologin
qmailp:*:84:81:User &:/var/qmail:/sbin/nologin
qmailq:*:85:82:User &:/var/qmail:/bin/sh
qmailr:*:86:82:User &:/var/qmail:/bin/sh
qmails:*:87:82:User &:/var/qmail:/bin/sh
vpopmail:*:89:89:User &:/usr/local/vpopmail:/sbin/nologin

Code:
ll /var/qmail/bin
total 683
-rwxr-xr-x  1 root    qmail  24248 Mar  8 07:45 autorespond*
-rwxr-xr-x  1 root    wheel  13920 Mar  8 07:45 bouncesaying*
-rwxr-xr-x  1 root    wheel  21712 Mar  8 07:45 condredirect*
-rwxr-xr-x  1 root    wheel    126 Mar  8 07:45 datemail*
-rwxr-xr-x  1 root    wheel    114 Mar  8 07:45 elq*
-rwxr-xr-x  1 root    wheel  13608 Mar  8 07:45 except*
-rwxr-xr-x  1 root    wheel  20248 Mar  8 07:45 forward*
-rwxr-xr-x  1 root    wheel  25880 Mar  8 07:45 maildir2mbox*
-rwxr-xr-x  1 root    wheel  12896 Mar  8 07:45 maildirmake*
-rwxr-xr-x  1 root    wheel  24528 Mar  8 07:45 maildirwatch*
-rwxr-xr-x  1 root    wheel    179 Mar  8 07:45 mailsubj*
-rwxr-xr-x  1 root    wheel    115 Mar  8 07:45 pinq*
-rwxr-xr-x  1 root    wheel  18232 Mar  8 07:45 predate*
-rwxr-xr-x  1 root    wheel  19088 Mar  8 07:45 preline*
-rwxr-xr-x  1 root    wheel    115 Mar  8 07:45 qail*
-rwxr-xr-x  1 root    wheel  16872 Mar  8 07:45 qbiff*
-rwx--x--x  1 root    wheel  15144 Mar  8 07:45 qmail-clean*
-rwx--x--x  1 root    wheel  10024 Mar  8 07:45 qmail-getpw*
-rwxr-xr-x  1 root    wheel  54600 Mar  8 07:45 qmail-inject*
-rwx--x--x  1 root    wheel  47952 Mar  8 07:45 qmail-local*
-rwx------  1 root    wheel  24512 Mar  8 07:45 qmail-lspawn*
-rwx------  1 root    wheel  21176 Mar  8 07:45 qmail-newmrh*
-rwx------  1 root    wheel  17688 Mar  8 07:45 qmail-newu*
-rwxr-xr-x  1 root    wheel  28976 Mar  8 07:45 qmail-pop3d*
-rwx--x--x  1 root    wheel  18552 Mar  8 07:45 qmail-popup*
-rwx--x--x  1 root    wheel  22296 Mar  8 07:45 qmail-pw2u*
-rwxr-xr-x  1 root    wheel  20240 Mar  8 07:45 qmail-qmqpc*
-rwxr-xr-x  1 root    wheel  22344 Mar  8 07:45 qmail-qmqpd*
-rwxr-xr-x  1 root    wheel  32064 Mar  8 07:45 qmail-qmtpd*
-rwxr-xr-x  1 root    wheel  22216 Mar  8 07:45 qmail-qread*
-rwxr-xr-x  1 root    wheel    371 Mar  8 07:45 qmail-qstat*
-rws--x--x  1 qmailq  wheel  19288 Mar  8 07:45 qmail-queue*
-rwx--x--x  1 root    wheel  57040 Mar  8 07:45 qmail-remote*
-rwx--x--x  1 root    wheel  19120 Mar  8 07:45 qmail-rspawn*
-rwx--x--x  1 root    wheel  58920 Mar  8 07:45 qmail-send*
-rwxr-xr-x  1 root    wheel  21608 Mar  8 07:45 qmail-showctl*
-rwxr-xr-x  1 root    wheel  66440 Mar  8 07:45 qmail-smtpd*
-rwx------  1 root    wheel   8776 Mar  8 07:45 qmail-start*
-rwxr-xr-x  1 root    wheel  13152 Mar  8 07:45 qmail-tcpok*
-rwxr-xr-x  1 root    wheel  15064 Mar  8 07:45 qmail-tcpto*
-rwxr-xr-x  1 root    wheel  35456 Mar  8 07:45 qreceipt*
-rwxr-xr-x  1 root    wheel  16768 Mar  8 07:45 qsmhook*
-rwxr-xr-x  1 root    wheel  16080 Mar  8 07:45 sendmail*
-rwx--x--x  1 root    wheel  11320 Mar  8 07:45 splogger*
-rwxr-xr-x  1 root    wheel  24744 Mar  8 07:45 tcp-env*
-rwxr-xr-x  1 root    wheel    608 Mar  8 07:45 update_tmprsadh*
This is the install script.
Code:
killall -m qmail
killall -m tcpserver
killall -m sslserver

sysrc sendmail_enable="NONE"
killall sendmail

echo "Enter your domain name for the mail server. i.e. mail.example.com"
read FQDN
echo "Enter the admin email address for .qmail-postmaster. This will also be used in vpopmail. i.e. [email]admin@example.com[/email]"
read EMAILADDRESS
echo "Enter a password to use in vpopmail user account"
read PASSWORD


pw userdel -r -n alias
pw userdel -r -n qmaild
pw userdel -r -n qmaill
pw userdel -r -n qmailp
pw userdel -r -n qmailq
pw userdel -r -n qmailr
pw userdel -r -n qmails
pw groupdel qmail
pw groupdel qnofiles
pw groupdel vchkpw
pw userdel -r -n vpopmail


rm -r /var/qmail
rm -r /usr/local/vpopmail
mkdir /var/qmail
mkdir /usr/local/vpopmail
mkdir /var/qmail/alias

pw groupadd qnofiles -g 81
pw useradd -g qnofiles -d /var/qmail/alias -n alias -u 81 -s /sbin/nologin
pw useradd -g qnofiles -d /var/qmail -n qmaild -u 82 -s /sbin/nologin
pw useradd -g qnofiles -d /var/qmail -n qmaill -u 83 -s /sbin/nologin
pw useradd -g qnofiles -d /var/qmail -n qmailp -u 84 -s /sbin/nologin
pw groupadd qmail -g 82
pw useradd -g qmail -d /var/qmail -n qmailq -u 85
pw useradd -g qmail -d /var/qmail -n qmailr -u 86
pw useradd -g qmail -d /var/qmail -n qmails -u 87
pw groupadd vchkpw -g 89
pw useradd -g vchkpw -d /usr/local/vpopmail -n vpopmail -u 89 -s /sbin/nologin



cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root
chmod 644 ~alias/.qmail*
echo "$EMAILADDRESS" > .qmail-postmaster 
echo "$EMAILADDRESS" > .qmail-mailer-daemon 
echo "$EMAILADDRESS" > .qmail-root 

chmod 2755 ~alias


# echo 'DEFAULT_VERSIONS+=ssl=openssl' > /etc/make.conf
# echo 'QMAIL_SLAVEPORT=tls' >> /etc/make.conf

#DNS_CNAME
#DOCS
#RCDLINK
#SMTP_AUTH_PATCH

cp -R /usr/ports/mail/qmail-tls /usr/ports/mail/qmail-tls.backup
cd /usr/ports/mail/qmail-tls 
make deinstall
make clean
echo "Ensure to check SMTP_AUTH_PATCH. Click Enter to continue..."
read clickenter
make config 
wait
make install

cp /var/qmail/boot/maildir /var/qmail/rc
mv /usr/lib/sendmail /usr/lib/sendmail.old
mv /usr/sbin/sendmail /usr/sbin/sendmail.old
mv /usr/local/sbin/sendmail /usr/local/sbin/sendmail.old
cd /usr/lib/
ln -s /var/qmail/bin/sendmail
cd /usr/sbin/
ln -s /var/qmail/bin/sendmail
cd /usr/local/sbin
ln -s /var/qmail/bin/sendmail


openssl genrsa -out x.key 2048
openssl req -new -key x.key -out x.csr
openssl x509 -req -days 3650 -in x.csr -signkey x.key -out x.crt
cat x.crt x.key > servercert.pem
chmod 644 servercert.pem
chown root:qmail servercert.pem
cp -p servercert.pem /var/qmail/control

[ -d "/usr/src/vpopmail-5.4.33" ] && rm -r /usr/src/vpopmail-5.4.33
cd /usr/src
fetch [URL]http://onshu.net/apps/vpopmail-5.4.33.tar.gz[/URL]
gzip -dc vpopmail-5.4.33.tar.gz | tar -xf -
cd /usr/src/vpopmail-5.4.33
sed -i '' -e 's/.*bounce-no-mailbox\\n.*/fprintf(fs, "| %s\/bin\/vdelivermail '"''"' %s\/domains\/%s\/postmaster\\n", VPOPMAILDIR, dir, domain);/' vpopmail.c

fetch [URL]http://onshu.net/apps/autorespond.tar.gz[/URL]
gzip -dc autorespond.tar.gz | tar -xf -
gcc -Wall -o autorespond autorespond.c
cp autorespond /var/qmail/bin/


pkg install -y ucspi-tcp
pkg install -y ucspi-ssl
pkg install -y daemontools

cd /usr/ports/mail/ezmlm-idx
make deinstall
make clean
make install clean

mkdir ~vpopmail/etc
echo '127.0.0.:allow,RELAYCLIENT=""' >> /usr/local/vpopmail/etc/tcp.smtp
echo '192.168.0.:allow,RELAYCLIENT=""' >> /usr/local/vpopmail/etc/tcp.smtp
echo '0.0.0.:allow,RELAYCLIENT=""' >> /usr/local/vpopmail/etc/tcp.smtp
echo ':allow,RELAYCLIENT=""' >> /usr/local/vpopmail/etc/tcp.smtp
tcprules /usr/local/vpopmail/etc/tcp.smtp.cdb /usr/local/vpopmail/etc/tcp.smtp.tmp < /usr/local/vpopmail/etc/tcp.smtp

cd /usr/src/vpopmail-5.4.33
./configure \
--prefix=/usr/local/vpopmail \
--mandir=/usr/local/vpopmail/man \
--enable-qmaildir=/var/qmail/ \
--enable-qmail-newu=/var/qmail/bin/qmail-newu  \
--enable-qmail-inject=/var/qmail/bin/qmail-inject  \
--enable-qmail-newmrh=/var/qmail/bin/qmail-newmrh  \
--enable-tcprules-prog=/usr/local/bin/tcprules  \
--enable-tcpserver-file=/usr/local/vpopmail/etc/tcp.smtp  \
--enable-clear-passwd  \
--enable-many-domains  \
--enable-qmail-ext  \
--enable-logging=y  \
--enable-auth-logging=y  \
--enable-libdir=/usr/lib/  \
--disable-passwd  \
--enable-domainquotas  \
--enable-roaming-users \
--enable-vpopuser=vpopmail \
--enable-vpopgroup=vchkpw \
--enable-incdir=/usr/local/include \
--disable-users-big-dir 

make && make install-strip



echo "$FQDN" > /var/qmail/control/me
echo "$FQDN" > /var/qmail/control/defaultdomain
echo "$FQDN" > /var/qmail/control/plusdomain
echo "$FQDN" > /var/qmail/control/rcpthosts
echo "$FQDN" > /var/qmail/control/locals
echo "./Maildir/" > /var/qmail/control/defaultdelivery
echo "1000" > /var/qmail/control/concurrencyremote
echo "1000" > /var/qmail/control/concurrencylocal
echo "120" > /var/qmail/control/queuelifetime


openssl ciphers > /var/qmail/control/tlsclientciphers
openssl ciphers > /var/qmail/control/tlsserverciphers


echo "/usr/local/vpopmail/bin/vdeldomain $FQDN"
/usr/local/vpopmail/bin/vdeldomain $FQDN
echo "/usr/local/vpopmail/bin/vadddomain $FQDN $PASSWORD"
/usr/local/vpopmail/bin/vadddomain $FQDN $PASSWORD
echo "/usr/local/vpopmail/bin/vadduser $EMAILADDRESS $PASSWORD"
/usr/local/vpopmail/bin/vadduser $EMAILADDRESS $PASSWORD

cat<<__EOF > /usr/local/etc/rc.d/qmail.sh
#!/bin/sh
if [ ! -f /var/qmail/rc ]; then
  echo "/var/qmail/rc missing"
        exit 0
fi

case "\$1" in
start)
        export SMTPAUTH='!'
        csh -cf '/var/qmail/rc start &'
        /var/qmail/bin/qmail-start ./Maildir/ splogger qmail &

        /usr/bin/nohup /usr/local/bin/tcpserver -l0 -H -R 0 pop3 /var/qmail/bin/qmail-popup $FQDN /usr/local/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir&
        /usr/bin/nohup /usr/local/bin/tcpserver -l0 -H -R 0 995 /var/qmail/bin/qmail-popup $FQDN /usr/local/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir&
        /usr/bin/nohup /usr/local/bin/tcpserver -vHR -c 240 -l $FQDN -x /usr/local/vpopmail/etc/tcp.smtp.cdb -u 89 -g 89 0 587 /var/qmail/bin/qmail-smtpd $FQDN /usr/local/vpopmail/bin/vchkpw /usr/bin/true&
        
        #qmailtcpserver: usage: tcpserver [ -1UXpPhHrRoOdDqQv ] [ -c limit ] [ -x rules.cdb ] [ -B banner ] [ -g gid ] [ -u uid ] [ -b backlog ] [ -l localname ] [ -t timeout ] host port program
        cmdtext="starting"
        ;;
stop)
        killall -m qmail
        killall -m tcpserver
        killall -m sslserver
        cmdtext="stopping"
        ;;
restart)
/usr/local/etc/rc.d/qmail.sh stop
/usr/local/etc/rc.d/qmail.sh start
;;
*)
        echo "Usage: \$0 {start|stop|restart}"
        exit 1
        ;;
esac

echo "QMail \$cmdtext."
exit 0

__EOF

chmod +x /usr/local/etc/rc.d/qmail.sh
/usr/local/etc/rc.d/qmail.sh restart
# /usr/libexec/locate.updatedb
cd /usr/local/bin
ln -s /usr/local/etc/rc.d/qmail.sh qmail
ps -aux | grep qmail
 
Don't post the same question multiple times please. Also the Howto section is not for asking how to do things.
 
Code:
cd /usr/src/vpopmail-5.4.33
Don't go that route. Use ports or packages. Please don't compile something you found on the internet, especially if you have no idea what you're doing.
Code:
cd /usr/src
fetch http://onshu.net/apps/vpopmail-5.4.33.tar.gz
Don't put anything else in /usr/src. It's where the FreeBSD sources live.

I would recommend not using Qmail either, it's really old, and barely supported. I suggest using a more modern approach with mail/exim or mail/postfix.
 
Don't go that route. Use ports or packages. Please don't compile something you found on the internet, especially if you have no idea what you're doing.
Code:
cd /usr/src
fetch http://onshu.net/apps/vpopmail-5.4.33.tar.gz
Don't put anything else in /usr/src. It's where the FreeBSD sources live.

I would recommend not using Qmail either, it's really old, and barely supported. I suggest using a more modern approach with mail/exim or mail/postfix.
Ran the script on another server I have that's not using the zfs and works perfectly. Tried mounting /var/qmail from zroot/ which made no difference. Compared all permissions between the two machines. Got me completely baffled :( Used to write pgsql patches for qmail in the past. Just can't work out why I'm getting the qmail-inject error :( Thanks for your input though ;) Appreciated.
 
Back
Top