2

I changed my ~/.profile and now I can't login.

I'm new to Linux and I was trying to add adb/fastboot (android development tools) to my PATH by editing PATH in .profile. I had done a different method before, but I'm unable to find that method again, and a lot of people tend to recommend editing .profile to add environmental variables to PATH.

Back to the problem. I try to log in, but Linux simply returns "Your session only lasted less than 10 seconds...." and then when I go to see the details, it shows...

syndaemon: no process found
/etc/mdm/Xsession: Beginning session setup...
/etc/mdm/Xsession: Executing cinnamon-session-cinnamon failed, will try to run x-terminal-emulator
/etc/mdm/Xsession: 205: exec: x-terminal-emulator: not found

I'm running 64-bit Linux Mint Cinnamon v17.3

How do I undo the changes to ~/.profile? Or how do I at least login so that I can undo the changes via gedit?

Thanks!

  • you're sure you changed /home/youruser/.profile and not /etc/profile (or anything else in /etc/), right? – cat Jan 19 '16 at 4:41
2

These instructions will not work if you edited /etc/profile, as those changes affect all users. This is why you should...


...be careful when messing with your user's path, and make sure to make a copy of mission-critical files you edit!


  1. Reboot your machine.

  2. At the login screen, where you would normally type your password, hold Control and Alt, then press F1.

  3. At the login prompt, type root, and enter tooroot for the password.

    • if you get a message saying you are unable to be logged in as this user, login as yourself with your own password and try to run /usr/bin/sudo su (typed just like that) as your own user. If this also fails, you will need to use a LiveCD or other external media to recover.
  4. If you're logged in as root at this point, cd to your user's directory in /home. If you are the only user, your folder will be the only folder in /home.

    • Note that if your user's home directory is encrypted, all of this becomes a lot harder.
  5. Once the output of pwd shows you're sitting in your user's directory (and you've ensured that there's nothing important in any of the following files as they will be destroyed forever), type rm .profile .bash_profile .bashrc.

  6. Type exactly cp /etc/skel/.profile ./.profile.

  7. Type reboot, then wait for your machine to come up again. Try to log in; if it works: yay! if not, you should get a Live CD and mount your hard disk from the Live CD (or other Linux installation??) and delete the files from there.

  • 1
    Thank you so much for answering so quickly! I was able to get to step 5 as my own user, not as root user. Unfortunately, when i type in rm .profile -bash_profile .bashrc , I get "rm: invalid option -- 'b' [next line] Try 'rm --help' for more information." – Colton Jan 19 '16 at 5:08
  • @Colton no problem! Has it worked? – cat Jan 19 '16 at 5:09
  • Sorry, I pressed enter too soon. Please look above to see what I meant to say :) – Colton Jan 19 '16 at 5:10
  • @Colton I typed a - instead of a ., sorry. rm thinks - indicates an option. try rm .profile .bash_profile .bashrc instead – cat Jan 19 '16 at 5:12
  • 1
    Haha thank you so much. I saw the - and was confused, but again I'm fairly new to Linux, so I didn't bother to question it. Your method worked great! Thank you so much! – Colton Jan 19 '16 at 5:16

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.