Login shell not changing

A long time ago I changed from z̶s̶h̶ ̶t̶o̶ ̶f̶i̶s̶h̶ fish to zsh. On one computer this worked. On the other (shared import in configuration.nix file), the shell did not change, and yet the value seems correctly set:

tyler@sol ~> nix repl
Welcome to Nix version 2.3.1. Type :? for help.

nix-repl> :l <nixos>               
Added 11057 variables.

nix-repl> :l <nixpkgs/nixos>       
Added 6 variables.

nix-repl> config.users.users.tyler.shell
«derivation /nix/store/mjsi2g0lgxxizd71rni924xq7rwn0zhm-zsh-5.7.1.drv»

Fish is my default shell when I open Konsole. Do I need to manually chsh to zsh? (seems like I shouldn’t have to…)

Naturally I’ve tried sudo nixos-rebuild boot && reboot

You say the value seems correctly set, yet the nix repl log you just pasted shows your configured shell as zsh.

Eek typo in first sentence should have said “A long time ago I changed from fish to zsh”. I’ve noticed that when I ssh in, I get a zsh shell as expected, but in konsole I get a fish shell. I’ll try deleting ~/.cache when back on that computer

Unverified guess: You’ve got users.mutableUsers = true, which means that existing users are not modified. So you’d probably have to use chsh.

Check your Konsole configuration, perhaps you have configured it to not use the users shell but a different one?

1 Like

Appreciate the tips. The problem resolved itself, possibly because of deleting .cache

Edit: I spoke too soon. The issue is not resolved, so deleting .cache made no difference.

When I boot, /etc/shells does not list zsh. When I do sudo nixos-rebuild switch, zsh now appears in /etc/zsh. When I reboot, zsh is no longer in /etc/shells.

Edit: mutableUsers is false. I’ve now removed fish entirely from my configuration.nix and home.nix, and yet it still appears on my system. When I do switch and open a new shell, I get dumped into sh as /run/current-system/aw/bin/fish could not be found. This is despite /etc/passwd showing zsh as my shell! And on reboot, fish is back, and all changes to /etc/shells and /etc/passwd are reverted!! It’s like I have a fish rootkit lol wtf is happening.

Edit 2: even chsh fails:

> chsh -s /run/current-system/sw/bin/zsh
Cannot change ID to root.

Edit3: after switch and logout, login is to zsh. However on reboot fish has magically reappeared. Something seems horribly wrong with my nixos

I had a similar problem and found the solution on this reddit post, if anyone’s wondering. You need to set environment.shells = [ pkgs.zsh ] and enable it as well. Should work

Hosted by Flying Circus.