4

I get this message when I try to log in.

/etc/mdm/Xsession: Beginning session setup...
/etc/mdm/Xsession: 1: /etc/profile: id: not found
/etc/mdm/Xsession: 12: [: Illegal number: 
/etc/mdm/Xsession: Executing default failed, will try to run x-terminal-emulator
/etc/mdm/Xsession: 205: exec: x-terminal-emulator: not found

I've found a very similar problem here: Unable to log in. xsession-errors file looks like it could be useful if I understood but when I try to access the terminal by pressing Ctrl+Alt+F1 and type a command I get the following error:

me@me-ThinkPad-E520 / $ cat /etc/profile
Traceback (most recent call last):
file "/usr/lib/command-not-found", line 21, in <module>
     os.execvp("python3", [sys.argv[0]+sys.argv)
File "/usr/lib/python2,7/os.py, line 344, in execvp
    _execvpe (file,args)
File "/usr/lib/python2.7/os.py line 380, in _execvpe
    func (fullname, *argtest)
OSError: [Errno 2] No such file or directory

Before this happened I was installing Maven.

  • Obviously you have an error in either /etc/mdm/Xsession or /etc/profile. Edit your question and include both files content. – Braiam Oct 18 '14 at 0:27
  • Sadly, i dont know how to access those files from command line, im new in linux and the terminal is not my friend yet. If i do cat /etc/profile i get traceback message again. – chleba Oct 18 '14 at 0:33
  • Do cat /etc/mdm/Xsession and cat /etc/profile. Also, please, copy the whole output, not just the error, the command you called too. – Braiam Oct 18 '14 at 0:37
  • 1
    Err... I see that you don't even have a working cat, you might have to start considering doing a backup and reinstalling the system. – Braiam Oct 18 '14 at 1:12
2

Several executables are either missing from your system or cannot be found because your PATH is incorrect:

-python3 which is why /usr/lib/command-not-found cannot be executed. - cat (/bin/cat), which is why command-not-found is executed - id (/usr/bin/id), as used in the standard /etc/profile

The first is a link and its availability somewhat less of a necessity. What you should try is use ls to see whether those latter two command are available (ls -l /bin/cat /usr/bin/id). If you don't have those files you can try to reinstall them, but since they are so basic your system might not be able to do even that. The command to install both is apt-get install coreutils, but, to repeat, your system might not be able to do that any more.

If those files are there, check your PATH and where its value might be set so it doesn't include /usr/bin and/or /bin anymore.

If those files are not there, you might have removed them, as root, deinstalling core-utils is difficult because of its many dependencies.

1

I guess there can be many reasons for this issue, but I thought I'd share my solution. In my case, it was simply due to a syntax error in my ~/.profile file, there was basically one missing "=" in some place. I've fixed it by going into recovery mode and to a root prompt. Then I've updated the file, rebooted and it worked.

So that could be something to check if you have this error. If you've recently modified your .profile file, check it.

0

I had the same problem and I found a solution.

There are many other variants of what I call the

"10 second" issue.

My situation was exactly chleba's. I could not ls or apt-get. So I pressed <ctrl>+<alt>+<F1> and I got into tty1, and I logged in as root. However, I could still echo $PATH, which gave me something that I changed (messed up) yesterday. Then I ran

export PATH=$PATH:/home/[HomeDirectory]/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games.

(^ Sorry for crappy formatting. Source: wikihow.com/Change-the-Path-Variable-in-Linux)

Now, you can ls, cat, all that. BUT WAIT! Don't exit by pressing <ctrl>+<alt>+<F7>! You need to change your ~/.bashrc and ~/.profile files first to temporarily declare what directories you want your system to be able to access directly. If you're like me, you might not have a ~/.bashrc in your directory yet. Also, if you are logged in as root, aka you entered your 'username' or whatever as 'root', then you will have to cd /home/[HomeDirName] to get there. If you logged in with your usual credentials, you can just cd ~ and you'll be where we want to be. From here, run nano .profile or sudo nano .profile and at the very bottom add export PATH=$PATH:... all the same stuff as above. Then run [sudo] nano .bashrc, which creates the .bashrc file if it does not already exist (which was the case for me), and just paste in the same ol' export PATH=$PATH:... stuff.

Now you should be good.

Extra Goodies

Everyone likes extra goodies.

  1. My bet is that you could still run ls and apt-get, etc. You would just have to navigate to /etc/bin to run them, or run ./etc/bin/ls.sh or something. I don't really know where the coreutils are located, but it would look something like the above.

  2. In Linux Mint 17, according to my dad and this, your $PATH variable is located at /etc/environment. So you could just change that, which might not be a temporary fix. If you have time to look into that, drop a comment on whether or not that is a temporary fix. Just create a shell script in your Downloads directory and paste :~/[homeDirName]/Downloads at the end of the $PATH declaration in the environment file and see if you can run your shell script like this: cd ~ ./[shellscriptname].

  3. By the way, I got into this mess by trying to add shortcuts to scripts and applications scattered across my system.

0

I faced the same problem with ubuntu-7.10. On my VM, somehow permission of "/tmp" got changed. To fix the problem, I changed the permissions of "/tmp" to 777.

After this I was able to log in as a regular user successfully. This might help assuming your issue is same as of mine.

  • It should be noted this is done with sudo chmod 777 /tmp. – xjcl Mar 31 '18 at 10:26
0

Reason

I had same problem, It seems there may be different reasons to this problem but for me it was broken PATH as described below.

I installed oracle JDK and then set JAVA_HOME and PATH to directories JDK was installed. then after uninstalling them, I just forgot to remove these environment variable changes from /etc/environment file.

Solution

After log in with alt+ctrl+f2 I fixed PATH to:

export PATH="/bin:/usr/bin" 

Then I navigated to etc/environment and with:

sudo nano environment 

I was able to remove changes.

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.