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 when installing Nix on my linux distro: useradd: UID 30012 is not unique #10770

Closed
1 of 3 tasks
vighnesh153 opened this issue May 24, 2024 · 2 comments
Closed
1 of 3 tasks

Comments

@vighnesh153
Copy link

vighnesh153 commented May 24, 2024

Platform

  • Linux: Debian GNU
  • macOS
  • WSL

Additional information

Linux Multi user installation using the following command:

sh <(curl -L https://nixos.org/nix/install) --daemon

Output

Output

❯ sh <(curl -L https://nixos.org/nix/install) --daemon
  % 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  4052  100  4052    0     0  10108      0 --:--:-- --:--:-- --:--:-- 10108
downloading Nix 2.22.1 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.22.1/nix-2.22.1-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.d7eoeeQt3L'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.9M  100 21.9M    0     0   156M      0 --:--:-- --:--:-- --:--:--  157M
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] y


I will:

 - make sure your computer doesn't already have Nix files
   (if it does, I will tell you how to clean them up.)
 - create local users (see the list above for the users I'll make)
 - create a local group (nixbld)
 - install Nix in to /nix
 - create a configuration file in /etc/nix
 - set up the "default profile" by creating some Nix-related files in
   /root
 - back up /etc/bash.bashrc to /etc/bash.bashrc.backup-before-nix
 - update /etc/bash.bashrc to include some Nix configuration
 - back up /etc/zsh/zshrc to /etc/zsh/zshrc.backup-before-nix
 - update /etc/zsh/zshrc to include some Nix configuration
 - load and start a service (at /etc/systemd/system/nix-daemon.service
   and /etc/systemd/system/nix-daemon.socket) for nix-daemon

Ready to continue?
[y/n] y


---- 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.

---- Nix config report ---------------------------------------------------------
        Temp Dir:	/tmp/tmp.jwjTANioKI
        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

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

    $ sudo groupadd -g 30000 --system nixbld

Create the Nix build group, nixbld

[sudo] password for rvighnesh: 
            Created:	Yes

~~> Setting up the build user nixbld1

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 1 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30001 --password ! nixbld1

Creating the Nix build user, nixbld1

useradd warning: nixbld1's uid 30001 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 1
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld2

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 2 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30002 --password ! nixbld2

Creating the Nix build user, nixbld2

useradd warning: nixbld2's uid 30002 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 2
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld3

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 3 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30003 --password ! nixbld3

Creating the Nix build user, nixbld3

useradd warning: nixbld3's uid 30003 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 3
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld4

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 4 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30004 --password ! nixbld4

Creating the Nix build user, nixbld4

useradd warning: nixbld4's uid 30004 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 4
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld5

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 5 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30005 --password ! nixbld5

Creating the Nix build user, nixbld5

useradd warning: nixbld5's uid 30005 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 5
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld6

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 6 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30006 --password ! nixbld6

Creating the Nix build user, nixbld6

useradd warning: nixbld6's uid 30006 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 6
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld7

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 7 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30007 --password ! nixbld7

Creating the Nix build user, nixbld7

useradd warning: nixbld7's uid 30007 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 7
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld8

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 8 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30008 --password ! nixbld8

Creating the Nix build user, nixbld8

useradd warning: nixbld8's uid 30008 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 8
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld9

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 9 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30009 --password ! nixbld9

Creating the Nix build user, nixbld9

useradd warning: nixbld9's uid 30009 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 9
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld10

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 10 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30010 --password ! nixbld10

Creating the Nix build user, nixbld10

useradd warning: nixbld10's uid 30010 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 10
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld11

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 11 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30011 --password ! nixbld11

Creating the Nix build user, nixbld11

useradd warning: nixbld11's uid 30011 is greater than SYS_UID_MAX 999
           Created:	Yes
            Hidden:	Yes
    Home Directory:	/var/empty
              Note:	Nix build user 11
   Logins Disabled:	Yes
  Member of nixbld:	Yes
    PrimaryGroupID:	30000

~~> Setting up the build user nixbld12

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

    $ sudo useradd --home-dir /var/empty --comment Nix build user 12 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30012 --password ! nixbld12

Creating the Nix build user, nixbld12

useradd: UID 30012 is not unique

---- oh no! --------------------------------------------------------------------
Oh no, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.

:(

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

Priorities

Add 👍 to issues you find important.

@vighnesh153 vighnesh153 changed the title Error when installing Nix on my linux disr Error when installing Nix on my linux distro: useradd: UID 30012 is not unique May 24, 2024
@abathur
Copy link
Member

abathur commented May 24, 2024

Same issue as:

The 2nd comment there suggests a workaround, but I'd recommend following the linux uninstall instructions to make sure everything's cleaned up first: https://nixos.org/manual/nix/stable/installation/uninstall.html#linux

@vighnesh153
Copy link
Author

Thanks. A couple of hours back, I flashed another distro on my machine and I was able to run the install script without any errors. Closing the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants