1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

aptで入れたnix-binを消してnix-installerで入れ直したらちょっとだけ詰まったのでメモ

1
Posted at

nix に興味持ってとりあえず手元の環境にapt installで入れたのですが

を読んで、 https://github.com/DeterminateSystems/nix-installer で入れるほうがいいんだと思って入れ直そうとしたらちょっとだけ詰まったのでメモ

TL;DR

  • nixbldグループとnixbld(1~10)を消してから nix-install すれば成功する

自分がやってしまったこと

1. apt で nix-bin をインストール

nix 入れられるかなと思って何も調べずに sudo apt install nix としたら nix-bin じゃない?的なことを言われたので素直にインストール

sudo apt install nix-bin

2. nix-installer 使おうと思って nix-bin 削除

sudo apt remove -y nix-bin

3. nix-installer でやり直し…

curl -fsSL https://install.determinate.systems/nix | sh -s -- install

したところ以下のようなエラーメッセージが出た

info: downloading the Determinate Nix Installer
 INFO nix-installer v3.17.0
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
 INFO nix-installer v3.17.0
Error: 
   0: Planner error
   1: Error executing action
   2: Action `create_group` errored
   3: Group `nixbld` existed but had a different gid (984) than planned (30000)

Location:
   /build/nix-installer-source/src/cli/subcommand/install/mod.rs:174

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

メッセージに書かれている通り RUST_BACKTRACE=full 入れるともう少しわかりそう。

対処していく

まずは RUST_BACKTRACE=fullをexportしてから再実行

export RUST_BACKTRACE=full
curl -fsSL https://install.determinate.systems/nix | sh -s -- install

出力された結果が以下

nfo: downloading the Determinate Nix Installer
 INFO nix-installer v3.17.0
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
 INFO nix-installer v3.17.0
Error: 
   0: Planner error
   1: Error executing action
   2: Action `create_group` errored
   3: Group `nixbld` existed but had a different gid (984) than planned (30000)

Location:
   /build/nix-installer-source/src/cli/subcommand/install/mod.rs:174

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  <empty backtrace>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

どうやら apt でインストールしたときにできた nixbld グループが悪さをしてそう。

nixbld グループを消して再実行

sudo groupdel -f nixbld

もう一回インストール実行したら今度は以下のメッセージ

info: downloading the Determinate Nix Installer
 INFO nix-installer v3.17.0
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
 INFO nix-installer v3.17.0
Error: 
   0: Planner error
   1: Error executing action
   2: Action `create_users_and_group` errored
   3: Action `create_user` errored
   4: User `nixbld1` existed but had a different uid (997) than planned (30001)

Location:
   /build/nix-installer-source/src/cli/subcommand/install/mod.rs:174

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

group だけじゃなくて user もなんか邪魔している。

nixbld ユーザも消す必要がある

見てみるとnix用のuserっぽいものがたくさんいる。

$ grep nix /etc/passwd
nixbld1:x:997:984:Nix build user 1:/var/empty:/usr/sbin/nologin
nixbld2:x:995:984:Nix build user 2:/var/empty:/usr/sbin/nologin
nixbld3:x:994:984:Nix build user 3:/var/empty:/usr/sbin/nologin
nixbld4:x:993:984:Nix build user 4:/var/empty:/usr/sbin/nologin
nixbld5:x:992:984:Nix build user 5:/var/empty:/usr/sbin/nologin
nixbld6:x:986:984:Nix build user 6:/var/empty:/usr/sbin/nologin
nixbld7:x:985:984:Nix build user 7:/var/empty:/usr/sbin/nologin
nixbld8:x:984:984:Nix build user 8:/var/empty:/usr/sbin/nologin
nixbld9:x:983:984:Nix build user 9:/var/empty:/usr/sbin/nologin
nixbld10:x:982:984:Nix build user 10:/var/empty:/usr/sbin/nologin

こいつらを全部消す。userdelは複数指定できないのでfor文で回しています。

for NIXUSER in $(grep ^nixbld /etc/passwd | awk -F':' '{print $1}'); do   sudo userdel $NIXUSER; done

無事インストールできるようになった

apt install したときにできた userとgroup を削除したら無事インストールできるようになりました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?