Skip to content

Unclear instructions for uninstalling existing Nix #12244

Open
@lindhe

Description

I'm trying to install Nix, but apparently it's not the first time I do so. 😄 But I'm running into some issues with the installer because of that, and it seems like the on-screen instructions does not work fully to uninstall my old Nix.

Platform

  • Linux:
  • macOS
  • WSL

Additional information

I tried running sudo rm -rf "/etc/nix" "/nix" "/root/.nix-profile" "/root/.nix-defexpr" "/root/.nix-channels" "/root/.local/state/nix" "/root/.cache/nix" "/home/andreas/.nix-profile" "/home/andreas/.nix-defexpr" "/home/andreas/.nix-channels" "/home/andreas/.local/state/nix" "/home/andreas/.cache/nix", as suggested by the installer, but that seems not not be sufficient.

Output

Output
$ sh <(curl -L https://nixos.org/nix/install) --daemon                                                                       130 ↵
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  4267  100  4267    0     0   6396      0 --:--:-- --:--:-- --:--:--  173k
downloading Nix 2.25.3 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.25.3/nix-2.25.3-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.Z3GjipbQfn'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 22.5M  100 22.5M    0     0  27.3M      0 --:--:-- --:--:-- --:--:-- 27.3M
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation
Switching to the Multi-user Installer
Welcome to the Multi-User Nix Installation

This installation tool will set up your computer with the Nix package
manager. This will happen in a few stages:

1. Make sure your computer doesn't already have Nix. If it does, I
   will show you instructions on how to clean up your old install.

2. Show you what I am going to install and where. Then I will ask
   if you are ready to continue.

3. Create the system users (uids [30001..30032]) and groups (gid 30000)
   that the Nix daemon uses to run builds. To create system users
   in a different range, exit and run this tool again with
   NIX_FIRST_BUILD_UID set.

4. Perform the basic installation of the Nix files daemon.

5. Configure your shell to import special Nix Profile files, so you
   can use Nix.

6. Start the Nix daemon.

Would you like to see a more detailed list of what I will do?
[y/n] n


---- let's talk about sudo -----------------------------------------------------
This script is going to call sudo a lot. Every time I do, it'll
output exactly what it'll do, and why.

Just like this:

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo echo

to demonstrate how our sudo prompts look


This might look scary, but everything can be undone by running just a
few commands. I used to ask you to confirm each time sudo ran, but it
was too many times. Instead, I'll just ask you this one time:

Can I use sudo?
[y/n] y

Yay! Thanks! Let's get going!

~~> Checking for artifacts of previous installs
Before I try to install, I'll check for signs Nix already is or has
been installed on this system.

---- warning! ------------------------------------------------------------------
Nix already appears to be installed. This installer may run into issues.
If an error occurs, try manually uninstalling, then rerunning this script.


Uninstalling nix:
1. Delete the files Nix added to your system:

  sudo rm -rf "/etc/nix" "/nix" "/root/.nix-profile" "/root/.nix-defexpr" "/root/.nix-channels" "/root/.local/state/nix" "/root/.cache/nix" "/home/andreas/.nix-profile" "/home/andreas/.nix-defexpr" "/home/andreas/.nix-channels" "/home/andreas/.local/state/nix" "/home/andreas/.cache/nix"

and that is it.


---- Nix config report ---------------------------------------------------------
        Temp Dir:       /tmp/tmp.CfS82a9pHu
        Nix Root:       /nix
     Build Users:       32
  Build Group ID:       30000
Build Group Name:       nixbld

build users:
    Username:   UID
     nixbld1:   30001
     nixbld2:   30002
     nixbld3:   30003
     nixbld4:   30004
     nixbld5:   30005
     nixbld6:   30006
     nixbld7:   30007
     nixbld8:   30008
     nixbld9:   30009
     nixbld10:  30010
     nixbld11:  30011
     nixbld12:  30012
     nixbld13:  30013
     nixbld14:  30014
     nixbld15:  30015
     nixbld16:  30016
     nixbld17:  30017
     nixbld18:  30018
     nixbld19:  30019
     nixbld20:  30020
     nixbld21:  30021
     nixbld22:  30022
     nixbld23:  30023
     nixbld24:  30024
     nixbld25:  30025
     nixbld26:  30026
     nixbld27:  30027
     nixbld28:  30028
     nixbld29:  30029
     nixbld30:  30030
     nixbld31:  30031
     nixbld32:  30032

Ready to continue?
[y/n] y


~~> Setting up the build group nixbld

---- oh no! --------------------------------------------------------------------
It seems the build group nixbld already exists, but
with the UID 998. This script can't really handle
that right now, so I'm going to give up.

You can export NIX_BUILD_GROUP_ID=998 and re-run.

We'd love to help if you need it.

You can open an issue at
https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md

Or get in touch with the community: https://nixos.org/community

Checklist


Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions