5

On Ubuntu 14.04, I am getting the error "The value for the SHELL variable was not found the /etc/shells file" when running pkexec to run a script.

Most likely this error started after I removed the fish shell, that was set as my default shell.

The content of /etc/shells is:

# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash

How may I fix this?

kos
  • 41,378
J. Doe
  • 53
  • 1
  • 1
  • 4
  • just stumbled across this same error when trying to run gufw - turns out the issue in my case was that /etc/shells only had one entry after installing nu shell (/usr/bin/nu), which was not the shell I used to call gufw. Adding my actual shell to /etc/shells fixed the issue. – FObersteiner May 06 '25 at 13:01

1 Answers1

8

The problem is this one: pkexec is accessing $SHELL to determine which shell to use to evaluate the remainder of the command; since you uninstalled fish but didn't do anything else, $SHELL still contains /usr/bin/fish, but pkexec doesn't deem /usr/bin/fish as a valid shell, since /usr/bin/fish has been removed from /etc/shells.

You need to do these two things:

  1. Set a new shell for your user, so that the next time the environment is load $SHELL will contain a path to a valid shell. E.g. to set Bash as the new shell for your user (replace user with your user's username):

    sudo chsh -s /bin/bash user
    
  2. Log out / log in to reload the environment so that $SHELL contains the path to the new shell for your user.

kos
  • 41,378
  • This didn't work for me. Without sudo, I received: "You may not change the shell for 'name'." With sudo no error but after loging back in, same pkexec error. – J. Doe Jan 05 '16 at 20:28
  • 1
    @J.Doe Right. sudo chsh -s /bin/bash changes the shell for root. Do sudo chsh -s /bin/bash user, where user is your username instead. – kos Jan 05 '16 at 20:34