0

Everything was working fine until this morning. The postgresql service has stopped and I can't start it.

When I run the command sudo service postgresql start, I get a [FAILED] message. Then, I go to the /var/lib/pgsql/pgstartup.log file, and I see the following error message:

runuser: /bin/bash:/sbin/nologin: No such file or directory

Then I tried to su to root, which I have been able to do in the past, but I get the same error message. Then I tried to su to the user postgres, and I get the same error message.

The files do exist, I checked them both (/bin/bash and /sbin/nologin).

NOTE - I was able to resolve the error by typing the following command - sudo chsh root -s $SHELL. This actually allowed me to start the postgresql server after su'ing to root. I guess my question now is - Does anyone know what would cause this situation? Should I be concerned that my system is compromised security-wise?

1
  • 1
    Presumably someone edited the password database and changed the user's login shell to /bin/bash:/sbin/nologin Commented Mar 2, 2021 at 15:48

1 Answer 1

1

For whatever reason, your root user's login shell was set to the literal value /bin/bash:/sbin/nologin. When running things as root through sudo and when the root login shell was needed, the system would be trying to execute the literal command /bin/bash:/sbin/nologin, which for obvious reasons does not exist. It does not matter that /bin/bash and /sbin/nologin exists separately.

After your fix with chsh, you most likely want to check the root login shell to make sure that it is in fact /bin/bash (the default login shell on Oracle Linux). You should be able to do that by simply checking the entry returned by

getent passwd root

There should be seven :-delimited fields, and the last should say /bin/bash.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .