[Nix-dev] Broken nix database/store.
Joachim Schiele
js at lastlog.de
Fri Jun 10 12:34:47 CEST 2016
On 10.06.2016 12:32, Guillaume Maudoux (Layus) wrote:
>
> Le 10/06/16 à 12:09, Joachim Schiele a écrit :
>> On 09.06.2016 19:21, Layus wrote:
>>> Hi,
>>>
>>> Due to a wrong manipulation when activating dir_index on my root
>>> partition, I have now plenty of live orphaned paths in my store (about
>>> 5G) like this one:
>>>
>>> |$ nix-store -q --referrers-closure
>>> /nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2
>>> /nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2
>>> $ nix-store --delete
>>> /nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2
>>> finding garbage collector roots... error: cannot delete path
>>> ‘/nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2’ since
>>> it is still alive 0 store paths deleted, 0.00 MiB freed $ nix-store
>>> --delete --ignore-liveness
>>> /nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2
>>> error: you are not allowed to ignore liveness 0 store paths deleted,
>>> 0.00 MiB freed $ sudo nix-store --delete
>>> /nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2
>>> finding garbage collector roots... error: cannot delete path
>>> ‘/nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2’ since
>>> it is still alive 0 store paths deleted, 0.00 MiB freed $ sudo nix-store
>>> --delete --ignore-liveness
>>> /nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2
>>> finding garbage collector roots... deleting
>>> ‘/nix/store/4zhkw0g564g3ljdpnn8j5krrsvcxildn-libXcomposite-0.4.4.tar.bz2’ deleting
>>> ‘/nix/store/trash’ deleting unused links... note: currently hard linking
>>> saves 1754.97 MiB 1 store paths deleted, 0.27 MiB freed |
>>>
>>> Is there some repair command to update liveness of paths ?
>> what you could do:
>> 1. create a backup of all files
>> 2. remove most stuff in / except /home/, /etc/nixos/, /etc/nix,
>> /nix/store (among some paths i just didn't think about)
>>
>> 3. boot a rescue nixos live-stick
>> 4. do a nixos-install with the config you already have
>>
>> this basically makes sure that your store sqlite database gets properly
>> repopulated.
>>
>> after you booted into your new system, consider:
>> nix-collect-garbage -d
>>
>> to get rid of unused /nix/store paths
> Thanks Joachim,
>
> I did something very similar (with a chroot in archlinux), just to
> discover that the files were still present.
> It turns out that they are "live" in the nix store because of the
> options "gc-keep-outputs" and "gc-keep-derivations" that are enabled in
> my config.
>
> for the record, `nix-collect-garbage -d --option gc-keep-outputs false
> --option gc-keep-derivations false` does the job... :-).
good to know!
--
Joachim Schiele
blog: http://lastlog.de/blog
wiki: http://lastlog.de/wiki
jabber: josh at jabber.ccc.de
GPG: 6D8F75EE (key here: https://lastlog.de/blog/about.html)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160610/2084e801/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160610/2084e801/attachment.sig>
More information about the nix-dev
mailing list