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

nix does not clean the remaining files #266858

Open
KCynk opened this issue Nov 11, 2023 · 2 comments
Open

nix does not clean the remaining files #266858

KCynk opened this issue Nov 11, 2023 · 2 comments
Labels
0.kind: bug Something is broken

Comments

@KCynk
Copy link

KCynk commented Nov 11, 2023

Describe the bug

nix does not clean the remaining files

Steps To Reproduce

Steps to reproduce the behavior:

  1. vim /etc/nixos/configuration.conf
  2. Content of the config file
{ config, pkgs, ... }:

{
  services.freshrss = {
    enable = true;
    defaultUser = "kcynk";
    passwordFile = "/run/secrets/freshrss";
    dataDir = "/var/lib/freshrss";
    baseUrl = "https://freshrss.localhost";
    database = {
      type = "sqlite";
    };
  };
  1. sudo nixos-rebuild switch
  2. Reboot
  3. Delete content related to freshrss service
  4. sudo nixos-rebuild switch
  5. Reboot
  6. Files are still there
[kcynk@nixos:/var/lib/freshrss] sudo find / -name 'freshrss'
[sudo] password for kcynk: 
/var/lib/freshrss
/nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos/nixos/pkgs/servers/web-apps/freshrss**

[kcynk@nixos:/var/lib/freshrss] cd /var/lib/freshrss/
[kcynk@nixos:/var/lib/freshrss] ll
total 36
-rw-rw---- 1 992 990    0 11-10 18:49 applied_migrations.txt
drwxrwx--- 2 992 990 4096 11-10 20:59 cache
-rw-rw---- 1 992 990 1688 11-10 19:11 config.php
-rw-rw---- 1 992 990 1688 11-10 19:04 config.php.bak.php
drwxrwx--- 2 992 990 4096 11-10 18:49 extensions-data
drwxrwx--- 2 992 990 4096 11-10 20:59 favicons
drwxrwx--- 2 992 990 4096 11-10 18:49 fever
-rw-rw---- 1 992 990    0 11-10 21:55 index.html
-rw-r--r-- 1 992 990    0 11-10 19:39 last_update.txt
drwxrwx--- 4 992 990 4096 11-10 18:49 PubSubHubbub
drwxrwx--- 2 992 990 4096 11-10 18:49 tokens
drwxrwx--- 4 992 990 4096 11-10 18:49 users

  1. Executing following commands:
  • nix-collect-garbage -d
  • nix-collect-garbage
  • nix-store --gc
  1. Files still there
[kcynk@nixos:/var/lib/freshrss] sudo nix-store --query --roots /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos/nixos/pkgs/servers/web-apps/freshrss/
/nix/var/nix/profiles/per-user/root/channels-3-link -> /nix/store/18ic13fhdq5mgdnhym22pz2a20pci571-user-environment
/proc/13969/environ -> /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos
/proc/13971/environ -> /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos

Expected behavior

Old files should be deleted after rebuild or after one of mentioned command

Metadata

[kcynk@nixos:/var/lib/freshrss] nix-shell -p nix-info --run "nix-info -m"
these 6 paths will be fetched (0.75 MiB download, 10.18 MiB unpacked):
  /nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45
  /nix/store/azkk9647ivcaa29fpb8viwj879q7yjw4-gnu-config-2023-07-31
  /nix/store/9dh2csn531by6b1vr9jv85v4k17xwkid-gnumake-4.4.1
  /nix/store/znqwpxy9jlxcgi2ms2hga0ch87bbbr9g-patchelf-0.15.0
  /nix/store/bbxdw4rgwwl3gnajri82yidr1nlsfskf-stdenv-linux
  /nix/store/6g3mnziija245czxdqvs4k4sc6lad0sw-update-autotools-gnu-config-scripts-hook
copying path '/nix/store/azkk9647ivcaa29fpb8viwj879q7yjw4-gnu-config-2023-07-31' from 'https://cache.nixos.org'...
copying path '/nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45' from 'https://cache.nixos.org'...
copying path '/nix/store/znqwpxy9jlxcgi2ms2hga0ch87bbbr9g-patchelf-0.15.0' from 'https://cache.nixos.org'...
copying path '/nix/store/9dh2csn531by6b1vr9jv85v4k17xwkid-gnumake-4.4.1' from 'https://cache.nixos.org'...
copying path '/nix/store/6g3mnziija245czxdqvs4k4sc6lad0sw-update-autotools-gnu-config-scripts-hook' from 'https://cache.nixos.org'...
copying path '/nix/store/bbxdw4rgwwl3gnajri82yidr1nlsfskf-stdenv-linux' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.61, NixOS, 23.11 (Tapir), 23.11pre544052.85f1ba3e5167`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.1`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Related issue:
NixOS/nix#6141

@KCynk KCynk added the 0.kind: bug Something is broken label Nov 11, 2023
@KCynk KCynk changed the title nix doesn't purge remaing files nix does not clean the remaining files Nov 11, 2023
@KCynk
Copy link
Author

KCynk commented Nov 11, 2023

[kcynk@nixos:~] nix-store --query --referrers /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos/nixos/pkgs/servers/web-apps/freshrss
/nix/store/5bbvjnhpkzgmb2piay1002ajnlgd1yva-env-manifest.nix
/nix/store/18ic13fhdq5mgdnhym22pz2a20pci571-user-environment

sudo nix-store --query --referrers /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos/nixos/pkgs/servers/web-apps/freshrss | xargs nix-store --delete
[sudo] password for kcynk: 
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/18ic13fhdq5mgdnhym22pz2a20pci571-user-environment' since it is still alive. To find out why, use: nix-store --query --roots

@KCynk
Copy link
Author

KCynk commented Nov 11, 2023

grep nix /etc/nixos/configuration.conf
nix.settings.experimental-features = [ "nix-command" ];
sudo nixos-rebuild switch

[kcynk@nixos:~] sudo nix store delete --ignore-liveness /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos/nixos/pkgs/servers/web-apps/freshrss
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos' since it is still alive. To find out why, use: nix-store --query --roots

[kcynk@nixos:~] sudo nix-store --query --roots /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos/nixos/pkgs/servers/web-apps/freshrss
removing stale link from '/nix/var/nix/gcroots/auto/9g1mgvqfhlgw56vjanjsc96pznafm0c3' to '/tmp/nixos-rebuild.BZ6w8a/nix'
removing stale link from '/nix/var/nix/gcroots/auto/v1ychyhf92phfq3q30h1aqscw191hyi1' to '/tmp/nix-build-18502-0/result'
removing stale link from '/nix/var/nix/gcroots/auto/rm0qjaxlggkzdwnsmsdfk521qw0ld493' to '/tmp/nix-build-18475-0/result'
removing stale link from '/nix/var/nix/gcroots/auto/zr57fvv42ysai0xgnd1p5jhny9i9c10d' to '/tmp/nixos-rebuild.BZ6w8a/nix.drv'
/proc/20282/environ -> /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos
/proc/20284/environ -> /nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos
/nix/var/nix/profiles/per-user/root/channels-3-link -> /nix/store/18ic13fhdq5mgdnhym22pz2a20pci571-user-environment

[kcynk@nixos:~] find /nix/store -name freshrss
/nix/store/sw8kbzmalpiq4kmlrp5s1zg9cjkr43rp-nixos/nixos/pkgs/servers/web-apps/freshrss

[kcynk@nixos:~/Downloads] printenv -0 > env
[kcynk@nixos:~/Downloads] grep -i freshrss env 
[kcynk@nixos:~/Downloads] 

[root@nixos:~] printenv -0 > env
[root@nixos:~] grep -i fresh env 
[root@nixos:~] 


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant