Background: This evening I was installing the new Android Studio IDE which required my setting of some JAVA OS-level environmental variables i.e. JAVA_HOME. This I did in the bashrc file in my user home directory and later realized that I messed up the very important bashrc file which was needed for login initializations on my beloved Ubuntu desktop pc.
I hence couldn't log into my computer and decided to share how I fixed it in simple steps!
Recommendation: The solution below helps you have access to the file system to fix issues related to fstab, boot partition mishaps, GUI crash fixes etc.
1. From my Linux box I logged to the recovery mode(admin console) which was successful.
2. I had the challenge of writing to or editing my "embattled" bashrc file because the whole file system was in a read-only mode - even with my logged-on administrator privileges.
3. I had to make my root file system writable by remounting it with the appropriate flags as snapped below:
mount -o remount,rw /
4. With this done, I proceeded to undo whatever changes I made to my system
earlier i.e. to delete a line I added to my bashrc file which triggered the mess.
I had to edit the bashrc file as a privileged user using pico a special text
editor on linux. You can use other great text editors if available on-system
e.g. vi,vim, nano etc.
sudo pico /home/ ...user... /.bashrc
or just
pico /home/..user.../.bashrc
5. I now proceeded to fix the wrong entries I made in the bashrc file opened below
6. I saved my entries and got to the graphical login console by starting the xwindow linux GUI .
7. That's all, best of luck :)