[Tfug] APCUPSD on Gentoo problem

Steven Bowers steveb7 at simplybits.net
Wed Mar 7 21:12:24 MST 2007


I have a little problem on my Gentoo box that has me rather perplexed 
and I could use a little help trying to solve it. APCUPSD stops 
immediately after starting saying that it cannot communicate with the 
UPS via the serial port.

The machine is an Intel SAI2 running a P3; I have serial ports compiled in;

# Hardware I/O ports
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
CONFIG_SERIO_LIBPS2=y
# Character devices
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# Serial drivers
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
# Non-8250 serial port support
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y

and they show up in the dmesg:

gentoo steve # dmesg |grep tty
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

The exact error from /var/log/apcupsd.events is:
Wed Mar 07 20:35:54 MST 2007  apcupsd FATAL ERROR in smartsetup.c at 
line 171
PANIC! Cannot communicate with UPS via serial port.
Please make sure the port specified on the DEVICE directive is correct,
and that your cable specification on the UPSCABLE directive is correct.
Wed Mar 07 20:36:24 MST 2007  apcupsd error shutdown completed

My /etc/apcupsd.conf file is configured as:

UPSNAME apc1400
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0
LOCKFILE /var/lock
UPSCLASS standalone
UPSMODE disable

which matches the sample config in the manual. The cable connecting the 
UPS to the PC is a 940-0024c.

I know this much from testing:
* the cable is plugged into the right port;
* changing ports, updating config and restarting results in the same error;
* I get the same error whether I emerge the app or compile from source;
* line 171 in smartsetup.c is the last line in the file and the lines 
preceding it are:

for (attempts = 0; attempts < 5; attempts++) {
       char answer[10];

       *answer = 0;
       write(ups->fd, &a, 1);       /* enter smart mode */
       getline(answer, sizeof(answer), ups);
       if (strcmp("SM", answer) == 0)
          goto out;
       sleep(1);
    }
    Error_abort0(
       _("PANIC! Cannot communicate with UPS via serial port.\n"
         "Please make sure the port specified on the DEVICE directive is 
correct,\n"
         "and that your cable specification on the UPSCABLE directive is 
correct.\n"));

  out:
    return 1;





More information about the tfug mailing list