Terminal won't launch (Ubuntu 16.04)

A weird thing happened today: I clicked on the terminal icon and it didn't launch - just blinked and disappeared. If I press Ctrl+Alt+T, it won't launch. I tried to launch a light terminal by pressing Ctrl+Alt+F1. The login screen to put my login and password appeared, the system accepted the login and password but quickly returned to the login screen. It's a kind of loop: I enter the login and the system returns to the login screen. Xterm doesn't work too, however Unity seems to work correctly.

It's the first time that the terminal doesn't work, and I don't know how to fix this bug. I would appreciate any kind of help.

UPDATE:

I had installed mysecureshell before the reported issue and, when I removed this package, the problem was partially corrected. The terminal works (xterm too), but the light terminals (tty), accessed by Ctrl+Alt+F1, remain in loop during the login.

Below are pasted my .bashrc and the result of dmesg:

  • ~/.bashrc: http://paste.ubuntu.com/16918978/

  • dmesg: http://paste.ubuntu.com/16918993/


In my case I upgraded python3.5 to python3.6.

For that workaround run xterm. Then run the following two commands:

sudo rm /usr/bin/python3

sudo ln -s python3.5 /usr/bin/python3

I was having the same issue, but it was created as I updated python to 3.6 and selected alternative as python3.6. But when I reverted the option to the python3.5, terminal started working again.

So Can anyone tell me why did it happen? I used the command

sudo update-alternatives --config python3

The following message popped up:

There are 2 choices for the alternative python3 (providing /usr/bin/python3).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python3.6   2         auto mode
* 1            /usr/bin/python3.5   1         manual mode
  2            /usr/bin/python3.6   2         manual mode

Press <enter> to keep the current choice[*], or type selection number:

I selected 1 and it started working.