It would be interesting to know why it would work as a non-root user, though. It should have the same problem regardless of what the uid is.

The way you're meant to lock serial ports is quite elaborate (it was designed to cope with broken NFS locking implementations). First you create a file in /var/lock named after your program and its PID, then you (supposedly atomically) rename that to the name of the lock file you actually want. If the rename fails, someone's beaten you to it, so you report the failure. (In this case, though, the rename has failed for a different reason.)

A non-root user probably can't create the initial file in /var/lock in the first place; this is not a failure (distros probably shouldn't make /var/lock world-writable), it just means that access to your serial port isn't lockfile-locked properly.

NB. Modern Unixes probably don't require lockfile-locking to protect their serial ports, but, for portability, emptool does it anyway.

Peter