0

I have just installed Netbeans, and I have added

export PATH="$PATH:/home/jumbo/netbeans/bin"

to /etc/environment, which now looks like:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export PATH="$PATH:/home/jumbo/netbeans/bin"

But now I can't login normally, using LightDM gui. Every time I enter my password, the login screen clears and then comes back again. When I login via ctrl/alt/F3 there is no problem logging in, but it reports that "ls" cannot be found because "/bin" is not in the PATH.

Can anyone explain to me what I have done incorrectly?

ps: I've removed the offending line so that I can get on with my work, but I would still like to know the reason for this happening, if anyone can help.

2 Answers2

1

You assumed that /etc/environment is a script file which expands variables. It's not.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
  • Absolutely correct. Thank you. I've added the netbeans/bin to the PATH without trying to expand $PATH and my system now works. – user1501247 May 05 '19 at 09:55
0

I did something similar while configuring Texstudio to find arara in Texlive. Your system is most likely stuck in a login loop. But don't follow this highly upvoted answer to this login loop question. Instead, do what I say below:

  • Ctrl+ Alt_+F3 and login to the session. Ctrl+ Alt_+F3  output
  • Check if you can run any shell command like ls. If not, then that's the problem.
  • Type /usr/bin/sudo /usr/bin/vim /etc/environment
  • Use your knowledge of vim to delete the line that you added.
  • You can use any other non-GUI editor if you know the path to that editor's executable.
  • Save the file ':wq for vim'.
  • type poweroff
  • You would get some command suggestion like/sbin/poweroff.
  • Use it to power off or you can simply pull the plug.
  • Restart and you are done.

Both of us modified /etc/environment to add some environment variables and we made a mistake. You don't need export in /etc/environment as it is not a bad script. You need to go through Ubuntu EnvironmentVariables Then we used an editor to rectify that mistake by deleting whatever we added. After shutting down and restarting, the computer was able to use the correct configurations. Hence, everything proceeded smoothly, and things got fixed.

The credit goes to the comments by siddharthart and jbbarquero to this highly upvoted answer. Also, xpioneer comment in the login loop question reconfirmed what I had determined above.