-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
sqlite3 "attempt to write a readonly database" with legacy and memory database backend #1490
Comments
I'm also seeing this with current master (0c989d7), also on nixos 21.11. |
@wykurz Is it the same stack trace? I would expect the original stack trace in the issue to be solved, but perhaps there's still a command that needs write access but doesn't request it. Which command did you run? |
I even tried to delete and then re-create deployment, but still same error...
|
Here it's trying to write a description to the database, which is not something it can do unless it locks the remote state for writing, which doesn't seem appropriate for commands like |
Same error when I run
Should I open a new bug ? |
I'm not aware of a similar issue, so yes please. Please share at least the |
Here is the config i'm trying to deploy (I know it's not perfect nix but it works) : https://github.com/Tchekda/nixos-configuration/tree/master/kbennett {
# Describe your "deployment"
network.description = "LGP VM";
# A single machine description.
lgpserver = {
deployment = {
targetEnv = "none";
targetHost = "IPV6_HOST";
};
imports = [ ./configuration.nix ];
};
} And my nixops.nix in current directory : { ... }:
{
network.storage.legacy = {
databasefile = "~/.nixops/deployments.nixops";
};
} |
Yes, exactly the same. But I think I misunderstood how
I guess that does not include master but rather uses a version from nixpkgs... Sorry for the confusion! To actually test with master I will need to use an AWS plugin, I'm not yet sure how to do that. Or if you could suggest when the nixopsUnstable would be updated in nixpkgs - I'd be happy to give that a go as well. |
Same issue here, with master ( 0c989d7 ) or nixopsUnstable on nixos 21.11 ( 7ebdd8a ).
I have some deployments in the database but the nixops.nix in the current directory only contains :
|
My understanding is that when doing a niops list or nixops info --all , attributes from the evaluated config are written to the state database. That reveals another problem. If these writes are allowed (by reverting to 35ac020 as suggested by @Tchekda), then the description and enableRollback attributes of all deployments will be overwritten with thoses in the current nixops.nix |
@roberth is there at least a workaround for this? As I understand it - this makes using nixops on nixos 21.11 impossible? |
My temporary solution : #1490 (comment) |
Ugh, turns out I don't know how to use the nixops from source as I need to have the aws plugin - how do I add it? The documentation linked in the README is for nixops 1.8 which didn't have the plugins. Is this described somewhere else? |
I guess I picked a bad day to try to use NixOps. |
@wykurz have a look at the nix-pkgs build process, at the bottom of the file you can see all plugins being added : Nix build file |
Cool, I was able to modify nixpkgs to grab the earlier nixops like this:
And then install it: |
if you need the above as a nix expression for nix shell/flake/etc packages = [
(pkgs.nixopsUnstable.override {
## https://github.com/NixOS/nixops/issues/1490
overrides = (self: super: {
nixops = super.nixops.overridePythonAttrs (
_: {
src = pkgs.fetchgit {
url = "https://github.com/nixos/nixops";
rev = "35ac02085169bc2372834d6be6cf4c1bdf820d09";
sha256 = "1jh0jrxyywjqhac2dvpj7r7isjv68ynbg7g6f6rj55raxcqc7r3j";
};
}
);
});
})
]; |
Looking at the code it seems like everything treats the sqlite database as write-through which would make fixes for everything that shouldn't change state kind of painful. An alternate approach might be to let them work on a cloned memory database: https://www.sqlite.org/c3ref/deserialize.html It looks like support for it in the sqlite3 python module is nearing completion: |
@lostnet Maybe I've been to hopeful about the state of NixOps' state management.
Our db is tiny, so it wouldn't really hurt to copy the file and use that instead. |
I am currently trying to get into nixops for my NixOS installations. My host machine is Arch Linux, but I was able to reproduce this issue in the official Docker image too, so it shouldn't matter.
Tested versions
Running any
nixops
operation that would cause some transaction with the state database I get this error:I can reproduce this in a container (
docker.io/nixos/nix:latest
).Dockerfile
nixops.nix
Both the container as well as my host machine has sandboxing disabled. This might be related?EDIT: I installed
nixopsUnstable
on one of my NixOS machines and it has the exact same issueThe text was updated successfully, but these errors were encountered: