Building the rfuser (mainpine octo utilities) to unwedge your ports

Communications | Debian Support

Getting stuck channels on your mainpine octo board and you don't know why?

Well, i don't know why either but if your problem is like mine, I would get stuck channels when someone would attempt to send out and a fax came in on the same channel at the same time.

It would cause a reoccurring log entry in my /var/log/syslog that referred to a wedged port. This would cause the port to freeze and become unusable.

Normally if your port becomes wedged in this manner, you have to reboot or do a power cycle before it will unwedge.

Well, this is why you paid the extra money for the mainpine octo, you can un-stick the ports with out rebooting your server.. here is how:

1) compile the rfuser utility (Get it here) Get all the source code, put it in a folder on the server.
2) Copy all the files into a subfolder then build it from the command prompt:

gcc -o rfuser rfuser.c

3) Here are some pointers for adding rfuser to your HylaFAX "wedged modem" feature.

-----------

Right now the way we do things with wedged/resetmodem goes like this:

If faxgetty or faxsend determine that the modem is unresponsive it will give up (temporarily) and then invoke the /var/spool/hylafax/bin/wedged script. That script, in turn, will look to see if an executable file /var/spool/hylafax/etc/resetmodem exists. If it does, then it will be invoked with the device name as the first parameter ($1).

So the idea is to create a resetmodem script appropriate for the job of resetting the modem.

So create a shell script, /var/spool/hylafax/etc/resetmodem that looks like this:

#!/bin/sh

/path/to/rfuser /dev/$1 reset

exit

Make sure to mark it executable with 'chmod a+x /path/to/rfuser'.

Okay, that done it still may not work due to permissions problems... sometimes HylaFAX installations (depending on things) have faxq running with odd permissions that won't make this so easy. So the admin will get it done most simply by configuring it to work via sudo. The admin will need to create an entry in /etc/sudoers that looks something like this:

uucp ALL = NOPASSWD: /path/to/rfuser

In this case uucp is the user which is used to invoke resetmodem/wedged. If the admin doesn't know how faxq/faxgetty are running then it may be easiest for them to just use this configuration line:

%users ALL = NOPASSWD: /path/to/rfuser

However, that will allow all users to invoke rfuser via sudo, which introduces a mitigated security risk.

Okay, after doing that then the admin will want to modify their resetmodem script to use sudo like this:

#!/bin/sh

sudo /path/to/rfuser /dev/$1 reset

exit

So... ideally the system and HylaFAX should be set up so that rfuser here can be run without sudo. However, in the worst of worst scenarios, using sudo with sudoers configured to invoke rfuser for %users would be the "should work for all" scenario.

The files you need! To compile it copy all 3 files to your server. Then rename them all by removing the .txt from the end of the filename. Then use the command: gcc -o rfuser rfuser.c