I am stuck in a login loop because of this error.

I've seen a few threads about this matter but none helped.

I do Ctrl+Alt+f2, when I log in it shows me two errors:

-bash: /home/imight/.profile: line 19 unexpected EOF while looking for matching
-bash: /home/imight/.profile: line 22: syntax error: unexpected end of file

The message basically says that there is something wrong with the file .profile in your home directory. You will either have to correct this error or to remove the file.

So use a Live CD or USB and boot from that. When the system is up, use "Try Ubuntu" and open the hard drive. You'll find it normally in the sidebar or you can open a terminal and enter ls /media. Your mounted hard drive lives there. Navigate to home/imight. The whole path is /media/SOMETHING/home/imight, where SOMETHING depends on the layout of your drive. The best option is to rename the file .profile to some other name. But you can also open the file and see if you can find the error. Once you've spotted it you might be able to correct it.

After you renamed the file or corrected it you can reboot into your system. Now you'll be able to login.


Try removing the .profile file and logging in again.

  • how do i do that? can i erase .profile file? – imight Feb 27 '13 at 19:58
  • try ls -l ~imight/.profile to check the ownership of the file and use rm command accordingly to remove it. – Arush Salil Feb 27 '13 at 20:04
  • 1
    Rather than removing .profile, it's better to rename it. For example: cd ~imight && mv .profile .profile.old Then no information is lost and the file can be restored later. – Eliah Kagan Feb 27 '13 at 22:33
  • @ArushSalil @EliahKagan What is ~imight? – mook765 Nov 15 '18 at 18:39
  • @mook765 The OP's home directory, /home/imight. – PerlDuck Nov 15 '18 at 18:48

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.