OpenLightingProject / ola

The Open Lighting Architecture - The Travel Adaptor for the Lighting Industry
https://www.openlighting.org/ola/
Other
647 stars 205 forks source link

failed to acquire lock #1321

Closed naardehaaien closed 7 years ago

naardehaaien commented 7 years ago

Hi guys,

I installed the Ola, using https://opendmx.net/index.php/The_Newbie_Guide_for_OLA_on_Ubuntu

when I run (while my Ettec USB Pro is attached)

olad -l 3

I keep getting this error every 5 seconds

common/io/Serial.cpp:168: Device /dev/ttyUSB0 locked by PID 1996 and process exists, failed to acquire lock

what can be the cause ?

peternewman commented 7 years ago

I'm guessing from the fact you've closed this you've found the answer, but essentially @naardehaaien something else on your machine is using /dev/ttyUSB0, so we can't lock and open it. One of the OLA plugins will be trying to do so (probably the USB Serial one for the Enttec Pro).

naardehaaien commented 7 years ago

Hi,

Well this error occured, I tried to find out what this effect was. But if I checked the next step to "test" the website, .. it works. So it was strange to see this error, while OLA opens, and beeing possible to control lights using OLA. Perhaps if I unplug my keyboard or mouse, this error is disappeared.. I will try this evening.

thank you for your information

