# No VM logs - Error executing state.rb: database is locked

**URL:** <https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608>\
**Category:** Product Support\
**Created:** [June 2, 2022, 4:09pm UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608 "2022-06-02T16:09:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vitekp](https://avatars.discourse-cdn.com/v4/letter/v/e0b2c6/32.png) [@vitekp](https://forum.opennebula.io/u/vitekp)\
**Post date:** [June 2, 2022, 4:09pm UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/1 "2022-06-02T16:09:59Z")

</div>

Hello,

for rollback sake I prepared brand new ONE FE 6.0, restored production DB into it, and granularly upgraded it to the 6.4 without problems. After that I am no longer able to see VM logs - they are empty and monitor.log is full of:  
[Z0][MDP][W]: Failed to monitor VM state for host X: Error executing state.rb: database is locked.

All nodes (KVM) updated to 6.4, all host force synced. FE in Stand-alone mode. OS Ubuntu 20.04.  
“virsh …” can be called by oneadmin.

Any ideas welcomed, thank you.

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [June 2, 2022, 7:17pm UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/2 "2022-06-02T19:17:10Z")

</div>

There is an sqlite database on the virtualization node. The monitoring information is cached on there. There might be an issue with db file itself. It should look like

```auto
oneadmin@ubuntu2004-kvm-qcow2-6-4-rpZvf-2:~$ sqlite3 /var/tmp/one/im/status_kvm_1.db 'select * from states'
3320236b-56c8-4481-bd98-10602c2806bb|62|one-62|3320236b-56c8-4481-bd98-10602c2806bb|1654197356|0|RUNNING|kvm

```

having 1 row per VM. You can delete such database on the host and the monitoring service should recreate it on its own.

---

<div class="post-metadata">

**Author:** ![vitekp](https://avatars.discourse-cdn.com/v4/letter/v/e0b2c6/32.png) [@vitekp](https://forum.opennebula.io/u/vitekp)\
**Post date:** [June 3, 2022, 8:29am UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/3 "2022-06-03T08:29:00Z")

</div>

Thank you Daniel for your quick reply.

I can confirm, that there is such a database, it can be read, contains one VM per row, and when I delete it, monitoring re-creates it immediately.  
The result stays the same unfortunately, still the same error message with one change - right after deleting the db file, I got:  
Failed to monitor VM state for host X: Error executing state.rb: attempt to write a readonly database  
for a few moments, then locked database again.

---

<div class="post-metadata">

**Author:** ![vitekp](https://avatars.discourse-cdn.com/v4/letter/v/e0b2c6/32.png) [@vitekp](https://forum.opennebula.io/u/vitekp)\
**Post date:** [June 3, 2022, 11:24am UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/4 "2022-06-03T11:24:20Z")

</div>

Problem solved.

There were an overlooked monitoring processes accessing the same DB but with bad One FE address on the hosts (leftover from old FE HA cluster). After killing all process groups error messages stopped coming.

---

<div class="post-metadata">

**Author:** ![sadig2](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/sadig2/32/8073_2.png) [@sadig2](https://forum.opennebula.io/u/sadig2)\
**Post date:** [April 19, 2024, 10:11am UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/5 "2024-04-19T10:11:50Z")

</div>

Can you please describe the solution ? i am having the same problem  
killing processes does not sound like permanent solution

---

<div class="post-metadata">

**Author:** ![vpalma](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/vpalma/32/8065_2.png) [@vpalma](https://forum.opennebula.io/u/vpalma)\
**Post date:** [April 30, 2024, 10:26am UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/6 "2024-04-30T10:26:26Z")

</div>

Hi @sadig2 👋

What steps have you performed? As a summary of this thread I recommend the following:

1. Delete the sqlite database located on the Hypervisor node in `/var/tmp/one` (you can delete the entire folder if you wish, this folder will be recreated at sync time).
2. Make sure to kill all existing monitor processes on the Hypervisor node. Multiple running processes at the same time may be due to a recent upgrade or an improper restart of the service.

Best,  
Victor.

---

<div class="post-metadata">

**Author:** ![sadig2](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/sadig2/32/8073_2.png) [@sadig2](https://forum.opennebula.io/u/sadig2)\
**Post date:** [April 30, 2024, 10:30am UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/7 "2024-04-30T10:30:30Z")

</div>

Hi Victor Thank you for your comment

1. Hi, indeed right after deleting sqlite3 file it gets recreated.
2. I tried to restart opennebula and running processes many times - the result stayed the same. Actually i pin pointed that state.rb probe is the one causing errors in the oned.log . I don’t know why.

by “Multiple running processes at the same time” - you mean i get the “database is locked” error because my processes are trying to read from database simultaneously ?

How can i kill state.rb process, when something starts state.rb script as new process every 3-4 seconds/

---

<div class="post-metadata">

**Author:** ![mkutouski](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/mkutouski/32/7923_2.png) [@mkutouski](https://forum.opennebula.io/u/mkutouski)\
**Post date:** [August 14, 2024, 9:12am UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/8 "2024-08-14T09:12:22Z")

</div>

> [@sadig2](#):
>
> How can i kill state.rb process, when something starts state.rb script as new process every 3-4 seconds/

One needs to kill all `/var/tmp/one/im/kvm.d/monitord-client.rb` processes which spawns `state.rb` probe on the hypervisor node.

.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/1/14d66f1130b9cd292905f575da9b68a9f574dd03.png) [@system](https://forum.opennebula.io/u/system)\
**Post date:** [June 25, 2025, 3:47pm UTC](https://forum.opennebula.io/t/no-vm-logs-error-executing-state-rb-database-is-locked/10608/9 "2025-06-25T15:47:01Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
