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

error: cannot open SQLite database '/nix/var/nix/db/db.sqlite': unable to open database file #140

Open
milahu opened this issue Nov 10, 2024 · 0 comments

Comments

@milahu
Copy link

milahu commented Nov 10, 2024

i just broke the nix database
by manually running the bwrap call
printed by NP_DEBUG=1 nix-portable nix-shell

bwrap --bind $HOME/.nix-portable/emptyroot / --dev-bind /dev /dev --bind $HOME/.nix-portable/nix /nix --bind /usr /usr --bind /proc /proc --bind /home /home --bind /action.log /action.log --bind /boot/initrd.img-4.19.0-0.bpo.9-amd64 /initrd.img --bind /boot/initrd.img-4.9.0-13-amd64 /initrd.img.old --bind /boot /boot --bind /tmp /tmp --bind /boot/vmlinuz-4.9.0-13-amd64 /vmlinuz.old --bind /etc /etc --bind /root /root --bind /bin /bin --bind /lib64 /lib64 --bind /sys /sys --bind /media /media --bind /srv /srv --bind /run /run --bind /opt /opt --bind /var /var --bind /lost+found /lost+found --bind /lib /lib --bind /boot/vmlinuz-4.19.0-0.bpo.9-amd64 /vmlinuz --bind /mnt /mnt --bind /sbin /sbin --bind /etc/host.conf /etc/host.conf --bind /etc/hosts /etc/hosts --bind /etc/networks /etc/networks --bind /etc/passwd /etc/passwd --bind /etc/group /etc/group --bind /etc/nsswitch.conf /etc/nsswitch.conf --bind /run/systemd/resolve/resolv.conf /run/systemd/resolve/resolv.conf --bind /usr/share/zoneinfo/UCT /usr/share/zoneinfo/UCT --bind $HOME $HOME --bind /etc/ssl/certs/ca-certificates.crt $HOME/.nix-portable/ca-bundle.crt $HOME/.nix-portable/nix/store/j823gnvpxh1fjibycmldrspkk3pgivwp-nix-2.20.6/bin/nix-shell

now nix-portable is broken

$ nix-portable nix-shell
error: cannot open SQLite database '/nix/var/nix/db/db.sqlite': unable to open database file

but the nix database works with sqlite3

$ sqlite3 .nix-portable/nix/var/nix/db/db.sqlite .schema | head -n3
CREATE TABLE ValidPaths (
    id               integer primary key autoincrement not null,
    path             text unique not null,

so maybe the database contents are corrupted?

see my 9MB .nix-portable/nix/var/nix/db/db.sqlite in
https://github.com/milahu/nix-portable-broken-nix-database
(sorry, i dont have the working "before" version)

hard fix:

chmod -R 777 .nix-portable # fix "Permission denied"
rm -rf .nix-portable
nix-portable nix-shell
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

1 participant