2

I tried setting a new environment variable (I use linux mint 17). After restarting, I couldn't log back in. It says:

Your Session only lasted less thant 10 Seconds. If you have not logged out yourself, this could mean that there is some installation problem or that you may be out of diskspace. Try logging in with on of the failsafe sessions to see if you can fix this problem.

the ~/.xsession-errors file contains the following:

/etc/mdm/Xsession: Beginning session setup /etc/mdm/Xsession:: 3: export: :/home/myusername/mallet-2.0.7/:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin: bad variable name

so I basically tried to change the environment variable, trashed something in the process and can't log in. How can I repair this without logging in, while keeping all the data on my computer?

The command I used for changing the environment variable was

sudo gedit /etc/environment
echo "export PATH=$PATH:/home/myusername/mallet-2.0.7/" >> ~/.bashrc

Any help would be greatly appreciated!

  • echo "export PATH=$PATH:/home/myusername/mallet-2.0.7/" >> ~/.bashrc So, that's going to interpolate the existing value for $PATH into your .bashrc, and not the string '$PATH'. Probably not what you intended. – jsbillings Aug 15 '15 at 15:40
  • Also, the error you are getting makes me think you used: export $PATH=$PATH..., because it's claiming that you're using ":/home/myusername/mallet-2.0.7/:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin" as a variable name. – jsbillings Aug 15 '15 at 15:45
2

You'll probably still be able to log in in text mode. Press Ctrl+Alt+F1 and enter your user name and password at the login: and password: prompts, then run sudo -s to get a root shell. If you have a root password, you can log in as root directly.

The error looks like a failed attempt to set PATH. It's consistent with having an extra space in an assignment, like

export PATH= …$PATH…

instead of export PATH=…$PATH… (or just PATH=…$PATH…).

Depending on the exact nature of the problem, it may be reported at the point where the actual error is or later. To edit /etc/mdm/Xsession, run

nano /etc/mdm/Xsession

If that's not where the error is, check in your dot files and other files in /etc.

grep -s mallet-2.0.7 ~/.* /etc/* /etc/*/Xsession*

Once you think you've fixed the error (feel free to ask a new question on this site if you aren't sure how), press Ctrl+Alt+F7 to return to the GUI login prompt. You can use Ctrl+Alt+F1 and Ctrl+Alt+F7 to switch back and forth between the virtual consoles at any time.

  • your second sentence just saved my life. seriously. i was going to go get a drink. thanks.......! i've only worked off linux servers, this is my first at home laptop. i don't know anything all over again. – gloomy.penguin Jul 5 '15 at 4:56
1

So I also asked for help on the Linux Mint forums and some awesome user solved my problem. Apparently, by using the above command I modified the content of /etc/environment. It should only contain the following:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:"

To change that I had to enter as root in the recovery shell, change the partion to read/write using:

mount -o remount,rw  / 

and than edit /etc/environment using

nano /etc/environment

alternatively you can edit the /etc/environment as root:

sudo nano /etc/environment

Now it works again.

-1

How did you got the screen for text mode after press Ctrl+Alt+F1.

i did the same changes as you have done and facing same issue, i am not able to login in server and tried lot of way. kindly provide me steps to revert for my changes. it will be very help full for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.