Onedb fsck fails (6.6.0), quotas miscalculated

Hi all,

we are still having problems with various quotas being out of sync with reality - users having negative number of running VMs, users with no VM running but non-zero “running memory”, etc. So I need to run onedb fsck occasionally. Today, it refused to start:

# onedb fsck
Version mismatch: fsck file is for version
Shared: 6.6.0, Local: 6.6.0

Current database is version
Shared: , Local: 

The error message was not very helpful. But OpenNebula 6.6.0 has been running correctly, so database version should be correct. After trying many things, I tried to run also various other onedb subcommands:

onedb show-body vm --id 1234 displayed a correct XML data of that VM. But then onedb history failed with somewhat meaningful error message:

# onedb history
Error connecting to DB: Mysql2::Error: Unsupported charset: '"utf8mb3"'

After re-reading the onedb manual page, I guessed that I could try onedb fsck --charset utf8, as I didn’t know what utf8mb3 means :-). And indeed it worked.

So, why do OpenNebula daemons and some onedb subcommands work, but onedb history connects with the wrong charset, and onedb fsck fails even without a meaningful error message?

Also, does anybody else see miscalculated resource usage for various quotas? I have been seeing it for many ONe versions back.



According to our DB administrator, it could be related to the MariaDB server upgrade several weeks ago. MariaDB 10.6 has apparently different default parameters related to charset:

But it is still strange that most part of OpenNebula work, except onedb fsck and onedb history.

Hello Yenya,
I’ve recently fixed some charset issues in onedb fsck. I believe it should fix also your onedb fsck issue, but it’s not part of any release yet.

For the onedb history, feel free to open GitHub issue to get more attention.

About the quotas - last significant improvement was in release 6.4.1. But apparently, we haven’t fixed everything. We probably miss some quota updates after command failures. It would be very helpful if you know how to reproduce that.
If you have user with wrong quotas, who doesn’t own too many VMs, then the VM logs will be very helpful.

It seems the problem is still there. I ran into it when trying to upgrade to 6.8.0 CE (from Interestingly enough onedb upgrade did not fail immediately after version detection returned an undefined value:

# onedb upgrade -v -u oneadmin -d opennebula -S mydbserver
MySQL Password: 
nil versions are discouraged and will be deprecated in Rubygems 4
Version read:
Shared tables  : 

MySQL dump stored in /var/lib/one/mysql_mydbserver_opennebula_2024-3-15_11:11:59.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file

>>> Running migrators for shared tables
Database already uses version 

>>> Running migrators for local tables
Database already uses version 

Total time: 1.20s
ERROR: Database upgrade to the latest versions (local , shared )
wasn't successful due to missing migration descriptors. Migrators are
provided as part of Enterprise Edition for customers with active subscription.
For community with non-commercial deployments they are provided via a
dedicated migration package, which must be obtained separately.

The database will be restored

Error connecting to DB: Mysql2::Error: Unsupported charset: '"utf8mb3"'
/usr/lib/one/ruby/onedb/onedb_backend.rb:462:in `rescue in connect_db'
/usr/lib/one/ruby/onedb/onedb_backend.rb:456:in `connect_db'
/usr/lib/one/ruby/onedb/onedb_backend.rb:374:in `restore'
/usr/lib/one/ruby/onedb/onedb.rb:199:in `restore'
/usr/lib/one/ruby/onedb/onedb.rb:367:in `upgrade'
/usr/bin/onedb:478:in `block (2 levels) in <main>'
/usr/lib/one/ruby/cli/command_parser.rb:476:in `run'
/usr/lib/one/ruby/cli/command_parser.rb:84:in `initialize'
/usr/bin/onedb:364:in `new'
/usr/bin/onedb:364:in `<main>'

The database will be restored
Error connecting to DB: Mysql2::Error: Unsupported charset: '"utf8mb3"'

I tried to fix this by adding ENCODING = "utf8", to the MySQL backend configuration in oned.conf, but it did not help. So I edited onedb.rb directly, and it did help:

--- /usr/lib/one/ruby/onedb/onedb.rb.orig	2024-03-15 11:48:16.088660356 +0100
+++ /usr/lib/one/ruby/onedb/onedb.rb	2024-03-15 11:30:35.829114464 +0100
@@ -85,7 +85,8 @@
                 :user    => ops[:user],
                 :passwd  => passwd,
                 :db_name => ops[:db_name],
-                :encoding=> ops[:encoding]
+                :encoding=> 'utf8'
+                # :encoding=> ops[:encoding]
         elsif ops[:backend] == :postgresql