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

Avoid uninitialized dnf's history.sqlite #143

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

marmarek
Copy link
Member

@marmarek marmarek commented Jan 29, 2025

Do not leave uninitialized history.sqlite in the template. When it
doesn't exist, dnf will create it with the proper structure. But when it
exists, it will expect its tables to exist already. Empty sqlite file
(just headers) breaks this assumption resulting in update errors like:

fedora-41-xfce:out: Refreshing package info
fedora-41-xfce:err: History database is not writable: SQLite error on "/var/lib/dnf/history.sqlite": Executing an SQL statement failed: no such table: config
fedora-41-xfce:err: History database is not writable: SQLite error on "/var/lib/dnf/history.sqlite": Executing an SQL statement failed: no such table: config
fedora-41-xfce:err: SQLite error on "/var/lib/dnf/history.sqlite": Executing an SQL statement failed: no such table: config

The history.sqlite with just headers has 4096 bytes. Properly
initialized one over 100k. To be on the conservative side, set the
threshold at 8k - if it's smaller - remove it (together with sqlite's
side files).

Fixes QubesOS/qubes-issues#9744

@alimirjamali
Copy link

Sadly we do not have sqlite3 binary by default to dump the database schema and check for the tables (e.g. config).

@marmarek
Copy link
Member Author

Yes, I considered this option (including requiring selite3 to be installed), but since the size difference is significant, the current check should also work.

Do not leave uninitialized history.sqlite in the template. When it
doesn't exist, dnf will create it with the proper structure. But when it
exists, it will expect its tables to exist already. Empty sqlite file
(just headers) breaks this assumption resulting in update errors like:

fedora-41-xfce:out: Refreshing package info
fedora-41-xfce:err: History database is not writable: SQLite error on "/var/lib/dnf/history.sqlite": Executing an SQL statement failed: no such table: config
fedora-41-xfce:err: History database is not writable: SQLite error on "/var/lib/dnf/history.sqlite": Executing an SQL statement failed: no such table: config
fedora-41-xfce:err: SQLite error on "/var/lib/dnf/history.sqlite": Executing an SQL statement failed: no such table: config

The history.sqlite with just headers has 4096 bytes. Properly
initialized one over 100k. To be on the conservative side, set the
threshold at 8k - if it's smaller - remove it (together with sqlite's
side files).

Fixes QubesOS/qubes-issues#9744
@marmarek marmarek merged commit c22d934 into QubesOS:main Jan 30, 2025
1 of 3 checks passed
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

Successfully merging this pull request may close these issues.

qubes-vm-update fails on recent fedora-41-xfce templates - history.sqlite not initialized
2 participants