Pkgdb: couldn't initialize read-only package database

Hi,

I just installed 0.9 and I was testing the search, the first command took a while and CPU went ballistic for 2-3 minutes…then it stopped with the first scraping error:

❯ flox search chezmoi
❌ ERROR: search encountered an error: error running pkgdb: scraping failed: abnormal child exit, signal: 9
❯ flox search chezmoi
❌ ERROR: search encountered an error: error running pkgdb: couldn't initialize read-only package database
❯ flox search chezmoi
❌ ERROR: search encountered an error: error running pkgdb: couldn't initialize read-only package database

After that, I couldn’t do anything else because pkgdb seems to be in a weird state. I tried restarting nix daemon etc. I even rebooted the server but didn’t solve the issue.

Should I reinstall flox to fix this? I’m afraid it will happen again after reinstalling.

I’m on Debian Bookworm. Thanks for any help.

I uninstalled and reinstalled flox, and the same happens.

This is a LXC debian bookworm instance on Proxmox. If I try this on the physical server it works, but I don’t know what could the difference be regarding flox.

❯ flox search chezmoi -v
DEBUG 2024-02-25 12:39:07.301325830 +01:00 flox/src/config/mod.rs:133:
`$FLOX_CONFIG_HOME` not set, using "/root/.config/flox/"
DEBUG 2024-02-25 12:39:07.303107931 +01:00 flox/src/commands/mod.rs:183:
Metrics collection disabled
DEBUG 2024-02-25 12:39:07.303172664 +01:00 flox/src/utils/init/mod.rs:72:
no default user nix.conf found
DEBUG 2024-02-25 12:39:07.303263329 +01:00 flox/src/utils/init/metrics.rs:131:
Attempting to read own UUID from file
DEBUG 2024-02-25 12:39:07.303461804 +01:00 flox/src/commands/search.rs:73:
performing search for term: chezmoi
DEBUG 2024-02-25 12:39:07.303483798 +01:00 flox-rust-sdk/src/models/environment/mod.rs:485:
looking for .flox: starting_path=/root/.flox
DEBUG 2024-02-25 12:39:07.303621147 +01:00 flox-rust-sdk/src/providers/git.rs:189:
"/nix/store/f7b2yl226nbikiv6sbdhmaxg2452c8h5-git-minimal-2.42.0/bin/git" "-C" "/root" "rev-parse" "--is-bare-repository"
DEBUG 2024-02-25 12:39:07.305162455 +01:00 flox/src/utils/search.rs:34:
no environment found
DEBUG 2024-02-25 12:39:07.305188367 +01:00 flox-rust-sdk/src/models/environment/mod.rs:473:
global manifest lockfile path is /root/.config/flox/global-manifest.lock
DEBUG 2024-02-25 12:39:07.305223622 +01:00 flox-rust-sdk/src/models/environment/mod.rs:466:
global manifest path is /root/.config/flox/global-manifest.toml
DEBUG 2024-02-25 12:39:07.305762853 +01:00 flox/src/utils/search.rs:86:
search params raw: SearchParams { manifest: None, global_manifest: Path("/root/.config/flox/global-manifest.toml"), lockfile: Path("/root/.config/flox/global-manifest.lock"), query: Query { name: None, pname: None, version: None, semver: None, match: None, match_name: None, match_name_or_rel_path: Some("chezmoi"), limit: Some(10), deduplicate: true } }
DEBUG 2024-02-25 12:39:07.305923901 +01:00 flox-rust-sdk/src/models/search.rs:305:
running search command "/nix/store/r53593m79an6npq4gd1nvpap29zc0cdi-flox-pkgdb-0.1.0/bin/pkgdb" "search" "--quiet" "--ga-registry" "{\"global-manifest\":\"/root/.config/flox/global-manifest.toml\",\"lockfile\":\"/root/.config/flox/global-manifest.lock\",\"query\":{\"match-name-or-rel-path\":\"chezmoi\",\"limit\":10,\"deduplicate\":true}}"
⠉ Searching for packages...                                                                                                                                                                  This may take a while the first time you run it.DEBUG 2024-02-25 12:39:43.358229128 +01:00 flox-rust-sdk/src/models/search.rs:317:
record = Error(PkgDbError { exit_code: 113, category_message: "error running pkgdb", context_message: Some(ContextMsgError { message: "couldn't initialize read-only package database", caught: None }) })
DEBUG 2024-02-25 12:39:43.360167502 +01:00 flox/src/main.rs:100:
search encountered an error: error running pkgdb: couldn't initialize read-only package database
❌ ERROR: search encountered an error: error running pkgdb: couldn't initialize read-only package database

Ok, I tried this on 3 different LXCs and the same happens. There’s something not working with LXC containers.

If you guide me on how to do a deeper debug, we might understand why it doesn’t work. I suspect something related to pkgdb, what kind of database does it use? maybe a cgroup2 issue, permissions…

Let me know if I can help fixing this, might help other users with LXC setups.

We will take a look - I created an issue to track this. Running flox in LXCs · Issue #1088 · flox/flox · GitHub

Please subscribe for updates!

No worries…I setup discourse to be notified on every thread I participate in. :slight_smile:

No worries…I setup discourse to be notified on every thread I participate in. :slight_smile:

Hi @alexdelprete - great to see you again and thank you for all your feedback. Just wanted to flag that @ghudgins was referring to subscribing to the flox/flox repo (or the specific issue if you prefer) so you could see updates on the github issue itself. :slightly_smiling_face:

Dear @robinbrantley, thank you for always having my back. :slight_smile:

I read too fast, my bad. Will check the issue immediately on GH.

Thank you.

1 Like

Hi @robinbrantley, are there any updates on this? I have all my LXCs with no flox. :slight_smile:

Hey Alex - we definitely agree this is something we need to do to be fully compatible in the container landscape. We have a few more pressing priorities right now but the github issue helps us stay honest with our users about what problems they are experiencing. Hope to get to it soon and sorry there isn’t yet a Flox for LXC. The GIthub issue is a good place to keep tabs on the conversation (in addition to this thread!) and you are welcome to send us a pull request and we’d love to help you get it over the line.

Thanks for the feedback Graham. I’d love to contribute, but I’m not a professional developer.

I’ll wait, meanwhile I’ll revert to nix like I used to before I started using flox. :slight_smile: