Coder Social home page Coder Social logo

Comments (3)

Hoverbear avatar Hoverbear commented on September 22, 2024

There is a way to override which user ID the installer starts at, the --nix-build-user-id-base flag or NIX_INSTALLER_NIX_BUILD_USER_ID_BASE environment:

/// The Nix build user base UID (ascending)
#[cfg_attr(
feature = "cli",
clap(long, env = "NIX_INSTALLER_NIX_BUILD_USER_ID_BASE", global = true)
)]
#[cfg_attr(
all(target_os = "macos", feature = "cli"),
doc = "Service users on Mac should be between 200-400"
)]
#[cfg_attr(all(target_os = "macos", feature = "cli"), clap(default_value_t = 300))]
#[cfg_attr(
all(target_os = "linux", feature = "cli"),
clap(default_value_t = 30_000)
)]
pub nix_build_user_id_base: u32,

This is documented in nix-installer install --help:

      --nix-build-user-id-base <NIX_BUILD_USER_ID_BASE>
          The Nix build user base UID (ascending)
          
          [env: NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=]
          [default: 30000]

In your case, you could set NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=302.

I am a bit confused why we did not detect this in the planning phase, do you happen to know what the username of UID 301 is?

dscl . -list /Users UniqueID | grep 301

I believe we can make the planner code a bit more robust to avoid this in the future, it should probably check by ID as well:

// Ensure user does not exists
if let Some(user) = User::from_name(name.as_str())
.map_err(|e| ActionErrorKind::GettingUserId(name.clone(), e))
.map_err(Self::error)?
{
if user.uid.as_raw() != uid {
return Err(Self::error(ActionErrorKind::UserUidMismatch(
name.clone(),
user.uid.as_raw(),
uid,
)));
}
if user.gid.as_raw() != gid {
return Err(Self::error(ActionErrorKind::UserGidMismatch(
name.clone(),
user.gid.as_raw(),
gid,
)));
}
tracing::debug!("Creating user `{}` already complete", this.name);
return Ok(StatefulAction::completed(this));
}

from nix-installer.

quot avatar quot commented on September 22, 2024

I hit this same issue. Running export NIX_INSTALLER_NIX_BUILD_USER_ID_BASE=302 before the install fixed the problem.

I am a bit confused why we did not detect this in the planning phase, do you happen to know what the username of UID 301 is?

UID 301 on my machine was taken by user _defendpoint, which seems to have been created by an install of BeyondTrust Endpoint Privilege Management. I do have BeyondTrust software installed on this machine, but I can't find much about that user online. This is the only thing I could find saying that their software manages that user in their MacOS installs: https://www.beyondtrust.com/docs/release-notes/privilege-management/windows-and-mac/mac/pm-mac-22-9.htm

from nix-installer.

elefantes avatar elefantes commented on September 22, 2024

I hit the same issue because I had some packages installed by MacPorts which used some UIDs in the default range.
The installer options weren't clear immediately because you have to specify the subcommand before issuing --help to see the right ones.

Hopefully the installer can check this in the future prior to performing any actions.

from nix-installer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.