Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[database.py:insert_item()] - Error inserting key 'instance_id' in namespace 'moonraker' #863

Open
dbarwikowski opened this issue May 27, 2024 · 7 comments

Comments

@dbarwikowski
Copy link

What happened

After moonraker update I receive this error.
I host it on Lenovo Ideacentre Stick 300 PC Mini Desktop. I installed there Ubuntu 18.04.6 LTS.
Everything was running OK before update.

Client

Mainsail

Browser

Chrome

How to reproduce

I was ~100 version behind. Updated using mainsail.

Additional information

-------------------- Log Start | Mon May 27 18:14:19 2024 --------------------
platform: Linux-5.4.0-150-generic-x86_64-with-glibc2.26
data_path: /home/dbarwikowski/printer_data
is_default_data_path: False
config_file: /home/dbarwikowski/printer_data/config/moonraker.conf
startup_warnings: []
verbose: False
debug: False
asyncio_debug: False
is_backup_config: False
is_python_package: False
instance_uuid: a4b6e48f6d594dedabc71ee4eb70c645
unix_socket_path: /home/dbarwikowski/printer_data/comms/moonraker.sock
software_version: v0.8.0-374-g5332eab
git_branch: master
git_remote: origin
git_repo_url: https://github.com/Arksine/moonraker.git
modified_files: []
unofficial_components: []
log_file: /home/dbarwikowski/printer_data/logs/moonraker.log
python_version: 3.7.5 (default, Dec 9 2021, 17:04:37) [GCC 8.4.0]
launch_args: /home/dbarwikowski/moonraker-env/bin/python /home/dbarwikowski/moonraker/moonraker/moonraker.py -d /home/dbarwikowski/printer_data
msgspec_enabled: False
uvloop_enabled: False
2024-05-27 20:14:19,942 [confighelper.py:read_file()] - Configuration File '/home/dbarwikowski/printer_data/config/moonraker.conf' parsed, total size: 593 B
2024-05-27 20:14:19,943 [server.py:add_log_rollover_item()] -
#################### Moonraker Configuration ####################

[server]
host = 0.0.0.0
port = 7125
klippy_uds_address = /home/dbarwikowski/printer_data/comms/klippy.sock

[authorization]
trusted_clients =
10.0.0.0/8
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.168.0.0/16
FE80::/10
::1/128
192.168.0.0/24
192.168.1.0/24
cors_domains =
*.lan
*.local
*://localhost
://localhost:
*://my.mainsail.xyz
*://app.fluidd.xyz

[octoprint_compat]

[history]

[update_manager]
channel = dev
refresh_interval = 168

[update_manager mainsail]
type = web
channel = stable
repo = mainsail-crew/mainsail
path = ~/mainsail

#################################################################
All Configuration Files:
/home/dbarwikowski/printer_data/config/moonraker.conf
#################################################################
2024-05-27 20:14:20,053 [server.py:load_component()] - Component (secrets) loaded
2024-05-27 20:14:20,061 [server.py:load_component()] - Component (template) loaded
2024-05-27 20:14:20,070 [server.py:load_component()] - Component (klippy_connection) loaded
2024-05-27 20:14:20,228 [server.py:load_component()] - Component (application) loaded
2024-05-27 20:14:20,260 [server.py:load_component()] - Component (websockets) loaded
2024-05-27 20:14:20,311 [server.py:load_component()] - Component (dbus_manager) loaded
2024-05-27 20:14:20,322 [server.py:add_log_rollover_item()] - Loading Sqlite database provider. Sqlite Version: 3.22.0
2024-05-27 20:14:20,323 [database.py:insert_item()] - Error inserting key 'instance_id' in namespace 'moonraker'
2024-05-27 20:14:20,324 [server.py:add_log_rollover_item()] - Unsafe Shutdown Count: 0
2024-05-27 20:14:20,324 [database.py:insert_item()] - Error inserting key 'database_version' in namespace 'database'
2024-05-27 20:14:20,327 [server.py:load_component()] - Component (database) loaded
2024-05-27 20:14:20,349 [database.py:insert_item()] - Error inserting key 'protected_namespaces' in namespace 'database'
2024-05-27 20:14:20,353 [database.py:insert_item()] - Error inserting key 'file_manager.metadata_version' in namespace 'moonraker'
2024-05-27 20:14:20,355 [file_manager.py:init()] - Using File System Observer: inotify
2024-05-27 20:14:20,391 [server.py:load_component()] - Component (file_manager) loaded
2024-05-27 20:14:20,434 [database.py:register_table()] - Found registered table authorized_users
2024-05-27 20:14:20,437 [server.py:load_component()] - Unable to load component: (authorization)
Traceback (most recent call last):
File "/home/dbarwikowski/moonraker/moonraker/server.py", line 297, in load_component
component = load_func(config)
File "/home/dbarwikowski/moonraker/moonraker/components/authorization.py", line 936, in load_component
return Authorization(config)
File "/home/dbarwikowski/moonraker/moonraker/components/authorization.py", line 150, in init
self.user_table = database.register_table(UserSqlDefinition())
File "/home/dbarwikowski/moonraker/moonraker/components/database.py", line 522, in register_table
self.db_provider.register_table(table_def)
File "/home/dbarwikowski/moonraker/moonraker/components/database.py", line 1295, in register_table
table_def.name, table_def.prototype, table_def.version
File "/home/dbarwikowski/moonraker/moonraker/components/database.py", line 870, in _save_registered_table
(table_name, prototype, version)
sqlite3.OperationalError: near "ON": syntax error
2024-05-27 20:14:20,438 [server.py:main()] - Moonraker Error
Traceback (most recent call last):
File "/home/dbarwikowski/moonraker/moonraker/server.py", line 662, in main
server.load_components()
File "/home/dbarwikowski/moonraker/moonraker/server.py", line 261, in load_components
self.load_component(config, component)
File "/home/dbarwikowski/moonraker/moonraker/server.py", line 297, in load_component
component = load_func(config)
File "/home/dbarwikowski/moonraker/moonraker/components/authorization.py", line 936, in load_component
return Authorization(config)
File "/home/dbarwikowski/moonraker/moonraker/components/authorization.py", line 150, in init
self.user_table = database.register_table(UserSqlDefinition())
File "/home/dbarwikowski/moonraker/moonraker/components/database.py", line 522, in register_table
self.db_provider.register_table(table_def)
File "/home/dbarwikowski/moonraker/moonraker/components/database.py", line 1295, in register_table
table_def.name, table_def.prototype, table_def.version
File "/home/dbarwikowski/moonraker/moonraker/components/database.py", line 870, in _save_registered_table
(table_name, prototype, version)
sqlite3.OperationalError: near "ON": syntax error
2024-05-27 20:14:20,440 [server.py:main()] - Server Shutdown

@dbarwikowski dbarwikowski added the bug Something isn't working label May 27, 2024
@dbarwikowski
Copy link
Author

dbarwikowski commented May 27, 2024

I've downgraded to v0.8.0-306 using KIAUH and moonraker works again

@Arksine
Copy link
Owner

Arksine commented May 27, 2024

Unfortunately your OS is too far out of date for a recent change to Moonraker. You can choose to stay on the current version or update your OS to something more recent.

@Arksine Arksine removed the bug Something isn't working label May 27, 2024
@dbarwikowski
Copy link
Author

Thanks for reply. Would like to know which dependency is holding me back as upgrade is not an option. I guess sqlite?

@dbarwikowski
Copy link
Author

dbarwikowski commented May 27, 2024

I've downgraded to v0.8.0-360
image
Something in 361 breaks it for me.

Looks like this is the change: 80c7620

@Arksine
Copy link
Owner

Arksine commented May 27, 2024

Yes, your current issue is sqlite. Version 3.27.2 or greater is required. FWIW, Moonraker will drop support for Python 3.7 (and 3.8) as well later this year.

Edit: I bumped the minimum to 3.27.2, which is the lowest version tested. Its the version delivered with debian buster.

@eduncan911
Copy link

eduncan911 commented Oct 11, 2024

Some of us have long running micro processors running Python 3.8. :)
Dropping support would expel from our open devices in several labs. :(

  1. Could you bundle your version of sqlite into the install process?
  2. Or, provide instructions on how to manually install a newer sqlite (building?)?
  3. Or perhaps use an alternative datastore, something file based with no dependencies? toml is my goto. just make a note that it's autogenerated and not to manually edit. :)

Ps, I was just hit with this today that will be for 7 machines. We are not able to go re-setup each device from scratch on the custom builds. They are on air-gapped networks, so there is no direct internet access.

@Arksine
Copy link
Owner

Arksine commented Oct 12, 2024

To be clear sqlite isn't the reason Moonraker will drop support for Python 3.7 and 3.8. I made that comment to the OP because his log shows he is running 3.7. Python 3.7 and Python 3.8 have both officially reached EOL status, so they will no longer receive security updates. Some of Moonraker's dependencies, such as Tornado, will almost certainly drop support for 3.8 in the near future. These dependencies often release updates with their own security patches. In addition, some dependencies may require the latest version to run on the latest stable python release. Juggling dependencies per version of Python is a maintenance burden I would prefer to drop. I would also like to take advantage of language features not available in older versions of Python without having to maintain the older code.

If these systems are air-gapped, presumably they aren't taking Moonraker updates either. Presumably there should be no issue sticking with the latest Moonraker release that supports Python 3.8 in your situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants