Discussion:
[hylafax-users] Avantfax on Archlinux - Sent Faxes Don't Show in Archive?
(too old to reply)
David C. Rankin
2016-09-15 06:50:35 UTC
Permalink
All,

I need help. I have hylafax/avantfax install that I have had since 2009. I
have recently move the install to a new machine running Archlinux. Avantfax
3.3.5 will not work with php 7, so I've downgraded to php 5.6. The install was a
simple manual install. Configure hylafax, unpack the avantfax tgz, move the
'avantfax' folder to my server root, rsync the existing 'avantfax/faxes' and
'avantfax/tmp' folders, go through the manual install and upgrade procedures at

http://www.avantfax.com/install.php
http://www.avantfax.com/upgrading.php

Then a quick trip though 'includes/local_config.php' and confirm the hylafax
etc/hosts.hfaxd, config and config.ttyS0 and we are done.

(a side note, since the old machine's modem was on ttyS1, the new serial port
config caused me to lose the entire inbox, but adding a modem via the
admin/Modems config in avantfax caused the inbox to reappear. I suspect I can
run an update query on the mysql tables and change ttyS1 to ttyS0 out to allow
me to get rid of the dummy modem)

The problem I have is that when I send a fax, there is nothing shown in the
archive. All the mysql accounts and passwords work fine, the inbox displays
find, the Log displays fine, all users, etc are fine, I can update modify the
tables through the admin interface fine, but no matter what I do, when I send a
fax, there is no record in the archive of any fax at all -- huh?

If it matters, the modem is an external MODEM USR USRobotics Courier
V.Everything, and then only reason I think that's important is the looking at a
diff of the class 1/class 2.0 configs created by faxaddmodem I find:

-## AvantFAX configuration
+# Disables the reporting of bad frames by the modem. This
+# overcomes a firmware problem in the x2 and V90 Sportsters.
+# It is not necessary for the Courier modem.
#
-FaxrcvdCmd: bin/faxrcvd.php
-DynamicConfig: bin/dynconf.php
-UseJobTSI: true
-

I can confirm it made no difference as I sent faxes with both a class 1 and
class 2.0 config and had the same behavior with no faxes in the archive. The
class 2.0 setup greatly improved the send fax communication. With the class 1
config, I would get regular SEND FAILED errors, e.g.:

SEND FAILED: JOB 11 DEST 7159339 ERR [125] COMREC invalid command received/no
DIS or DTC

which were hit or miss, but sometimes would cause the fax to fail all 3 times it
was queued. No issue with the class 2.0 config.

So all this leaves me baffled as to why the faxes are not recorded in the
database or shown in the archive? Checking the avantfax.FaxArchive table, there
are no faxes at all shown for the new machine. the only faxes are before the
move where the

$ mysql -u avantfax -p -Bse "select faxnumid, pages, archstamp, modemdev from
avantfax.FaxArchive order by archstamp asc;"
Enter password:
<snip>
24 1 2016-09-08 12:48:56 ttyS1
24 1 2016-09-09 04:31:33 ttyS1

None of the 10 faxes sent today are shown. What should I check to figure out
why the faxes are not winding up in the inbox? Here is a listing of the
hylafax.etc directory:

# l etc
total 100
drwxr-xr-x 3 uucp uucp 4096 Sep 14 18:06 .
drwxr-xr-x 17 uucp uucp 4096 Sep 13 15:12 ..
drwxr-xr-x 12 uucp uucp 4096 Dec 6 2015 templates
-rw-r--r-- 1 uucp uucp 210 Sep 13 18:12 config
-rw-r--r-- 1 uucp uucp 150 Sep 13 15:04 config.sav
-rw-r--r-- 1 uucp uucp 3649 Sep 14 18:06 config.ttyS0
-rw-r--r-- 1 uucp uucp 3791 Sep 14 18:02 config.ttyS0.class_1
-rw-r--r-- 1 uucp uucp 3635 Sep 14 18:04 config.ttyS0.sav
-r--r--r-- 1 root root 10368 Dec 6 2015 cover.templ
-r--r--r-- 1 root root 1855 Dec 6 2015 dialrules
-r--r--r-- 1 root root 2397 Dec 6 2015 dialrules.europe
-r--r--r-- 1 root root 2093 Dec 6 2015 dialrules.sf-ba
-r--r--r-- 1 root root 3235 Dec 6 2015 dpsprinter.ps
-rw------- 1 uucp uucp 297 Sep 14 02:07 hosts.hfaxd
-rw------- 1 root root 20 Sep 14 02:04 hosts.hfaxd.orig
-rw-r--r-- 1 uucp uucp 14072 Dec 6 2015 lutRS18.pcf
-r--r--r-- 1 root root 1281 Sep 13 15:02 setup.cache
-r--r--r-- 1 root root 790 Sep 13 15:02 setup.modem
-rw-r--r-- 1 uucp uucp 4443 Sep 14 19:22 xferfaxlog

