Chrome broken after rebuild

Recently I’ve been rebuilding my NixOS config quite a lot and after quite a few rebuilds the whole system became quite laggy. Then I realized that I forgot to include google-chrome package in my build. Somehow chrome was running all that time I was changing and rebuilding my configuration, but at some point it eventually crashed. I tried to simply run rebuild once again this time including the necessary package, it finished correctly and I could see that google-chrome in my application launchers (rofi and dmenu), but it just didn’t start, there was just no effect. I tried to run it through terminal (and got “command not found”), then created a nix-shell session with chrome, but again same as with user shell - no success.

Then I did nix store verify -all and nix-collect-garbage -d - both commands ran successfully. Then I tried to rebuild system and still no luck.

The most misteriuos thing to me is that running google-chrome results in “command not found”, usually it would say that some program is “not in you PATH” and then list a few possible solutions. But I clearly installed chrome, it just somehow doesn’t work :slightly_frowning_face:

Do you have any idea how can I fix that issue and what it could be?

Share your config, the exact command you ran, and the full error.

is a file called google-chrome in /run/current-system/sw/bin, ~/.nix-profile/bin or /etc/profiles/per-user/<username>/bin? if it isnt there, that probably means that there is no chrome on your computer. to be sure, you can do find / -name "google-chrome" for finding all files called google-chrome.

So I checked in those bin directories and there wasn’t much there (no chrome anyways), but I couldn’t find binaries of most programs I am using now there either

[rio:~]$ ls  /run/current-system/bin -la
total 16
dr-xr-xr-x 2 root root 4096 Jan  1  1970 .
dr-xr-xr-x 4 root root 4096 Jan  1  1970 ..
-r-xr-xr-x 1 root root  842 Jan  1  1970 switch-to-configuration
lrwxrwxrwx 1 root root  101 Jan  1  1970 .switch-to-configuration-wrapped -> /nix/store/5nipjs9s3sijg22w572xd84yl0kaigip-switch-to-configuration-0.1.0/bin/switch-to-configuration
[rio:~]$ ls .nix-profile/bin
nix-tree
[rio:~]$ ls /etc/profiles/per-user/rio/bin
accessdb  catman  git-credential-netrc  git-http-backend  git-receive-pack  git-upload-archive  lexgrog  mandb    man-recode  update-mime-database
apropos   git     git-cvsserver         git-jump          git-shell         git-upload-pack     man      manpath  scalar      whatis

Running a find with “google-chrome” I found a few instances of google-chrome in nix/store

/nix/store/j33wzkzndh41cyyy7i18bqm1srlv84cq-source/pkgs/by-name/go/google-chrome
/nix/store/0il3ay315ca17pswq5f145p935iqqj7g-nixos/nixos/pkgs/by-name/go/google-chrome
/nix/store/nyw0ckycip61cklwzwm6mqj8n9zcpd59-bash-completion-2.16.0/share/bash-completion/completions/google-chrome
/nix/store/5gnfnww58kfapk63z7fwn9qs71g2v7nq-google-chrome-132.0.6834.110/share/google/chrome/cron/google-chrome
/nix/store/5gnfnww58kfapk63z7fwn9qs71g2v7nq-google-chrome-132.0.6834.110/share/google/chrome/google-chrome

Chrome still shows among the programs in my application launcher (and disappears when I uninstall it)

Well if you mean the command I run in terminal to execute chrome than simply

[rio:~]$ google-chrome
google-chrome: command not found

My config

I am runnning
sudo nixos-rebuild switch --flake ~/nixos#desktop to rebuild.

  1. ever tried nix run nixpkgs#google-chrome
  2. is it an option to use chromium?
1 Like
  1. Result of running command you suggested
[rio:~/nixos]$ nix run nixpkgs#google-chrome                                                                                                                                                                (main✱)
error:
       … in the condition of the assert statement
         at /nix/store/j33wzkzndh41cyyy7i18bqm1srlv84cq-source/lib/customisation.nix:419:9:
          418|       drvPath =
          419|         assert condition;
             |         ^
          420|         drv.drvPath;

       … while evaluating the attribute 'handled'
         at /nix/store/j33wzkzndh41cyyy7i18bqm1srlv84cq-source/pkgs/stdenv/generic/check-meta.nix:507:7:
          506|       # or, alternatively, just output a warning message.
          507|       handled =
             |       ^
          508|         (

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Package ‘google-chrome-132.0.6834.110’ in /nix/store/j33wzkzndh41cyyy7i18bqm1srlv84cq-source/pkgs/by-name/go/google-chrome/package.nix:316 has an unfree license (‘unfree’), refusing to evaluate.

       a) To temporarily allow unfree packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNFREE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnfree = true; }
       in configuration.nix to override this.

       Alternatively you can configure a predicate to allow specific packages:
         { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
             "google-chrome"
           ];
         }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnfree = true; }
       to ~/.config/nixpkgs/config.nix.
[rio:~/nixos]$ NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#google-chrome                                                                                                                                (main✱)
[4310:4310:0212/131527.030136:ERROR:process_singleton_posix.cc(358)] The profile appears to be in use by another Google Chrome process (1579) on another computer (nixos).  Chrome has locked the profile so that it doesn't get corrupted.  If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chrome.
[4310:4310:0212/131527.030230:ERROR:message_box_dialog.cc(190)] Unable to show message box: Google Chrome - The profile appears to be in use by another Google Chrome process (1579) on another computer (nixos).  Chrome has locked the profile so that it doesn't get corrupted.  If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chrome.
NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#google-chrome  1.65s user 0.41s system 57% cpu 3.572 total
  1. Yes it is definitely an option to use chromium (I am using it right now), I would still prefer to have access to chrome (I use both browsers occasionally). I would also like to understand whats wrong with my current system, obviuosly.

for running it using nix run, you have to set NIXPKGS_ALLOW_UNFREE to 1 and add --impure (as suggested in the error message). try again with this

I have already done that (in my previous post). You can see it at the end of included shell output.

For convenience I include it once again here

[rio:~/nixos]$ NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#google-chrome                                                                                                                                (main✱)
[4310:4310:0212/131527.030136:ERROR:process_singleton_posix.cc(358)] The profile appears to be in use by another Google Chrome process (1579) on another computer (nixos).  Chrome has locked the profile so that it doesn't get corrupted.  If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chrome.
[4310:4310:0212/131527.030230:ERROR:message_box_dialog.cc(190)] Unable to show message box: Google Chrome - The profile appears to be in use by another Google Chrome process (1579) on another computer (nixos).  Chrome has locked the profile so that it doesn't get corrupted.  If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chrome.

The issue was solved by deleting the chrome lockfile (it wasn’t properly removed, since chrome crashed unexpectedly, it wasn’t a nixos problem).

rm ~/.config/google-chrome/SingletonLock