Van: "Peter Newman" notifications@github.com Aan: "OpenLightingProject/ola" ola@noreply.github.com Cc: "Hayen K." kevinhayen@pandora.be, "Mention" mention@noreply.github.com Verzonden: Woensdag 20 september 2017 03:46:27 Onderwerp: Re: [OpenLightingProject/ola] failed to acquire lock (#1321)

I'm guessing from the fact you've closed this you've found the answer, but essentially [ https://github.com/naardehaaien | @naardehaaien ] something else on your machine is using /dev/ttyUSB0, so we can't lock and open it. One of the OLA plugins will be trying to do so (probably the USB Serial one for the Enttec Pro).

— You are receiving this because you were mentioned. Reply to this email directly, [ https://github.com/OpenLightingProject/ola/issues/1321#issuecomment-330721334 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AbtpNsLoUMwVcwArwkKc-0D2hroWQMXXks5skG5zgaJpZM4Pcz0y | mute the thread ] .

peternewman commented 7 years ago

I'd say conceptually it's not really an error (it's only at the INFO log level), it's sort of up to the user to interpret it; it could be lock files correctly stopping you opening a device already in use elsewhere, or you stopping OLA grabbing control of a device. You really need to identify which device it is, to work out if the message matters.

It won't be your keyboard or mouse, it's something with/acting like a serial port. If you run "lsusb" then unplug things like the Enttec Pro and other "complicated" USB devices on your machine, and then run it again, you can probably identify which device it is.

sdbbs commented 4 years ago

I use the Enttec USB Pro with OLA on raspberry pi, setup as only 1 universe with the Entec OUT, and I get the same messages in syslog:

$ olad --version
OLA olad version: 0.10.7
$ tail -f /var/log/syslog
...
Jan 20 05:33:20 raspberry systemd[1]: apt-daily-upgrade.timer: Adding 17min 4.728140s random time.
Jan 20 05:33:21 raspberry olad: common/io/Serial.cpp:170: Device /dev/ttyUSB0 locked by PID 481 and process exists, failed to acquire lock
Jan 20 05:33:26 raspberry olad: common/io/Serial.cpp:170: Device /dev/ttyUSB0 locked by PID 481 and process exists, failed to acquire lock
^C

Interesting, let's see what this PID 481 process is:

$ ps axf | grep 481
  481 ?        Sl     0:00 /usr/bin/olad --syslog --log-level 3 --config-dir /var/lib/ola/conf
 1130 pts/0    S+     0:00              \_ grep --color=auto 481

Weird - so olad is complaining, that /dev/ttyUSB0 is locked by olad, that is to say, by itself ?!

How can I interpret this?

peternewman commented 4 years ago

Hi @sdbbs ,

In future you're probably better off starting a new issue for a new problem rather than commenting on a closed one. You can always mention this sounds similar to this issue number.

Jan 20 05:33:21 raspberry olad: common/io/Serial.cpp:170: Device /dev/ttyUSB0 locked by PID 481 and process exists, failed to acquire lock Jan 20 05:33:26 raspberry olad: common/io/Serial.cpp:170: Device /dev/ttyUSB0 locked by PID 481 and process exists, failed to acquire lock ^C


Interesting, let's see what this PID 481 process is:

$ ps axf | grep 481 481 ? Sl 0:00 /usr/bin/olad --syslog --log-level 3 --config-dir /var/lib/ola/conf 1130 pts/0 S+ 0:00 _ grep --color=auto 481



Weird - so `olad` is complaining, that `/dev/ttyUSB0` is locked by `olad`, that is to say, by itself ?!

How can I interpret this?

To diagnose it properly, we'd need the full olad -l 4 logs, see here for how to collect them: https://www.openlighting.org/ola/get-help/ola-faq/#How_do_I_get_olad_-l_4_logs

If I was to guess though, I suspect you've got another Serial based plugin enabled too which is beating the Enttec one to the device, try disabling the Stageprofi plugin and see if that helps. Or disable everything but the plugins you are using.

sdbbs commented 4 years ago

Hi @peternewman,

Many thanks for the response!

In future you're probably better off starting a new issue for a new problem rather than commenting on a closed one. You can always mention this sounds similar to this issue number.

Sorry about that - and I hope I'll be forgiven for posting this comment here too (I'll try to close the issue myself if it reopens); however, I think I managed to fix the issue thanks to your guidance, so I wanted to wrap this issue up, by documenting my steps:

If I was to guess though, I suspect you've got another Serial based plugin enabled too which is beating the Enttec one to the device, try disabling the Stageprofi plugin and see if that helps. Or disable everything but the plugins you are using.

Indeed, I think this was it - and I went through the "disable everything" route, and I think the issue is solved now. Here are the steps I took:

First, I've only ever used DMXter4, Enttec USB DMX Pro, and orangepi-dmx.org/Raspberry Pi DMX USB Pro (in USB dongle mode), with OLA on Raspberry Pi 3B+. Turns out, all of these devices are handled by Serial USB plugin, with a config file at /var/lib/ola/conf/ola-usbserial.conf; so that is the only plugin I need running with OLA as of now.

The state for me, before the change, was:

pi@raspberry:~ $ for ix in /var/lib/ola/conf/*; do echo "-> $(basename $ix)"; grep enabled $ix; done
-> ola-artnet.conf
enabled = true
-> ola-dummy.conf
enabled = true
-> ola-e131.conf
enabled = true
-> ola-espnet.conf
enabled = true
-> ola-ftdidmx.conf
enabled = false
-> ola-gpio.conf
enabled = true
-> ola-karate.conf
enabled = true
-> ola-kinet.conf
enabled = true
-> ola-milinst.conf
enabled = true
-> ola-nanoleaf.conf
enabled = true
-> ola-opendmx.conf
enabled = true
-> ola-openpixelcontrol.conf
enabled = true
-> ola-osc.conf
enabled = true
-> ola-pathport.conf
enabled = true
-> ola-port.conf
-> ola-renard.conf
enabled = true
-> ola-sandnet.conf
enabled = true
-> ola-server.conf
-> ola-shownet.conf
enabled = true
-> ola-spi.conf
enabled = true
-> ola-spidmx.conf
enabled = false
-> ola-stageprofi.conf
enabled = true
-> ola-uartdmx.conf
enabled = true
-> ola-universe.conf
-> ola-usbdmx.conf
enabled = true
-> ola-usbserial.conf
enabled = true

Then, I set all of the plugins to disabled, using:

pi@raspberry:~ $ grep -rl "enabled = true" /var/lib/ola/conf/* | while read f; do echo "$(basename $f) -> setting enabled = false;"; sudo sed -i 's/enabled = true/enabled = false/' $f; done
ola-artnet.conf -> setting enabled = false;
ola-dummy.conf -> setting enabled = false;
ola-e131.conf -> setting enabled = false;
ola-espnet.conf -> setting enabled = false;
ola-gpio.conf -> setting enabled = false;
ola-karate.conf -> setting enabled = false;
ola-kinet.conf -> setting enabled = false;
ola-milinst.conf -> setting enabled = false;
ola-nanoleaf.conf -> setting enabled = false;
ola-opendmx.conf -> setting enabled = false;
ola-openpixelcontrol.conf -> setting enabled = false;
ola-osc.conf -> setting enabled = false;
ola-pathport.conf -> setting enabled = false;
ola-renard.conf -> setting enabled = false;
ola-sandnet.conf -> setting enabled = false;
ola-shownet.conf -> setting enabled = false;
ola-spi.conf -> setting enabled = false;
ola-stageprofi.conf -> setting enabled = false;
ola-uartdmx.conf -> setting enabled = false;
ola-usbdmx.conf -> setting enabled = false;
ola-usbserial.conf -> setting enabled = false;

Finally, I manually set enabled = true in /var/lib/ola/conf/ola-usbserial.conf using:

pi@raspberry:~ $ sudo nano /var/lib/ola/conf/ola-usbserial.conf

Then, I restarted the daemon/service with sudo service olad restart - and now, when I look into tail -f /var/log/syslog, there is no more "common/io/Serial.cpp:170: Device /dev/ttyUSB0 locked by PID 1544 and process exists, failed to acquire lock" in the log every 5 seconds!

Many thanks again for the help!

peternewman commented 4 years ago

Hi @peternewman,

Many thanks for the response!

In future you're probably better off starting a new issue for a new problem rather than commenting on a closed one. You can always mention this sounds similar to this issue number.

Sorry about that - and I hope I'll be forgiven for posting this comment here too (I'll try to close the issue myself if it reopens); however, I think I managed to fix the issue thanks to your guidance, so I wanted to wrap this issue up, by documenting my steps:

That's okay, I was just a bit worried your query might have been missed.

If I was to guess though, I suspect you've got another Serial based plugin enabled too which is beating the Enttec one to the device, try disabling the Stageprofi plugin and see if that helps. Or disable everything but the plugins you are using.

Indeed, I think this was it - and I went through the "disable everything" route, and I think the issue is solved now. Here are the steps I took:

Great, glad you've fixed it.

For future info, the new web UI (link at the bottom of the page), has an easy web based way to enable/disable the plugin status for each plugin.