-   Linux - Software (
-   -   APCUPSD - Unable to create UPS lock file (

sirpimpsalot 06-22-2004 01:40 PM

APCUPSD - Unable to create UPS lock file
I just upgraded my suse 9.0 box to 9.1. Apparently this upgrade takes the kernel from 2.4 to 2.6... which has caused some problems.

this is one of them... anytime I try to start or stop apcupsd from the command line:

apcupsd FATAL ERROR in apcdevice.c at line 105
APCUPSD - Unable to create UPS lock file

Now I have the LOCKFILE variable in the config file pointing to a valid directory with read write execute permission for everyone. I even tried just commenting the lockfile entry out. same error?

the program is sucessfully creating the following file "LCKhiddev[0-15]" in the proper directory with -rw-r--r-- (644) permissions owned by root.

Anyone got any ideas?


imark 07-15-2004 03:47 AM

I have the same problem
I have the same problem with SuSe 9.0 and would be happy if somebody has an idea ....

jester_urans 08-04-2004 08:16 AM

Hello imark!
Think you found the answer already, but for the others:
This error usually occurs if you start the apcupsd twice. If "/etc/init.d/apcupsd stop" doesn't delete the Lockfile, then "joe /var/lock/LCK*" (or what ever the name of the Lockfile is)schows you the PID of the previous apcupsd-process. With "ps -p PID" you look up if it's really a apcupsd running. Then "kill PID"(the one you found out above) schould do the trick. Then "/etc/init.d/apcupsd start" schould be able to create the Lockfile.
Have fun!

jonr 08-23-2004 01:50 PM

I'm having the same problem, and there's no instance of apcupsd running. It never gets off the ground--during boot when the process would start, I get the same message "unable to create USP lock file."

jonr 08-23-2004 02:15 PM

OK, I figured out how to make apcupsd work again. I found various references via Google and it seems there's a bug in the apcupsd software that makes it not release a lock file after a power failure. I had tested it by pulling the power plug (=power failure) and the system shut down properly via apcupsd, very nice. But upon rebooting apcupsd would not start again because of this error--the lockfile still existing.

I deleted the file named /var/lock/apcupsd and then I was able to restart apcupsd.

Now if I only knew how to make that happen automatically next time the power goes out or I test the thing!

But at least that is one way to get it running again.

jonr 08-23-2004 03:21 PM

All right, here's how I got this situation fixed on my Mandrake 9.2 system.

I edited /etc/rc.d/init.d/apcupsd by inserting the line:

rm -f /var/lock/apcupsd

right after

case "$1" in

where there are two pre-existing lines with rm commands.

That worked. I tested it by pulling the plug from the wall. After the five-minute interval I'd set in the configuration file, the system shut down correctly; I then powered off the USP as the program instructs you to, and restored the mains power, powered on the USP, the computer rebooted and USP monitoring is in place again.

I hope this helps somebody.

javipod 11-18-2012 12:24 PM


Be sure your apcupsd service is not running and try again to execute apctest. It works for me ;)


VertigoRay 03-14-2017 10:46 PM

Change LOCKFILE to /tmp
Same issue, I resolved it by changing `LOCKFILE` to `/tmp`:


$ cat /etc/apcupsd/apcupsd.conf | grep LOCKFILE
# LOCKFILE <path to lockfile>

All times are GMT -5. The time now is 10:36 AM.