Let me know if there is any additional information or tests I can run to help
out. I'm happy to fetch whatever info may shed light on this problem. Thanks.
--
David C. Rankin, J.D.,P.E.


____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-***@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail ***@ifax.com.*
David Mimms
2016-09-15 07:33:42 UTC
Permalink
Post by David C. Rankin
-FaxrcvdCmd: bin/faxrcvd.php
-DynamicConfig: bin/dynconf.php
-UseJobTSI: true
David,

What do you have in etc/config? Can you also show what you have in bin/?

cat /var/spool/hylafax/etc/config

ls -l /var/spool/hylafax/bin/*.php

DM
David C. Rankin
2016-09-15 09:21:44 UTC
Permalink
Post by David Mimms
Post by David C. Rankin
-FaxrcvdCmd: bin/faxrcvd.php
-DynamicConfig: bin/dynconf.php
-UseJobTSI: true
David,
What do you have in etc/config? Can you also show what you have in bin/?
cat /var/spool/hylafax/etc/config
ls -l /var/spool/hylafax/bin/*.php
DM
He hay! Hi David!

without comments, the config is:

# noc /var/spool/hylafax/etc/config
LogFacility: daemon
CountryCode: 1
AreaCode: 936
LongDistancePrefix: 1
InternationalPrefix: 011
DialStringRules: etc/dialrules
ServerTracing: 1
NotifyCmd: bin/notify.php

a shot of the bid dir is:

# l1 /var/spool/hylafax/bin/*.php
/var/spool/hylafax/bin/dynconf.php
/var/spool/hylafax/bin/faxrcvd.php
/var/spool/hylafax/bin/notify.php

Since my php executable is /usr/bin/php56, I updated per the documentation the
interpreter environment in the following files:

/includes/faxcover.php
/includes/notify.php
/includes/phb.php
/includes/dynconf.php
/includes/avantfaxcron.php
/includes/faxrcvd.php

What doesn't make sense is all other mysql related operations work fine. Here is
the information in the SysLog table I've attached as a text attachment here. Let
me know what your think. I'm happy to try anything to get this figured out. This
is the install that still has an account for Aidan Dyk on it, so if needed I can
move the firewall around and give you access again. I think we ought to be able
to solve the mystery.
--
David C. Rankin, J.D.,P.E.
David C. Rankin
2016-09-16 05:00:56 UTC
Permalink
Post by David Mimms
Post by David C. Rankin
-FaxrcvdCmd: bin/faxrcvd.php
-DynamicConfig: bin/dynconf.php
-UseJobTSI: true
David,
What do you have in etc/config? Can you also show what you have in bin/?
cat /var/spool/hylafax/etc/config
ls -l /var/spool/hylafax/bin/*.php
DM
Grr.... It was php.ini open_basedir! Adding /var/spool/hylafax to the
open_basedir path solved the problem. I found the issue attempting a manual
import of the data, e.g.:

[23:49 valkyrie:/var/spool/hylafax] # (for i in `ls doneq/q*`; do bin/notify.php
$i done :30; done)
PHP Warning: file_exists(): open_basedir restriction in effect. File(doneq/q54)
is not within the allowed path(s):
(/srv/http/:/srv/http/htdocs:/home/:/tmp/:/var/lib/egroupware:/usr/local/share:/usr/share/php56/pear/:/usr/share/fonts:/usr/bin)
in /srv/http/avantfax/includes/notify.php on line 30
doneq/q54 doesn't exist
..

After editing php.ini and reloading httpd, all was fine:

[23:51 valkyrie:/var/spool/hylafax] # (for i in `ls doneq/q*`; do bin/notify.php
$i done :30; done)
notify> Executing: doneq/q54 done :30 (4)
totpages: 2
external: 715xxxx
mailaddr: ***@xxxx.com
jobid: 3
receiver:
company:
location:
voice:
regarding:
owner: david
groupid: 3
status:
Found file: docq/doc2.pdf
convert2pdf> starting
convert2pdf> processing tiffs
convert2pdf> copying docq/doc2.pdf to
/srv/http/avantfax/faxes/sent/2016/09/15/715xxxx/235149/3/fax.pdf
convert2pdf> cleaning up...done

It's always those little things.... and with the new PHP error reporting
settings set to production, the error was masked, and not logged to error_log.
Oh well, this post can serve as help for the next dummy that makes the same mistake.

Thanks again David M. 3.3.5 up and running with all data from 2009 imported.
Now we just await 3.3.6 which will be fully PHP7 compatible :)
--
David C. Rankin, J.D.,P.E.


____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-***@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail ***@ifax.com.*
David C. Rankin
2016-09-16 06:47:52 UTC
Permalink
Post by David C. Rankin
Grr.... It was php.ini open_basedir! Adding /var/spool/hylafax to the
open_basedir path solved the problem. I found the issue attempting a manual
Now I'm stumped, I thought I had it fixed when I was able to manually import the
data into avantfax (which worked although it didn't generate the confirmation
image, but I though that was just do to the manual import)

However, sending another test fax -- nothing is moved to Archive. I'm stuck
having to do the manual import to get the faxes from the doneq to the archive.

I show nothing written to the httpd/error_log, but looking over the manual
import results there is one nagging error I don't recognize:

pnmdepth: fwrite() failed to write an image row to the file. errno=32 (Broken pipe)

for example, importing doneq/q67, here is the full output:

[01:31 valkyrie:/var/spool/hylafax] # bin/notify.php doneq/q67 done :30
notify> Executing: doneq/q67 done :30 (4)
totpages: 2
external: 715xxxx
mailaddr: ***@xxxx.com
jobid: 67
receiver:
company:
location:
voice:
regarding:
owner: david
groupid: 67
status:
Found file: docq/doc77.pdf
convert2pdf> starting
convert2pdf> processing tiffs
convert2pdf> copying docq/doc77.pdf to
/srv/http/avantfax/faxes/sent/2016/09/16/715xxxx/013141/67/fax.pdf
convert2pdf> cleaning up...done
convert2pdf> created
/srv/http/avantfax/faxes/sent/2016/09/16/715xxxx/013141/67/fax.pdf in 0ms
/usr/bin/gs -q -dNOPAUSE -sPAPERSIZE=letter -sDEVICE=pnm
-sOutputFile=/srv/http/avantfax/tmp/avantfax-bae21061.tif
/srv/http/avantfax/faxes/sent/2016/09/16/715xxxx/013141/67/fax.pdf -c quit
Post by David C. Rankin
/dev/null 2>/dev/null
/usr/bin/pnmscale -width 80 /srv/http/avantfax/tmp/avantfax-bae21061.tif
2>/dev/null | /usr/bin/pnmdepth 31 | /usr/bin/ppmtogif 2>/dev/null >
/srv/Loading Image...
pnmdepth: fwrite() failed to write an image row to the file. errno=32 (Broken pipe)
/usr/bin/pnmscale -width 750 /srv/http/avantfax/tmp/avantfax-bae21061.tif
2>/dev/null | /usr/bin/pnmdepth 31 | /usr/bin/ppmtogif 2>/dev/null >
/srv/Loading Image...
pnmdepth: fwrite() failed to write an image row to the file. errno=32 (Broken pipe)
notify> Notification email sent to ***@xxxx.com
Done

All of the files are created, so I'm not sure what is triggering the broken
pipe error for pnmdepth. (I presume the broken pipe is the cause of nothing the
archive)

[01:31 valkyrie:/var/spool/hylafax] # l
/srv/http/avantfax/faxes/sent/2016/09/16/7159339/013141/67
total 236
drwxrwxrwx 2 root root 4096 Sep 16 01:31 .
drwxrwxrwx 3 root root 4096 Sep 16 01:31 ..
-rw-rw-rw- 1 root root 181449 Sep 16 01:31 fax.pdf
-rw-r--r-- 1 root root 42024 Sep 16 01:31 prev0.gif
-rw-r--r-- 1 root root 942 Sep 16 01:31 thumb.gif

The fax files are created in /srv/http/avantfax/tmp, e.g.

[01:31 valkyrie:/var/spool/hylafax] # l /srv/http/avantfax/tmp
drwxrwx--- 164 http uucp 4096 Sep 16 01:31 .
drwxr-xr-x 11 http http 4096 Sep 14 01:10 ..
<snip>
-rw-rw-rw- 1 http http 181449 Sep 16 00:44 d70cc6768testfax_20160914.pdf
-rw-rw-rw- 1 http http 181449 Sep 16 01:28 46a17f947testfax_20160914.pdf

Sorry for the early report of success -- but we did solve one issue. Any ideas
on the current state of things?
--
David C. Rankin, J.D.,P.E.


____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-***@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail ***@ifax.com.*
David C. Rankin
2016-09-17 08:35:49 UTC
Permalink
Post by David C. Rankin
pnmdepth: fwrite() failed to write an image row to the file. errno=32 (Broken pipe)
Could the fwrite() failure be related to:

https://bugs.php.net/bug.php?id=39598

http://php.net/manual/en/function.fwrite.php#96951

I've tried picking around through the code, ArchiveIn.php, etc.., but I'm not
familiar enough with the PHP/js to determine if the fwrite() error here is
related to the bug and note in the manual.

Let me know if you have any ideas.

P.S. -- the thumbnail generation works fine, it is just adding the sent fax to
the archive that is not working.
--
David C. Rankin, J.D.,P.E.


____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-***@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail ***@ifax.com.*
David C. Rankin
2016-09-17 10:13:42 UTC
Permalink
Post by David C. Rankin
Post by David C. Rankin
pnmdepth: fwrite() failed to write an image row to the file. errno=32 (Broken pipe)
https://bugs.php.net/bug.php?id=39598
http://php.net/manual/en/function.fwrite.php#96951
I've tried picking around through the code, ArchiveIn.php, etc.., but I'm not
familiar enough with the PHP/js to determine if the fwrite() error here is
related to the bug and note in the manual.
Let me know if you have any ideas.
P.S. -- the thumbnail generation works fine, it is just adding the sent fax to
the archive that is not working.
The log shows that bin/notify.php is being called, the same way I would call it
manually, but it does show a non-zero exit code:

Sep 17 05:10:37 valkyrie FaxSend[15567]: SEND FAX: JOB 71 SENT in 0:00:42
Sep 17 05:10:38 valkyrie FaxQueuer[460]: NOTIFY: bin/notify.php "doneq/q71"
"done" "0:01:17"
Sep 17 05:10:38 valkyrie FaxQueuer[460]: NOTIFY exit status: 0177400 (15619)

thought I would pass that along if it is important.
--
David C. Rankin, J.D.,P.E.


____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-***@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail ***@ifax.com.*
David C. Rankin
2016-09-18 01:06:56 UTC
Permalink
Post by David C. Rankin
The log shows that bin/notify.php is being called, the same way I would call it
Sep 17 05:10:38 valkyrie FaxQueuer[460]: NOTIFY: bin/notify.php "doneq/q71"
"done" "0:01:17"
What happens if you execute the command as uucp (using sudo) from /var/spool/hylafax/?
DM
AAAAAARRRRRRRGGGGGGGHHHHHHHH!!!!!!!!

Shit!

(of course all hell broke loose running as 'sudo -u uucp...`)

# chown http:uucp /srv/http/avantfax/includes/local_config.php

and all is good in the world again!

Thank you DM (once again)! This must be a new restriction with php 5.6. On my
current 5.4 install, there is no complaint with ownership of 'http:http'. So for
reasons I can't explain, the current install requires ownership of 'http:uucp'
to allow the inclusion with 'include
(/srv/http/avantfax/includes/local_config.php);'

It's always the little things that cause you to lose the most hair...
--
David C. Rankin, J.D.,P.E.


____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-***@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail ***@ifax.com.*
Loading...